Reuse fragile parent nodes that were reduced in the current state

This commit is contained in:
Max Brunsfeld 2015-12-22 13:59:04 -08:00
parent f9e6fce62d
commit 6b11890d68
3 changed files with 16 additions and 5 deletions

View file

@ -20,7 +20,8 @@ TSTree *ts_tree_make_leaf(TSSymbol sym, TSLength padding, TSLength size,
.padding = padding,
.options.visible = metadata.visible,
.options.named = metadata.named,
.context.lex_state = TSTREE_LEX_STATE_INDEPENDENT,
.context.lex_state = TSTREE_STATE_INDEPENDENT,
.context.parse_state = TSTREE_STATE_INDEPENDENT,
};
if (sym == ts_builtin_sym_error) {
@ -87,6 +88,7 @@ void ts_tree_set_children(TSTree *self, size_t child_count, TSTree **children) {
if (child->symbol == ts_builtin_sym_error) {
self->options.fragile_left = self->options.fragile_right = true;
self->context.parse_state = TSTREE_STATE_ERROR;
}
}