From 4e6e996a7603310479ae968cc05f80c8adbebced Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 15 Aug 2016 17:37:00 -0700 Subject: [PATCH] Simplify skipping of reduced subtrees after errors --- src/runtime/parser.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/runtime/parser.c b/src/runtime/parser.c index 64ead884..4dea281a 100644 --- a/src/runtime/parser.c +++ b/src/runtime/parser.c @@ -511,7 +511,7 @@ static Reduction ts_parser__reduce(TSParser *self, StackVersion version, action->type == TSParseActionTypeRecover); new_state = action->to_state; - if (action->type == TSParseActionTypeRecover && allow_skipping) { + if (action->type == TSParseActionTypeRecover && child_count > 1 && allow_skipping) { unsigned error_depth = ts_stack_error_depth(self->stack, slice.version); unsigned error_cost = ts_stack_error_cost(self->stack, slice.version) + 1; @@ -528,10 +528,6 @@ static Reduction ts_parser__reduce(TSParser *self, StackVersion version, CHECK(ts_stack_push(self->stack, other_version, tree, false, TS_STATE_ERROR)); } - - for (StackVersion v = version + 1; v < initial_version_count; v++) - if (ts_stack_merge(self->stack, v, other_version)) - break; } } }