Relax overly conservative parse state mergeability check
Built-in symbols (e.g. EOF, ERROR) should not prevent parse states from being merged. Neither should non-token productions.
This commit is contained in:
parent
e53beb66c9
commit
3b3fddd64d
1 changed files with 2 additions and 2 deletions
|
|
@ -206,7 +206,7 @@ bool ParseTable::merge_state(size_t i, size_t j) {
|
||||||
|
|
||||||
const auto &other_entry = other.entries.find(symbol);
|
const auto &other_entry = other.entries.find(symbol);
|
||||||
if (other_entry == other.entries.end()) {
|
if (other_entry == other.entries.end()) {
|
||||||
if (mergeable_symbols.count(symbol) == 0)
|
if (mergeable_symbols.count(symbol) == 0 && !symbol.is_built_in() && symbol.is_token)
|
||||||
return false;
|
return false;
|
||||||
if (actions.back().type != ParseActionTypeReduce)
|
if (actions.back().type != ParseActionTypeReduce)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -224,7 +224,7 @@ bool ParseTable::merge_state(size_t i, size_t j) {
|
||||||
const vector<ParseAction> &actions = entry.second.actions;
|
const vector<ParseAction> &actions = entry.second.actions;
|
||||||
|
|
||||||
if (!state.entries.count(symbol)) {
|
if (!state.entries.count(symbol)) {
|
||||||
if (mergeable_symbols.count(symbol) == 0)
|
if (mergeable_symbols.count(symbol) == 0 && !symbol.is_built_in() && symbol.is_token)
|
||||||
return false;
|
return false;
|
||||||
if (actions.back().type != ParseActionTypeReduce)
|
if (actions.back().type != ParseActionTypeReduce)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue