From 34349f9cbb19870f3fd1f4e76a11a8c38368b207 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 2 Apr 2018 12:07:14 -0700 Subject: [PATCH] Put back limit on error handling based on accepted tree count --- src/runtime/parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtime/parser.c b/src/runtime/parser.c index 96f98cdf..9baf4ce2 100644 --- a/src/runtime/parser.c +++ b/src/runtime/parser.c @@ -1142,12 +1142,12 @@ static unsigned parser__condense_stack(Parser *self) { bool has_unpaused_version = false; for (StackVersion i = 0, n = ts_stack_version_count(self->stack); i < n; i++) { if (ts_stack_is_paused(self->stack, i)) { - if (!has_unpaused_version) { + if (!has_unpaused_version && self->accept_count < MAX_VERSION_COUNT) { LOG("resume version:%u", i); + min_error_cost = ts_stack_error_cost(self->stack, i); TSSymbol lookahead_symbol = ts_stack_resume(self->stack, i); parser__handle_error(self, i, lookahead_symbol); has_unpaused_version = true; - min_error_cost = ts_stack_error_cost(self->stack, i); } else { ts_stack_remove_version(self->stack, i); i--;