Fix bug when stack versions merge after reducing a non-terminal extra

This commit is contained in:
Max Brunsfeld 2022-06-24 13:19:58 -07:00
parent be463c7789
commit ca902065cb

View file

@ -1539,6 +1539,13 @@ static bool ts_parser__advance(
continue;
}
// A non-terminal extra rule was reduced and merged into an existing
// stack version. This version can be discarded.
if (!lookahead.ptr) {
ts_stack_halt(self->stack, version);
return true;
}
// If there were no parse actions for the current lookahead token, then
// it is not valid in this state. If the current lookahead token is a
// keyword, then switch to treating it as the normal word token if that