libvt.parser

Clean-room VT500 streaming byte parser and SGR parameter decoder.

State transitions follow Paul Flo Williams’ public DEC ANSI parser state diagram (ECMA-48 / DEC STD 070) with UTF-8 multi-byte decoding, 7-bit string escape isolation via ParserState.STRING_ESC, optional legacy Latin-1 8-bit C1 wire parsing, and bounded parameter and string buffers.

class libvt.parser.ActionSink
class libvt.parser.ActionSink

Bases: Protocol

Zero-allocation callback target for Parser.feed_to().

class libvt.parser.ApcDispatch
class libvt.parser.ApcDispatch

Bases: object

Completed Application Program Command (APC), e.g. Kitty graphics.

class libvt.parser.CsiDispatch
class libvt.parser.CsiDispatch

Bases: object

Completed CSI control sequence.

class libvt.parser.CsiParams
class libvt.parser.CsiParams

Bases: object

Parsed CSI parameter list preserving ; vs : subparameter boundaries.

class libvt.parser.DcsDispatch
class libvt.parser.DcsDispatch

Bases: object

Completed Device Control String (DCS), including SIXEL.

class libvt.parser.EscDispatch
class libvt.parser.EscDispatch

Bases: object

Completed two- or multi-byte ESC sequence.

class libvt.parser.Execute
class libvt.parser.Execute

Bases: object

C0 control byte executed immediately.

class libvt.parser.OscDispatch
class libvt.parser.OscDispatch

Bases: object

Completed Operating System Command (OSC).

class libvt.parser.Parser
class libvt.parser.Parser

Bases: object

Streaming VT500 / ANSI escape-sequence byte parser.

class libvt.parser.ParserState
class libvt.parser.ParserState

Bases: IntEnum

States of the DEC ANSI / VT500 byte state machine.

class libvt.parser.Print
class libvt.parser.Print

Bases: object

Decoded printable text emitted in GROUND state.

libvt.parser.parse_sgr(params, current=DEFAULT_STYLE, *, memo=None)
function[source]
function[source]
libvt.parser.parse_sgr(params, current=DEFAULT_STYLE, *, memo=None)

Apply CSI ... m parameters to current and return a new Style.

Parameters:
Return type:

Style