This commit is contained in:
Maieul BOYER 2024-04-30 15:57:07 +02:00
parent 5bec1546aa
commit c7fb66c70d
No known key found for this signature in database
15 changed files with 572 additions and 164 deletions

View file

@ -30,7 +30,7 @@ void ts_language_table_entry(
const t_language *self,
t_state_id state,
t_symbol symbol,
TableEntry *result
t_table_entry *result
) {
if (symbol == ts_builtin_sym_error || symbol == ts_builtin_sym_error_repeat) {
result->action_count = 0;
@ -171,7 +171,7 @@ t_field_id ts_language_field_id_for_name(
t_lookahead_iterator *ts_lookahead_iterator_new(const t_language *self, t_state_id state) {
if (state >= self->state_count) return NULL;
LookaheadIterator *iterator = malloc(sizeof(LookaheadIterator));
t_lookahead_iterator *iterator = malloc(sizeof(t_lookahead_iterator));
*iterator = ts_language_lookaheads(self, state);
return (t_lookahead_iterator *)iterator;
}
@ -181,35 +181,35 @@ void ts_lookahead_iterator_delete(t_lookahead_iterator *self) {
}
bool ts_lookahead_iterator_reset_state(t_lookahead_iterator * self, t_state_id state) {
LookaheadIterator *iterator = (LookaheadIterator *)self;
t_lookahead_iterator *iterator = (t_lookahead_iterator *)self;
if (state >= iterator->language->state_count) return false;
*iterator = ts_language_lookaheads(iterator->language, state);
return true;
}
const t_language *ts_lookahead_iterator_language(const t_lookahead_iterator *self) {
const LookaheadIterator *iterator = (const LookaheadIterator *)self;
const t_lookahead_iterator *iterator = (const t_lookahead_iterator *)self;
return iterator->language;
}
bool ts_lookahead_iterator_reset(t_lookahead_iterator *self, const t_language *language, t_state_id state) {
if (state >= language->state_count) return false;
LookaheadIterator *iterator = (LookaheadIterator *)self;
t_lookahead_iterator *iterator = (t_lookahead_iterator *)self;
*iterator = ts_language_lookaheads(language, state);
return true;
}
bool ts_lookahead_iterator_next(t_lookahead_iterator *self) {
LookaheadIterator *iterator = (LookaheadIterator *)self;
t_lookahead_iterator *iterator = (t_lookahead_iterator *)self;
return ts_lookahead_iterator__next(iterator);
}
t_symbol ts_lookahead_iterator_current_symbol(const t_lookahead_iterator *self) {
const LookaheadIterator *iterator = (const LookaheadIterator *)self;
const t_lookahead_iterator *iterator = (const t_lookahead_iterator *)self;
return iterator->symbol;
}
const char *ts_lookahead_iterator_current_symbol_name(const t_lookahead_iterator *self) {
const LookaheadIterator *iterator = (const LookaheadIterator *)self;
const t_lookahead_iterator *iterator = (const t_lookahead_iterator *)self;
return ts_language_symbol_name(iterator->language, iterator->symbol);
}