tint/lexer: Add 'diagnostic' keyword
Bug: tint:1809
Change-Id: I55ce14b8775a64c4f7ccbbd7e84094e9e4ee19a6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117560
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
diff --git a/src/tint/reader/wgsl/lexer.cc b/src/tint/reader/wgsl/lexer.cc
index 9ebe5d8..89804f2 100644
--- a/src/tint/reader/wgsl/lexer.cc
+++ b/src/tint/reader/wgsl/lexer.cc
@@ -1141,6 +1141,9 @@
if (str == "continuing") {
return {Token::Type::kContinuing, source, "continuing"};
}
+ if (str == "diagnostic") {
+ return {Token::Type::kDiagnostic, source, "diagnostic"};
+ }
if (str == "discard") {
return {Token::Type::kDiscard, source, "discard"};
}
diff --git a/src/tint/reader/wgsl/lexer_test.cc b/src/tint/reader/wgsl/lexer_test.cc
index a7c13e6..ffa85bd 100644
--- a/src/tint/reader/wgsl/lexer_test.cc
+++ b/src/tint/reader/wgsl/lexer_test.cc
@@ -1061,8 +1061,10 @@
TokenData{"continue", Token::Type::kContinue},
TokenData{"continuing", Token::Type::kContinuing},
TokenData{"default", Token::Type::kDefault},
+ TokenData{"diagnostic", Token::Type::kDiagnostic},
TokenData{"discard", Token::Type::kDiscard},
TokenData{"else", Token::Type::kElse},
+ TokenData{"enable", Token::Type::kEnable},
TokenData{"f32", Token::Type::kF32},
TokenData{"fallthrough", Token::Type::kFallthrough},
TokenData{"false", Token::Type::kFalse},
diff --git a/src/tint/reader/wgsl/token.cc b/src/tint/reader/wgsl/token.cc
index ac5eb08..8e3fbdb 100644
--- a/src/tint/reader/wgsl/token.cc
+++ b/src/tint/reader/wgsl/token.cc
@@ -153,6 +153,8 @@
return "continue";
case Token::Type::kContinuing:
return "continuing";
+ case Token::Type::kDiagnostic:
+ return "diagnostic";
case Token::Type::kDiscard:
return "discard";
case Token::Type::kDefault:
diff --git a/src/tint/reader/wgsl/token.h b/src/tint/reader/wgsl/token.h
index 3f92f48..2aeffa9 100644
--- a/src/tint/reader/wgsl/token.h
+++ b/src/tint/reader/wgsl/token.h
@@ -163,6 +163,8 @@
kContinue,
/// A 'continuing'
kContinuing,
+ /// A 'diagnostic'
+ kDiagnostic,
/// A 'discard'
kDiscard,
/// A 'default'