mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
organizize
This commit is contained in:
parent
26262aaf05
commit
7c67612b8a
376 changed files with 27 additions and 145 deletions
26
crates/libsyntax2/src/lexer/classes.rs
Normal file
26
crates/libsyntax2/src/lexer/classes.rs
Normal file
|
@ -0,0 +1,26 @@
|
|||
use unicode_xid::UnicodeXID;
|
||||
|
||||
pub fn is_ident_start(c: char) -> bool {
|
||||
(c >= 'a' && c <= 'z')
|
||||
|| (c >= 'A' && c <= 'Z')
|
||||
|| c == '_'
|
||||
|| (c > '\x7f' && UnicodeXID::is_xid_start(c))
|
||||
}
|
||||
|
||||
pub fn is_ident_continue(c: char) -> bool {
|
||||
(c >= 'a' && c <= 'z')
|
||||
|| (c >= 'A' && c <= 'Z')
|
||||
|| (c >= '0' && c <= '9')
|
||||
|| c == '_'
|
||||
|| (c > '\x7f' && UnicodeXID::is_xid_continue(c))
|
||||
}
|
||||
|
||||
pub fn is_whitespace(c: char) -> bool {
|
||||
//FIXME: use is_pattern_whitespace
|
||||
//https://github.com/behnam/rust-unic/issues/192
|
||||
c.is_whitespace()
|
||||
}
|
||||
|
||||
pub fn is_dec_digit(c: char) -> bool {
|
||||
'0' <= c && c <= '9'
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue