Fix false positive when marking nodes unreusable due to ambiguity
This commit is contained in:
parent
1e42e68098
commit
96e2e49ef8
2 changed files with 8 additions and 4 deletions
|
|
@ -10,8 +10,12 @@ const TSParseAction *ts_language_actions(const TSLanguage *self, TSStateId state
|
|||
TSSymbol symbol, size_t *count) {
|
||||
if (state == ts_parse_state_error) {
|
||||
*count = 1;
|
||||
return (symbol == ts_builtin_sym_error) ? &ERROR_SHIFT_EXTRA
|
||||
: &self->recovery_actions[symbol];
|
||||
if (symbol == ts_builtin_sym_error)
|
||||
return &ERROR_SHIFT_EXTRA;
|
||||
else if (self->recovery_actions[symbol].type == TSParseActionTypeError)
|
||||
return &ERROR_SHIFT_EXTRA;
|
||||
else
|
||||
return &self->recovery_actions[symbol];
|
||||
}
|
||||
|
||||
size_t action_index = 0;
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ static BreakdownResult ts_parser__breakdown_top_of_stack(TSParser *self,
|
|||
} else if (!last_child->extra) {
|
||||
TSParseAction action =
|
||||
ts_language_last_action(self->language, state, last_child->symbol);
|
||||
assert(action.type == TSParseActionTypeShift);
|
||||
assert(action.type == TSParseActionTypeShift || action.type == TSParseActionTypeRecover);
|
||||
state = action.data.to_state;
|
||||
}
|
||||
|
||||
|
|
@ -415,7 +415,7 @@ static Reduction ts_parser__reduce(TSParser *self, StackVersion version,
|
|||
}
|
||||
|
||||
TSStateId state = ts_stack_top_state(self->stack, slice.version);
|
||||
if (fragile || self->is_split || ts_stack_version_count(self->stack) > 1) {
|
||||
if (fragile || self->is_split || initial_version_count > 1) {
|
||||
parent->fragile_left = true;
|
||||
parent->fragile_right = true;
|
||||
parent->parse_state = TS_TREE_STATE_ERROR;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue