Match on ascii start/continuation characters before calling functions.

This commit is contained in:
Dimitris Fasarakis Hilliard 2023-01-29 19:53:00 +02:00
parent f74e44d1e8
commit aa0290bbfc

View file

@ -534,12 +534,15 @@ where
}
fn is_identifier_start(&self, c: char) -> bool {
c == '_' || is_xid_start(c)
match c {
'a'..='z' | 'A'..='Z' | '_' => true,
_ => is_xid_start(c),
}
}
fn is_identifier_continuation(&self) -> bool {
match self.window[0] {
Some('_' | '0'..='9') => true,
Some('a'..='z' | 'A'..='Z' | '_' | '0'..='9') => true,
Some(c) => is_xid_continue(c),
_ => false,
}