Skip to content

Commit aa0290b

Browse files
committed
Match on ascii start/continuation characters before calling functions.
1 parent f74e44d commit aa0290b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎parser/src/lexer.rs‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,12 +534,15 @@ where
534534
}
535535

536536
fn is_identifier_start(&self, c: char) -> bool {
537-
c == '_' || is_xid_start(c)
537+
match c {
538+
'a'..='z' | 'A'..='Z' | '_' => true,
539+
_ => is_xid_start(c),
540+
}
538541
}
539542

540543
fn is_identifier_continuation(&self) -> bool {
541544
match self.window[0] {
542-
Some('_' | '0'..='9') => true,
545+
Some('a'..='z' | 'A'..='Z' | '_' | '0'..='9') => true,
543546
Some(c) => is_xid_continue(c),
544547
_ => false,
545548
}

0 commit comments

Comments
 (0)