summaryrefslogtreecommitdiff
path: root/clang-tools-extra/pseudo
diff options
context:
space:
mode:
authorSam McCall <sam.mccall@gmail.com>2022-08-19 15:15:37 +0200
committerSam McCall <sam.mccall@gmail.com>2022-08-19 15:15:37 +0200
commit605035bf4508460f8c28857c7aaecf1d8c449ca8 (patch)
tree2d068bfb94efb2d832d95d185e20b8115c53446c /clang-tools-extra/pseudo
parent2cc7463c85c056e956ad332448189ce3e9004182 (diff)
downloadllvm-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.h2
-rw-r--r--clang-tools-extra/pseudo/lib/GLR.cpp4
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));