Put back limit on error handling based on accepted tree count

This commit is contained in:
Max Brunsfeld 2018-04-02 12:07:14 -07:00
parent 0ec7e5ce42
commit 34349f9cbb

View file

@ -1142,12 +1142,12 @@ static unsigned parser__condense_stack(Parser *self) {
bool has_unpaused_version = false;
for (StackVersion i = 0, n = ts_stack_version_count(self->stack); i < n; i++) {
if (ts_stack_is_paused(self->stack, i)) {
if (!has_unpaused_version) {
if (!has_unpaused_version && self->accept_count < MAX_VERSION_COUNT) {
LOG("resume version:%u", i);
min_error_cost = ts_stack_error_cost(self->stack, i);
TSSymbol lookahead_symbol = ts_stack_resume(self->stack, i);
parser__handle_error(self, i, lookahead_symbol);
has_unpaused_version = true;
min_error_cost = ts_stack_error_cost(self->stack, i);
} else {
ts_stack_remove_version(self->stack, i);
i--;