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>
This commit is contained in:
James Price 2023-01-22 11:00:53 +00:00 committed by Dawn LUCI CQ
parent 57c0bbc2a5
commit ffe356d558
4 changed files with 9 additions and 0 deletions

View File

@ -1141,6 +1141,9 @@ Token Lexer::check_keyword(const Source& source, std::string_view str) {
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"};
}

View File

@ -1061,8 +1061,10 @@ INSTANTIATE_TEST_SUITE_P(
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},

View File

@ -153,6 +153,8 @@ std::string_view Token::TypeToName(Type type) {
return "continue";
case Token::Type::kContinuing:
return "continuing";
case Token::Type::kDiagnostic:
return "diagnostic";
case Token::Type::kDiscard:
return "discard";
case Token::Type::kDefault:

View File

@ -163,6 +163,8 @@ class Token {
kContinue,
/// A 'continuing'
kContinuing,
/// A 'diagnostic'
kDiagnostic,
/// A 'discard'
kDiscard,
/// A 'default'