Don't count extra tokens in error cost computation

This commit is contained in:
Max Brunsfeld 2016-06-14 14:47:16 -07:00
parent 2109f0ed74
commit 6dda23796b

View file

@ -120,7 +120,9 @@ recur:
static void ts_tree_total_tokens(const TSTree *self, size_t *result) {
recur:
if (self->child_count == 0) {
(*result)++;
if (!self->extra) {
(*result)++;
}
} else {
for (size_t i = 1; i < self->child_count; i++)
ts_tree_total_tokens(self->children[i], result);