- Structure composed of Tokens Types this lexer will identify.
In the simple case the structure is an array of TokenTypes. In the case of IMultiModeLexerDefinition the structure is an object with two properties:
a "defaultMode" property specifying the initial lexer mode.
for example:
{
modes : {
modeX : [Token1, Token2],
modeY : [Token3, Token4]
},
defaultMode : "modeY"
}
A lexer with MultiModesDefinition is simply multiple Lexers where only one Lexer(mode) can be active at the same time. This is useful for lexing languages where there are different lexing rules depending on context.
The current lexing mode is selected via a "mode stack". The last (peek) value in the stack will be the current mode of the lexer. Defining entering and exiting lexer modes is done using the "push_mode" and "pop_mode" properites of the {@link createToken.config} parameter.
Note that there are situations in which we may wish to order the longer pattern after the shorter one. For example: keywords vs Identifiers.
A Constant to mark "abstract" TokenTypes that are used purely as token categories. See: {@link createToken.categories}
Will lex(Tokenize) a string. Note that this can be called repeatedly on different strings as this method does not modify the state of the Lexer.
The string to lex
Generated using TypeDoc