Consider multiple error repairs on the same path of the stack

This changes the API to the stack_iterate function so that you can pop
from the stack without stopping iteration
This commit is contained in:
Max Brunsfeld 2016-04-15 21:28:00 -07:00
parent 3778c63277
commit cad663b144
8 changed files with 203 additions and 216 deletions

View file

@ -72,15 +72,15 @@ struct StackEntry {
vector<StackEntry> get_stack_entries(Stack *stack, StackVersion version) {
vector<StackEntry> result;
ts_stack_pop_until(
ts_stack_iterate(
stack,
version,
[](void *payload, TSStateId state, size_t tree_count, bool is_done, bool is_pending) {
[](void *payload, TSStateId state, size_t tree_count, bool is_done, bool is_pending) -> StackIterateAction {
auto entries = static_cast<vector<StackEntry> *>(payload);
StackEntry entry = {state, tree_count};
if (find(entries->begin(), entries->end(), entry) == entries->end())
entries->push_back(entry);
return StackIterateContinue;
return StackIterateNone;
}, &result);
return result;
}