Fast path for ASCII only identifiers start (#6609)
This commit is contained in:
@@ -85,7 +85,11 @@ pub fn lines_after_ignoring_trivia(offset: TextSize, code: &str) -> u32 {
|
||||
}
|
||||
|
||||
fn is_identifier_start(c: char) -> bool {
|
||||
c.is_ascii_alphabetic() || c == '_' || is_non_ascii_identifier_start(c)
|
||||
if c.is_ascii() {
|
||||
c.is_ascii_alphabetic() || c == '_'
|
||||
} else {
|
||||
is_xid_start(c)
|
||||
}
|
||||
}
|
||||
|
||||
// Checks if the character c is a valid continuation character as described
|
||||
@@ -98,10 +102,6 @@ fn is_identifier_continuation(c: char) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
fn is_non_ascii_identifier_start(c: char) -> bool {
|
||||
is_xid_start(c)
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
|
||||
pub struct SimpleToken {
|
||||
pub kind: SimpleTokenKind,
|
||||
|
||||
Reference in New Issue
Block a user