diff --git a/include/tree_sitter/parser.h b/include/tree_sitter/parser.h index e7323322..d2091b11 100644 --- a/include/tree_sitter/parser.h +++ b/include/tree_sitter/parser.h @@ -83,7 +83,7 @@ typedef union { typedef union { TSSymbol symbol; - unsigned int count; + unsigned short count; } TSInProgressSymbolEntry; struct TSLanguage { diff --git a/src/runtime/language.c b/src/runtime/language.c index ad4cca0e..3b703440 100644 --- a/src/runtime/language.c +++ b/src/runtime/language.c @@ -56,11 +56,10 @@ bool ts_language_symbol_is_in_progress(const TSLanguage *self, TSStateId state, if (state == ts_parse_state_error) return false; unsigned index = self->in_progress_symbol_table[state]; - size_t count = self->in_progress_symbols[index].count; - const TSSymbol *symbols = (TSSymbol *)(self->in_progress_symbols + index + 1); - for (size_t i = 0; i < count; i++) { - if (symbols[i] == symbol) + unsigned short count = self->in_progress_symbols[index].count; + const TSInProgressSymbolEntry *entries = self->in_progress_symbols + index + 1; + for (size_t i = 0; i < count; i++) + if (entries[i].symbol == symbol) return true; - } return false; }