Add iteration over names

This commit is contained in:
Daumantas Kavolis 2023-06-15 17:25:08 +03:00
parent 1f52f2f1dc
commit 672d38803e
4 changed files with 51 additions and 2 deletions

View file

@ -181,7 +181,7 @@ bool ts_lookahead_iterator_reset_state(TSLookaheadIterator * self, TSStateId sta
}
const TSLanguage * ts_lookahead_iterator_language(const TSLookaheadIterator *self) {
LookaheadIterator *iterator = (LookaheadIterator *)self;
const LookaheadIterator *iterator = (const LookaheadIterator *)self;
return iterator->language;
}
@ -198,6 +198,11 @@ bool ts_lookahead_iterator_advance(TSLookaheadIterator *self) {
}
TSSymbol ts_lookahead_iterator_current_symbol(const TSLookaheadIterator *self) {
LookaheadIterator *iterator = (LookaheadIterator *)self;
const LookaheadIterator *iterator = (const LookaheadIterator *)self;
return iterator->symbol;
}
const char *ts_lookahead_iterator_current_symbol_name(const TSLookaheadIterator *self) {
const LookaheadIterator *iterator = (const LookaheadIterator *)self;
return ts_language_symbol_name(iterator->language, iterator->symbol);
}