From 3b3fddd64d00781f7601b29edde23ac4e67038ce Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 26 Oct 2016 21:58:15 -0700 Subject: [PATCH] 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. --- src/compiler/parse_table.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/parse_table.cc b/src/compiler/parse_table.cc index b63d472b..ef0e235d 100644 --- a/src/compiler/parse_table.cc +++ b/src/compiler/parse_table.cc @@ -206,7 +206,7 @@ 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) + if (mergeable_symbols.count(symbol) == 0 && !symbol.is_built_in() && symbol.is_token) return false; if (actions.back().type != ParseActionTypeReduce) return false; @@ -224,7 +224,7 @@ bool ParseTable::merge_state(size_t i, size_t j) { const vector &actions = entry.second.actions; 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; if (actions.back().type != ParseActionTypeReduce) return false;