From 20982fdcb9aebf409897c5c34c2a51260e15336f Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 22 Jun 2017 16:04:42 -0700 Subject: [PATCH] Mark tokens as non-reusable in states where shorter takes take precedence This fixes some randomized test failures in the C grammar, relating to Object-like macros. The object-like macro rule relies on a whitespace token in order to distinguish object-like macros whose values begin with a '(' from function-like macros. The presence of that whitespace token means that other nodes should not be reusable in that state. --- src/compiler/build_tables/lex_conflict_manager.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/compiler/build_tables/lex_conflict_manager.cc b/src/compiler/build_tables/lex_conflict_manager.cc index 82b5efaf..ccac60ff 100644 --- a/src/compiler/build_tables/lex_conflict_manager.cc +++ b/src/compiler/build_tables/lex_conflict_manager.cc @@ -16,6 +16,9 @@ bool LexConflictManager::resolve(const LexItemSet &item_set, } return true; } else { + for (const LexItem &item : item_set.entries) { + possible_homonyms[item.lhs.index].insert(old_action.symbol.index); + } return false; } }