diff options
author | Sam McCall <sam.mccall@gmail.com> | 2022-08-19 15:15:37 +0200 |
---|---|---|
committer | Sam McCall <sam.mccall@gmail.com> | 2022-08-19 15:15:37 +0200 |
commit | 605035bf4508460f8c28857c7aaecf1d8c449ca8 (patch) | |
tree | 2d068bfb94efb2d832d95d185e20b8115c53446c /clang-tools-extra/pseudo | |
parent | 2cc7463c85c056e956ad332448189ce3e9004182 (diff) | |
download | llvm-605035bf4508460f8c28857c7aaecf1d8c449ca8.tar.gz |
[pseudo] Changes omitted from previous commit
Diffstat (limited to 'clang-tools-extra/pseudo')
-rw-r--r-- | clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h | 2 | ||||
-rw-r--r-- | clang-tools-extra/pseudo/lib/GLR.cpp | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h b/clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h index 8d8f8f74f16e..fc21eff35792 100644 --- a/clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h +++ b/clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h @@ -106,8 +106,6 @@ public: assert(isToken(Terminal)); assert(isNonterminal(Nonterminal)); // tok::unknown is a sentinel value used in recovery: can follow anything. - if (tok::unknown) - return true; return Terminal == tokenSymbol(tok::unknown) || FollowSets.test(tok::NUM_TOKENS * Nonterminal + symbolToToken(Terminal)); diff --git a/clang-tools-extra/pseudo/lib/GLR.cpp b/clang-tools-extra/pseudo/lib/GLR.cpp index 1765eb18732c..3e49a7a9c269 100644 --- a/clang-tools-extra/pseudo/lib/GLR.cpp +++ b/clang-tools-extra/pseudo/lib/GLR.cpp @@ -403,6 +403,10 @@ public: GLRReduce(const ParseParams &Params, const Language &Lang) : Params(Params), Lang(Lang) {} + // Reduce Heads, resulting in new nodes that are appended to Heads. + // The "consumed" nodes are not removed! + // Only reduce rules compatible with the Lookahead are applied, though + // tokenSymbol(tok::unknown) will match any rule. void operator()(std::vector<const GSS::Node *> &Heads, SymbolID Lookahead) { assert(isToken(Lookahead)); |