Sync keyword/reserved word list.

This CL updates the keyword/reserved word list in Tint to match latest
spec. The two differences are:

* `bitcast` is left as a keyword until we make the grammar update
* `fallthrough` is left a keyword for error purposes.

Bug: tint:1823
Change-Id: I5a33c78d21f56e0d0e2efa0114af810f2ebb8c87
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/122960
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
dan sinclair 2023-03-13 22:23:38 +00:00 committed by Dawn LUCI CQ
parent 868efb9739
commit 6784a52766
3 changed files with 22 additions and 29 deletions

View File

@ -73,21 +73,19 @@ constexpr size_t const kMaxResynchronizeLookahead = 32;
// https://gpuweb.github.io/gpuweb/wgsl.html#reserved-keywords
bool is_reserved(const Token& t) {
return t == "CompileShader" || t == "ComputeShader" || t == "DomainShader" ||
t == "GeometryShader" || t == "Hullshader" || t == "NULL" || t == "Self" ||
t == "abstract" || t == "active" || t == "alignas" || t == "alignof" || t == "as" ||
t == "asm" || t == "asm_fragment" || t == "async" || t == "attribute" || t == "auto" ||
t == "await" || t == "become" || t == "binding_array" || t == "cast" || t == "catch" ||
t == "class" || t == "co_await" || t == "co_return" || t == "co_yield" ||
t == "coherent" || t == "column_major" || t == "common" || t == "compile" ||
t == "compile_fragment" || t == "concept" || t == "const_cast" || t == "consteval" ||
t == "constexpr" || t == "constinit" || t == "crate" || t == "debugger" ||
t == "decltype" || t == "delete" || t == "demote" || t == "demote_to_helper" ||
t == "do" || t == "dynamic_cast" || t == "enum" || t == "explicit" || t == "export" ||
t == "extends" || t == "extern" || t == "external" || t == "filter" || t == "final" ||
t == "finally" || t == "friend" || t == "from" || t == "fxgroup" || t == "get" ||
t == "goto" || t == "groupshared" || t == "handle" || t == "highp" || t == "impl" ||
t == "implements" || t == "import" || t == "inline" || t == "inout" ||
return t == "NULL" || t == "Self" || t == "abstract" || t == "active" || t == "alignas" ||
t == "alignof" || t == "as" || t == "asm" || t == "asm_fragment" || t == "async" ||
t == "attribute" || t == "auto" || t == "await" || t == "become" ||
t == "binding_array" || t == "cast" || t == "catch" || t == "class" || t == "co_await" ||
t == "co_return" || t == "co_yield" || t == "coherent" || t == "column_major" ||
t == "common" || t == "compile" || t == "compile_fragment" || t == "concept" ||
t == "const_cast" || t == "consteval" || t == "constexpr" || t == "constinit" ||
t == "crate" || t == "debugger" || t == "decltype" || t == "delete" || t == "demote" ||
t == "demote_to_helper" || t == "do" || t == "dynamic_cast" || t == "enum" ||
t == "explicit" || t == "export" || t == "extends" || t == "extern" || t == "external" ||
t == "filter" || t == "final" || t == "finally" || t == "friend" || t == "from" ||
t == "fxgroup" || t == "get" || t == "goto" || t == "groupshared" || t == "highp" ||
t == "impl" || t == "implements" || t == "import" || t == "inline" ||
t == "instanceof" || t == "interface" || t == "layout" || t == "lowp" || t == "macro" ||
t == "macro_rules" || t == "match" || t == "mediump" || t == "meta" || t == "mod" ||
t == "module" || t == "move" || t == "mut" || t == "mutable" || t == "namespace" ||
@ -97,8 +95,8 @@ bool is_reserved(const Token& t) {
t == "partition" || t == "pass" || t == "patch" || t == "pixelfragment" ||
t == "precise" || t == "precision" || t == "premerge" || t == "priv" ||
t == "protected" || t == "pub" || t == "public" || t == "readonly" || t == "ref" ||
t == "regardless" || t == "register" || t == "reinterpret_cast" || t == "resource" ||
t == "restrict" || t == "self" || t == "set" || t == "shared" || t == "signed" ||
t == "regardless" || t == "register" || t == "reinterpret_cast" || t == "require" ||
t == "resource" || t == "restrict" || t == "self" || t == "set" || t == "shared" ||
t == "sizeof" || t == "smooth" || t == "snorm" || t == "static" ||
t == "static_assert" || t == "static_cast" || t == "std" || t == "subroutine" ||
t == "super" || t == "target" || t == "template" || t == "this" || t == "thread_local" ||

View File

@ -85,11 +85,7 @@ TEST_P(ParserImplReservedKeywordTest, Alias) {
}
INSTANTIATE_TEST_SUITE_P(ParserImplReservedKeywordTest,
ParserImplReservedKeywordTest,
testing::Values("ComputeShader",
"DomainShader",
"GeometryShader",
"Hullshader",
"NULL",
testing::Values("NULL",
"Self",
"abstract",
"active",
@ -143,13 +139,11 @@ INSTANTIATE_TEST_SUITE_P(ParserImplReservedKeywordTest,
"get",
"goto",
"groupshared",
"handle",
"highp",
"impl",
"implements",
"import",
"inline",
"inout",
"instanceof",
"interface",
"layout",
@ -198,7 +192,6 @@ INSTANTIATE_TEST_SUITE_P(ParserImplReservedKeywordTest,
"self",
"set",
"shared",
"signed",
"sizeof",
"smooth",
"snorm",

View File

@ -165,17 +165,19 @@ class Token {
kContinue,
/// A 'continuing'
kContinuing,
/// A 'default'
kDefault,
/// A 'diagnostic'
kDiagnostic,
/// A 'discard'
kDiscard,
/// A 'default'
kDefault,
/// A 'else'
kElse,
/// A 'enable'
kEnable,
/// A 'fallthrough'
// Note, this isn't a keyword, but a reserved word. We match it as a keyword in order to
// provide better diagnostics in case a `fallthrough` is added to a case body.
kFallthrough,
/// A 'false'
kFalse,
@ -191,10 +193,10 @@ class Token {
kLoop,
/// A 'override'
kOverride,
/// A 'return'
kReturn,
/// A 'requires'
kRequires,
/// A 'return'
kReturn,
/// A 'struct'
kStruct,
/// A 'switch'