mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-09 22:25:23 +00:00
Match on ascii start/continuation characters before calling functions.
This commit is contained in:
parent
f74e44d1e8
commit
aa0290bbfc
1 changed files with 5 additions and 2 deletions
|
@ -534,12 +534,15 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_identifier_start(&self, c: char) -> bool {
|
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 {
|
fn is_identifier_continuation(&self) -> bool {
|
||||||
match self.window[0] {
|
match self.window[0] {
|
||||||
Some('_' | '0'..='9') => true,
|
Some('a'..='z' | 'A'..='Z' | '_' | '0'..='9') => true,
|
||||||
Some(c) => is_xid_continue(c),
|
Some(c) => is_xid_continue(c),
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue