The language to use for the lookahead iterator
The parse state to use for the lookahead iterator
Readonly
currentThe current symbol name of the lookahead iterator.
Readonly
currentThe current symbol of the lookahead iterator.
Reset the lookahead iterator.
This returns true
if the language was set successfully and false
otherwise.
The language to use for the lookahead iterator
The parse state to use for the lookahead iterator
Create a new lookahead iterator for this language and parse state.
This returns
null
if the state is invalid for this language.Iterating LookaheadIterator will yield valid symbols in the given parse state. Newly created lookahead iterators will have currentType populated with the
ERROR
symbol.Lookahead iterators can be useful to generate suggestions and improve syntax error diagnostics. To get symbols valid in an ERROR node, use the lookahead iterator on its first leaf node state. For
MISSING
nodes, a lookahead iterator created on the previous non-extra leaf node may be appropriate.