TApxTerminalEmulator.Parser

TApxTerminalEmulator

property Parser : TApxTerminalParser

Accesses the emulator's terminal control sequence parser.

The Parser property is the engine that interprets the incoming data stream for the emulator. The parser decides which sets of characters are terminal control sequences and which are merely characters to be displayed.

The emulator creates a parser object in its Create constructor and frees it in the Destroy destructor. Indeed, some emulator descendant classes do not require a parser object (for example, the TTY emulator) and, hence, do not ever create one. Be aware that reading the Parser property may return nil.

The emulator will call the ProcessChar method of the parser, if there is one, for every character it receives from the terminal component. It will act on the return value of this call, making use of the parser's Command, Sequence, and Argument properties to alter the buffer object to reflect the new view of the terminal.

It is possible to replace the parser at run time. This will have the effect of altering the behavior of the emulator component. The class will dispose of the old parser and start using the new one. Be aware that it is possible to switch parsers while the old parser is in the middle of processing a terminal control sequence. In that case, the partially received control sequence is lost. It is best to replace the parser just after calling the old parser's ProcessChar method, if it does not return pctPending.