[pseudo] Key guards by RuleID, add guards to literals (and 0).
authorSam McCall <sam.mccall@gmail.com>
Tue, 19 Jul 2022 08:54:52 +0000 (10:54 +0200)
committerSam McCall <sam.mccall@gmail.com>
Thu, 21 Jul 2022 20:42:31 +0000 (22:42 +0200)
commit3132e9cd7c9fda63f7c0babf8bd5f6d755ce9027
tree2d1d8af77c74834f2f0b6959f19a940ee17515e5
parentb17baa1db613a2ce777aa122feb87488750a64d0
[pseudo] Key guards by RuleID, add guards to literals (and 0).

After this, NUMERIC_CONSTANT and strings should parse only one way.

There are 8 types of literals, and 24 valid (literal, TokenKind) pairs.
This means adding 8 new named guards (or 24, if we want to assert the token).

It seems fairly clear to me at this point that the guard names are unneccesary
indirection: the guards are in fact coupled to the rule signature.

(Also add the zero guard I forgot in the previous patch.)

Differential Revision: https://reviews.llvm.org/D130066
12 files changed:
clang-tools-extra/pseudo/include/clang-pseudo/Language.h
clang-tools-extra/pseudo/include/clang-pseudo/grammar/Grammar.h
clang-tools-extra/pseudo/lib/GLR.cpp
clang-tools-extra/pseudo/lib/cxx/CXX.cpp
clang-tools-extra/pseudo/lib/cxx/cxx.bnf
clang-tools-extra/pseudo/lib/grammar/Grammar.cpp
clang-tools-extra/pseudo/lib/grammar/GrammarBNF.cpp
clang-tools-extra/pseudo/test/cxx/literals.cpp [new file with mode: 0644]
clang-tools-extra/pseudo/test/cxx/mixed-designator.cpp
clang-tools-extra/pseudo/tool/ClangPseudo.cpp
clang-tools-extra/pseudo/unittests/GLRTest.cpp
clang-tools-extra/pseudo/unittests/GrammarTest.cpp