Class AnsiEscapeSequence
- Namespace
- Microlithix.Text.Ansi.Element
- Assembly
- AnsiParser.dll
Represents a single ANSI escape sequence from the parsed input.
public record AnsiEscapeSequence : IAnsiStreamParserElement, IAnsiStringParserElement, IEquatable<AnsiEscapeSequence>
- Inheritance
-
AnsiEscapeSequence
- Implements
- Inherited Members
Remarks
Escape sequences consist of the escape code (0x1b
) followed by zero
or more intermediate character codes in the range 0x20
...0x2f
,
followed by exactly one character code in the range 0x30
...0x7e
.
In the present implementation, invalid codes will terminate the escape
sequence.
An escape sequence can be complete in and of itself, or it can indicate that another type of sequence follows, such as a control sequence or a control string.
All of the self-contained escape sequences are parsed into AnsiEscapeSequence elements. However, some escape sequences that introduce other types of sequences will not themselves be parsed into elements. Instead, the introduced sequences will be parsed into element types specific to their own functionality. The following table lists escape sequences that fall into this category, along with the types of elements into which the introduced sequences will be parsed:
Escape Sequence | Parsed Element Types |
---|---|
ControlCode.ESCP | AnsiControlStringInitiator or AnsiControlString (Device control string) |
ControlCode.ESCX | AnsiControlStringInitiator or AnsiControlString (General purpose string) |
ControlCode.ESC[ | AnsiControlSequence or AnsiPrivateControlSequence |
ControlCode.ESC] | AnsiControlStringInitiator or AnsiControlString (Operating System Command) |
ControlCode.ESC^ | AnsiControlStringInitiator or AnsiControlString (Privacy Message) |
ControlCode.ESC_ | AnsiControlStringInitiator or AnsiControlString (Application Program Command) |
Constructors
- AnsiEscapeSequence(char, string)
Creates a new AnsiEscapeSequence instance with the specified escape code and intermediate bytes.
Properties
- Code
The final character code as a single UTF-16 character.
- IntermediateBytes
The intermediate bytes as a string of characters.