From 288a1648234253440b6cc44ca4b55ae45391c2c4 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 10 Mar 2016 11:44:23 -0800 Subject: [PATCH] Retrieve current lookahead state before it can be removed in reduce --- src/runtime/parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/parser.c b/src/runtime/parser.c index b038dc58..0877b200 100644 --- a/src/runtime/parser.c +++ b/src/runtime/parser.c @@ -373,6 +373,7 @@ static ReduceResult ts_parser__reduce(TSParser *self, int head, TSSymbol symbol, int child_count, bool extra, bool fragile) { TSSymbolMetadata metadata = ts_language_symbol_metadata(self->language, symbol); + LookaheadState lookahead_state = *array_get(&self->lookahead_states, head); StackPopResult pop = ts_stack_pop_count(self->stack, head, child_count); if (!pop.slices.size) goto error; @@ -418,7 +419,6 @@ static ReduceResult ts_parser__reduce(TSParser *self, int head, TSSymbol symbol, } LOG("split_during_reduce new_head:%d", new_head); - LookaheadState lookahead_state = *array_get(&self->lookahead_states, head); if (!array_push(&self->lookahead_states, lookahead_state)) goto error; }