Table of Contents

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 SequenceParsed Element Types
ControlCode.ESCPAnsiControlStringInitiator or AnsiControlString (Device control string)
ControlCode.ESCXAnsiControlStringInitiator 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.