reader/wgsl: Lex underscore tokens
Bug: tint:1213 Change-Id: Ic5f2bfb2da0bf0f9511f029a93c7007266b2984c Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67063 Commit-Queue: Ben Clayton <bclayton@google.com> Kokoro: Ben Clayton <bclayton@google.com> Reviewed-by: David Neto <dneto@google.com> Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
parent
0da0c95dc3
commit
e81d7dc3c8
|
@ -840,6 +840,10 @@ Token Lexer::try_punctuation() {
|
|||
type = Token::Type::kTilde;
|
||||
pos_ += 1;
|
||||
location_.column += 1;
|
||||
} else if (matches(pos_, "_")) {
|
||||
type = Token::Type::kUnderscore;
|
||||
pos_ += 1;
|
||||
location_.column += 1;
|
||||
} else if (matches(pos_, "^")) {
|
||||
type = Token::Type::kXor;
|
||||
pos_ += 1;
|
||||
|
|
|
@ -493,6 +493,7 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
TokenData{";", Token::Type::kSemicolon},
|
||||
TokenData{"*", Token::Type::kStar},
|
||||
TokenData{"~", Token::Type::kTilde},
|
||||
TokenData{"_", Token::Type::kUnderscore},
|
||||
TokenData{"^", Token::Type::kXor}));
|
||||
|
||||
using KeywordTest = testing::TestWithParam<TokenData>;
|
||||
|
|
|
@ -106,6 +106,8 @@ std::string Token::TypeToName(Type type) {
|
|||
return "*";
|
||||
case Token::Type::kTilde:
|
||||
return "~";
|
||||
case Token::Type::kUnderscore:
|
||||
return "_";
|
||||
case Token::Type::kXor:
|
||||
return "^";
|
||||
|
||||
|
|
|
@ -114,6 +114,8 @@ class Token {
|
|||
kStar,
|
||||
/// A '~'
|
||||
kTilde,
|
||||
/// A '_'
|
||||
kUnderscore,
|
||||
/// A '^'
|
||||
kXor,
|
||||
|
||||
|
|
Loading…
Reference in New Issue