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

View File

@ -165,17 +165,19 @@ class Token {
kContinue, kContinue,
/// A 'continuing' /// A 'continuing'
kContinuing, kContinuing,
/// A 'default'
kDefault,
/// A 'diagnostic' /// A 'diagnostic'
kDiagnostic, kDiagnostic,
/// A 'discard' /// A 'discard'
kDiscard, kDiscard,
/// A 'default'
kDefault,
/// A 'else' /// A 'else'
kElse, kElse,
/// A 'enable' /// A 'enable'
kEnable, kEnable,
/// A 'fallthrough' /// 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, kFallthrough,
/// A 'false' /// A 'false'
kFalse, kFalse,
@ -191,10 +193,10 @@ class Token {
kLoop, kLoop,
/// A 'override' /// A 'override'
kOverride, kOverride,
/// A 'return'
kReturn,
/// A 'requires' /// A 'requires'
kRequires, kRequires,
/// A 'return'
kReturn,
/// A 'struct' /// A 'struct'
kStruct, kStruct,
/// A 'switch' /// A 'switch'