Skip to content

Commit 51ba929

Browse files
committed
Match on ascii start/continuation characters before calling functions.
1 parent b6e4471 commit 51ba929

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

compiler/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)