From 172cbb2d22870dae5e2d3eef892763f50e901d8f Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 27 Dec 2017 11:18:06 -0800 Subject: [PATCH] Fix infinite loop due to skipping empty tokens during error recovery --- src/runtime/parser.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/runtime/parser.c b/src/runtime/parser.c index ddd3e3b9..be69a040 100644 --- a/src/runtime/parser.c +++ b/src/runtime/parser.c @@ -908,6 +908,7 @@ static void parser__recover(Parser *self, StackVersion version, Tree *lookahead) for (unsigned i = 0; i < summary->size; i++) { StackSummaryEntry entry = summary->contents[i]; if (entry.state == ERROR_STATE) continue; + if (entry.position.bytes == position.bytes) continue; unsigned depth = entry.depth + ts_stack_depth_since_error(self->stack, version); unsigned new_cost =