UNPKG

sgr-parser

Version:

Parse escape sequence for console. (Especially for SGR)

51 lines (50 loc) 1.35 kB
export declare enum TokenType { Escape = 0, String = 1, Error = 2, } export interface IToken { tokenType: TokenType; } export declare class EscapeToken implements IToken { private _options; private _code; constructor(_options: Array<number>, _code: number); readonly tokenType: TokenType; readonly options: Array<number>; readonly code: number; } export declare class StringToken implements IToken { private _str; constructor(_str: string); readonly tokenType: TokenType; readonly str: string; } export declare class ErrorToken implements IToken { private _str; constructor(_str: string); readonly tokenType: TokenType; readonly str: string; } export declare class Line { private _str; private _classname; private _newLine; private _removeLine; constructor(_str: string, _classname: string, _newLine: boolean, _removeLine: boolean); readonly str: string; readonly classname: string; readonly newLine: boolean; readonly removeLine: boolean; } export declare class SGRParser { private keepState; private handleCR; private classes; private newLine; private state; private options; constructor(keepState: boolean, handleCR: boolean); parse(line: string): Array<Line>; tokenize(line: string): Array<IToken>; }