Remove stack versions that are worse than the finished tree

This commit is contained in:
Max Brunsfeld 2016-08-06 21:22:44 -07:00
parent 4feceabd58
commit c984876e3a

View file

@ -367,6 +367,9 @@ static bool ts_parser__better_version_exists(TSParser *self,
StackVersion version,
unsigned my_error_depth,
unsigned my_error_cost) {
if (self->finished_tree && self->finished_tree->error_size <= my_error_cost)
return true;
for (StackVersion i = 0, n = ts_stack_version_count(self->stack); i < n; i++) {
if (i == version || ts_stack_is_halted(self->stack, i))
continue;