pub unsafe extern "C" fn ts_lookahead_iterator_new(
self_: *const TSLanguage,
state: TSStateId,
) -> *mut TSLookaheadIterator
Expand description
Create a new lookahead iterator for the given language and parse state.
This returns NULL
if state is invalid for the language.
Repeatedly using ts_lookahead_iterator_next
and
ts_lookahead_iterator_current_symbol
will generate valid symbols in the
given parse state. Newly created lookahead iterators will contain 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.