mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-10 04:08:47 +00:00
23 lines
586 B
Rust
23 lines
586 B
Rust
|
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()
|
||
|
}
|