Suppress one unnecessary type of error recovery variation
If we already have a stack version in which, for example, a `function_call` is skipped, don't create another stack version in which that `function_call` is reduced to an `expression`, and then the `expression` is skipped. That doesn't improve the error recovery at all, but adds to the branching factor of the parse stack and makes things harder to debug.
This commit is contained in:
parent
819b63e78d
commit
93d7a75b09
2 changed files with 3 additions and 2 deletions
|
|
@ -550,7 +550,7 @@ static StackPopResult parser__reduce(Parser *self, StackVersion version,
|
|||
// If this pop operation terminated at the end of an error region, then
|
||||
// create two stack versions: one in which the parent node is interpreted
|
||||
// normally, and one in which the parent node is skipped.
|
||||
if (state == ERROR_STATE && allow_skipping) {
|
||||
if (state == ERROR_STATE && allow_skipping && child_count > 1) {
|
||||
StackVersion other_version = ts_stack_copy_version(self->stack, slice.version);
|
||||
|
||||
ts_stack_push(self->stack, other_version, parent, false, ERROR_STATE);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue