When there's no error on the stack, keep only the best version
This commit is contained in:
parent
c984876e3a
commit
b561000b2a
1 changed files with 2 additions and 0 deletions
|
|
@ -378,6 +378,7 @@ static bool ts_parser__better_version_exists(TSParser *self,
|
|||
unsigned error_depth = ts_stack_error_depth(self->stack, i);
|
||||
|
||||
if ((error_depth > my_error_depth && error_cost >= my_error_cost) ||
|
||||
(my_error_depth == 0 && error_cost > my_error_cost) ||
|
||||
(error_depth == my_error_depth &&
|
||||
error_cost >= my_error_cost + ERROR_COST_THRESHOLD)) {
|
||||
LOG("halt_other version:%u", i);
|
||||
|
|
@ -386,6 +387,7 @@ static bool ts_parser__better_version_exists(TSParser *self,
|
|||
}
|
||||
|
||||
if ((my_error_depth > error_depth && my_error_cost >= error_cost) ||
|
||||
(error_depth == 0 && my_error_cost > error_cost) ||
|
||||
(my_error_depth == error_depth &&
|
||||
my_error_cost >= error_cost + ERROR_COST_THRESHOLD)) {
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue