Remove duplicate parse actions

This has only come up for out-of-context states, but it seems possible now that there
could be duplicate actions for any state, because of the possibility of multiple
actions with different precedence or associativity that are otherwise the same
This commit is contained in:
Max Brunsfeld 2016-03-02 20:52:18 -08:00
parent b68f7212c8
commit b733b0cc81

View file

@ -230,6 +230,19 @@ class ParseTableBuilder {
action.associativity = rules::AssociativityNone;
}
}
for (auto i = entry.second.begin(); i != entry.second.end();) {
bool erased = false;
for (auto j = entry.second.begin(); j != i; j++) {
if (*j == *i) {
entry.second.erase(i);
erased = true;
break;
}
}
if (!erased)
++i;
}
}
if (!symbols_with_multiple_actions.empty()) {