WIP: New check for mergable symbols in merge_state

This commit is contained in:
Timothy Clem 2016-10-18 13:03:41 -07:00
parent 82c9385518
commit 14bae584d4
3 changed files with 11 additions and 1 deletions

View file

@ -206,6 +206,8 @@ bool ParseTable::merge_state(size_t i, size_t j) {
const auto &other_entry = other.entries.find(symbol);
if (other_entry == other.entries.end()) {
if (mergeable_symbols.count(symbol) == 0)
return false;
if (actions.back().type != ParseActionTypeReduce)
return false;
if (!has_entry(other, entry.second))
@ -222,6 +224,8 @@ bool ParseTable::merge_state(size_t i, size_t j) {
const vector<ParseAction> &actions = entry.second.actions;
if (!state.entries.count(symbol)) {
if (mergeable_symbols.count(symbol) == 0)
return false;
if (actions.back().type != ParseActionTypeReduce)
return false;
if (!has_entry(state, entry.second))