Use a more exact test for reusability of error nodes

Based on the concept of node fragility from wagner's incremental
parsing paper
This commit is contained in:
Max Brunsfeld 2015-02-21 10:39:58 -08:00
parent 75da0a5774
commit a92067702d
4 changed files with 75 additions and 26 deletions

View file

@ -106,7 +106,8 @@ static TSTree *break_down_right_stack(TSParser *parser) {
TSParseAction action = get_action(parser->language, state, node->symbol);
bool is_usable = (action.type != TSParseActionTypeError) &&
!ts_tree_has_error(node) && !ts_tree_is_extra(node);
!ts_tree_is_extra(node) &&
!ts_tree_is_fragile_left(node) && !ts_tree_is_fragile_right(node);
if (is_usable && right_subtree_start == current_position.chars) {
ts_stack_shrink(&parser->right_stack, parser->right_stack.size - 1);
return node;