Simplify parse version reordering

This commit is contained in:
Max Brunsfeld 2017-08-04 14:51:14 -07:00
parent 85be0e7e75
commit 1dca3a0b58
2 changed files with 5 additions and 8 deletions

View file

@ -169,7 +169,6 @@ static CondenseResult parser__condense_stack(Parser *self) {
continue;
}
StackVersion version_to_swap = STACK_VERSION_NONE;
ErrorStatus right_error_status = ts_stack_error_status(self->stack, i);
if (right_error_status.count == 0) has_version_without_errors = true;
@ -207,8 +206,9 @@ static CondenseResult parser__condense_stack(Parser *self) {
result |= CondenseResultMadeChange;
i--;
j--;
} else if (version_to_swap != STACK_VERSION_NONE) {
version_to_swap = j;
} else {
ts_stack_swap_versions(self->stack, i, j);
j = i;
result |= CondenseResultMadeChange;
}
break;
@ -222,10 +222,6 @@ static CondenseResult parser__condense_stack(Parser *self) {
}
}
}
if (version_to_swap != STACK_VERSION_NONE) {
ts_stack_swap_versions(self->stack, i, version_to_swap);
}
}
while (ts_stack_version_count(self->stack) > MAX_VERSION_COUNT) {

View file

@ -15,7 +15,8 @@ e f;
(ERROR (identifier))
(identifier))
(statement_block
(expression_statement (ERROR (identifier)) (identifier))))
(ERROR (identifier))
(expression_statement (identifier))))
(expression_statement (ERROR (identifier)) (identifier)))
=======================================================