Fix conflict reporting for shift/reduce conflicts w/ multiple reductions

We were failing to rule out shift actions with lower precedence.

Signed-off-by: Philip Turnbull <philipturnbull@github.com>
This commit is contained in:
Max Brunsfeld 2017-08-02 15:13:30 -07:00 committed by Philip Turnbull
parent 418e7c8f1f
commit 119c67dd78
4 changed files with 80 additions and 0 deletions

View file

@ -544,6 +544,13 @@ class ParseTableBuilder {
(shift_precedence.max == reduction_precedence &&
shift_precedence.min < reduction_precedence)) {
entry.actions.pop_back();
for (auto item_iter = conflicting_items.begin(); item_iter != conflicting_items.end();) {
if (item_iter->is_done()) {
++item_iter;
} else {
item_iter = conflicting_items.erase(item_iter);
}
}
}
// If the shift action has the same precedence as the reduce actions,