use unicode_properties::GeneralCategory;
use unicode_properties::GeneralCategoryGroup;
use unicode_properties::UnicodeGeneralCategory;
#[inline]
pub fn is_token_end(c: Option<char>) -> bool {
match c {
Some(c) => {
return is_space_char(c);
},
None => {
return true;
}
}
}
pub fn is_keyword_safe_first_char(c: char) -> bool {
match c.general_category_group() {
GeneralCategoryGroup::Letter | GeneralCategoryGroup::Number => {
return true;
},
_ => {},
}
return false;
}
pub fn is_keyword_safe_char(c: char) -> bool {
match c {
'_'|'-'|'.' => {
return true;
},
_ => {}
}
return is_keyword_safe_first_char(c);
}
#[inline]
pub fn is_space_char(c: char) -> bool {
match c.general_category() {
GeneralCategory::SpaceSeparator => true,
GeneralCategory::LineSeparator => true,
GeneralCategory::ParagraphSeparator => true,
GeneralCategory::Control => true,
GeneralCategory::Format => true,
_ => false
}
}
#[inline]
pub fn is_non_space_char(c: char) -> bool {
return !is_space_char(c);
}