Merge pull request #58 from tree-sitter/reduce-error-recovery-branching
Reduce the branching factor of the parse stack during error recovery
This commit is contained in:
commit
135d8ef4e0
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