ansi

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APC

type APC struct {
	Data string
}

func (APC) String

func (seq APC) String() string

type C0

type C0 rune

A C0 control code

func (C0) String

func (seq C0) String() string

type CSI

type CSI struct {
	Intermediate []rune
	Parameters   [][]int
	Final        rune
}

A CSI Sequence

func (CSI) String

func (seq CSI) String() string

type DCS

type DCS struct {
	Final        rune
	Intermediate []rune
	Parameters   []int
	Data         []rune
}

Sent at the beginning of a DCS passthrough sequence.

func (DCS) String

func (seq DCS) String() string

type EOF

type EOF struct{}

Sent when the underlying PTY is closed

func (EOF) String

func (seq EOF) String() string

type ESC

type ESC struct {
	Intermediate []rune
	Final        rune
}

An escape sequence with intermediate characters

func (ESC) String

func (seq ESC) String() string

type OSC

type OSC struct {
	Payload []rune
}

An OSC sequence. The Payload is the raw runes received, and must be parsed externally

func (OSC) String

func (seq OSC) String() string

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

https://vt100.net/emu/dec_ansi_parser

parser is an implementation of Paul Flo Williams' VT500-series parser, as seen [here](https://vt100.net/emu/dec_ansi_parser). The architecture is designed after Rob Pike's text/template parser, with a few modifications.

Many of the comments are directly from Paul Flo Williams description of the parser, licensed undo [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/)

func NewParser

func NewParser(r io.Reader) *Parser

func (*Parser) Close added in v0.6.0

func (p *Parser) Close()

func (*Parser) Finish added in v0.5.0

func (p *Parser) Finish(seq Sequence)

func (*Parser) Next

func (p *Parser) Next() chan Sequence

Next returns the next Sequence. Sequences will be of the following types:

error Sent on any parsing error
Print Print the character to the screen
C0    Execute the C0 code
ESC   Execute the ESC sequence
CSI   Execute the CSI sequence
OSC   Execute the OSC sequence
DCS   Execute the DCS sequence
EOF   Sent at end of input

func (*Parser) WaitClose added in v0.6.0

func (p *Parser) WaitClose()

type Print

type Print struct {
	Grapheme string
	Width    int
}

A character which should be printed to the screen

func (Print) String

func (seq Print) String() string

type SS3

type SS3 rune

func (SS3) String

func (seq SS3) String() string

type Sequence

type Sequence interface{}

Sequence is the generic data type of items emitted from the parser. These can be control sequences, escape sequences, or printable characters.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL