2017-12-29 21:48:47 +00:00
|
|
|
use unicode_xid::UnicodeXID;
|
|
|
|
|
|
|
|
pub fn is_ident_start(c: char) -> bool {
|
2018-01-27 23:31:23 +00:00
|
|
|
(c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_'
|
2017-12-29 21:48:47 +00:00
|
|
|
|| (c > '\x7f' && UnicodeXID::is_xid_start(c))
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn is_ident_continue(c: char) -> bool {
|
2018-01-27 23:31:23 +00:00
|
|
|
(c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_'
|
2017-12-29 21:48:47 +00:00
|
|
|
|| (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()
|
|
|
|
}
|
2017-12-30 12:22:40 +00:00
|
|
|
|
|
|
|
pub fn is_dec_digit(c: char) -> bool {
|
|
|
|
'0' <= c && c <= '9'
|
|
|
|
}
|