WGSL front end: Only accept ASCII chars in identifiers

Previously the lexer would accept any alphanumeric character as part of an
identifier. The spec only allowes identifiers to consist of ASCII alphanumeric
characters though.
This commit is contained in:
LaughingMan
2020-07-05 08:23:56 +02:00
committed by Dzmitry Malyshau
parent cf62dc3d8c
commit 1acd12334a

View File

@@ -89,7 +89,7 @@ mod lex {
(Token::Number(number), rest)
}
'a'..='z' | 'A'..='Z' | '_' => {
let (word, rest) = consume_any(input, |c| c.is_alphanumeric() || c == '_');
let (word, rest) = consume_any(input, |c| c.is_ascii_alphanumeric() || c == '_');
(Token::Word(word), rest)
}
'"' => {