Fix stack breakdown procedure when there are trailing extra tokens

This commit is contained in:
Max Brunsfeld 2016-06-14 20:25:33 -07:00
parent e70547cd11
commit ecc7399ed3
2 changed files with 29 additions and 3 deletions

View file

@ -231,14 +231,17 @@ INLINE StackPopResult stack__iter(Stack *self, StackVersion version,
}
next_path->node = link.node;
if (!link.is_pending)
next_path->is_pending = false;
if (link.tree) {
if (!link.tree->extra)
if (!link.tree->extra) {
next_path->tree_count++;
if (!link.is_pending)
next_path->is_pending = false;
}
if (!array_push(&next_path->trees, link.tree))
goto error;
ts_tree_retain(link.tree);
} else {
next_path->is_pending = false;
}
}
}