diff --git a/clang-tools-extra/pseudo/lib/cxx/CXX.cpp b/clang-tools-extra/pseudo/lib/cxx/CXX.cpp --- a/clang-tools-extra/pseudo/lib/cxx/CXX.cpp +++ b/clang-tools-extra/pseudo/lib/cxx/CXX.cpp @@ -162,6 +162,10 @@ return symbolToToken(P.Lookahead) != tok::kw_else; } +bool guardNextTokenNotColCol(const GuardParams &P) { + return symbolToToken(P.Lookahead) != tok::coloncolon; +} + // Whether this e.g. decl-specifier contains an "exclusive" type such as a class // name, and thus can't combine with a second exclusive type. // @@ -308,6 +312,16 @@ selection_statement_0if_1constexpr_2l_paren_3condition_4r_paren_5statement, guardNextTokenNotElse}, + {(RuleID)Rule::simple_type_specifier_0nested_name_specifier_1type_name, + guardNextTokenNotColCol}, + {(RuleID)Rule::simple_type_specifier_0nested_name_specifier_1template_name, + guardNextTokenNotColCol}, + {(RuleID)Rule::simple_type_specifier_0type_name, + guardNextTokenNotColCol}, + {(RuleID)Rule::simple_type_specifier_0template_name, + guardNextTokenNotColCol + }, + // The grammar distinguishes (only) user-defined vs plain string literals, // where the clang lexer distinguishes (only) encoding types. {(RuleID)Rule::user_defined_string_literal_chunk_0string_literal, diff --git a/clang-tools-extra/pseudo/lib/cxx/cxx.bnf b/clang-tools-extra/pseudo/lib/cxx/cxx.bnf --- a/clang-tools-extra/pseudo/lib/cxx/cxx.bnf +++ b/clang-tools-extra/pseudo/lib/cxx/cxx.bnf @@ -370,11 +370,11 @@ defining-type-specifier := enum-specifier defining-type-specifier-seq := defining-type-specifier defining-type-specifier-seq := defining-type-specifier defining-type-specifier-seq [guard] -simple-type-specifier := nested-name-specifier_opt type-name +simple-type-specifier := nested-name-specifier_opt type-name [guard] simple-type-specifier := nested-name-specifier TEMPLATE simple-template-id simple-type-specifier := decltype-specifier simple-type-specifier := placeholder-type-specifier -simple-type-specifier := nested-name-specifier_opt template-name +simple-type-specifier := nested-name-specifier_opt template-name [guard] simple-type-specifier := builtin-type builtin-type := CHAR builtin-type := CHAR8_T