Merge equivalent stacks in a separate stage of parsing

* No more automatic merging every time a state is pushed to the stack
* When popping from the stack, the current version is always preserved
This commit is contained in:
Max Brunsfeld 2016-04-10 14:12:24 -07:00
parent 827573f1c7
commit 695be5bc79
7 changed files with 582 additions and 755 deletions

View file

@ -51,6 +51,16 @@ void ts_tree_array_delete(TreeArray *self) {
array_delete(self);
}
size_t ts_tree_array_essential_count(const TreeArray *self) {
size_t result = 0;
for (size_t i = 0; i < self->size; i++) {
TSTree *tree = self->contents[i];
if (!tree->extra && tree->symbol != ts_builtin_sym_error)
result++;
}
return result;
}
TSTree *ts_tree_make_error(TSLength size, TSLength padding, char lookahead_char) {
TSTree *result = ts_tree_make_leaf(ts_builtin_sym_error, padding, size,
(TSSymbolMetadata){