Fix infinite loop due to skipping empty tokens during error recovery

This commit is contained in:
Max Brunsfeld 2017-12-27 11:18:06 -08:00
parent 2625c3a96c
commit 172cbb2d22

View file

@ -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 =