-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GC predicate functions #1310
Conversation
components/properties/src/maps.rs
Outdated
pub fn is_cased_letter(gc_map: &CodePointTrie<GeneralSubcategory>, code_point: u32) -> bool { | ||
let gc_val = gc_map.get(code_point); | ||
0 != (gc_val as u32) & GeneralCategory::CasedLetter.0 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two other ways:
impl GeneralSubcategory {
pub fn is_contained(gc: GeneralCategory) -> bool {
// do the test
}
}
impl GeneralCategory {
pub fn contains(gsc: GeneralSubcategory) -> bool {
// opposite of above
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done before a previous review. Took the second approach.
components/properties/src/maps.rs
Outdated
/// ``` | ||
pub fn is_letter(gc_map: &CodePointTrie<GeneralSubcategory>, code_point: u32) -> bool { | ||
let gc_val = gc_map.get(code_point); | ||
0 != (gc_val as u32) & GeneralCategory::Letter.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0 != (gc_val as u32) & GeneralCategory::Letter.0 | |
0 != (1 << (gc_val as u32)) & GeneralCategory::Letter.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done before a previous review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a suggestion for better documentation
Co-authored-by: Shane F. Carr <shane@unicode.org>
Fixes #1158