mirror of
https://gitee.com/openharmony/third_party_rust_unicode-ident
synced 2024-11-26 17:21:06 +00:00
Add test code to create roaring bitmap
This commit is contained in:
parent
21024e2c71
commit
3a2eb6c64b
@ -7,6 +7,7 @@ publish = false
|
||||
|
||||
[dev-dependencies]
|
||||
fst = "0.4"
|
||||
roaring = "0.9"
|
||||
ucd-trie = { version = "0.1", default-features = false }
|
||||
|
||||
[workspace]
|
||||
|
21
tests/roaring/mod.rs
Normal file
21
tests/roaring/mod.rs
Normal file
@ -0,0 +1,21 @@
|
||||
use roaring::RoaringBitmap;
|
||||
|
||||
pub fn xid_start_bitmap() -> RoaringBitmap {
|
||||
let mut bitmap = RoaringBitmap::new();
|
||||
for ch in '\0'..=char::MAX {
|
||||
if unicode_ident::is_xid_start(ch) {
|
||||
bitmap.insert(ch as u32);
|
||||
}
|
||||
}
|
||||
bitmap
|
||||
}
|
||||
|
||||
pub fn xid_continue_bitmap() -> RoaringBitmap {
|
||||
let mut bitmap = RoaringBitmap::new();
|
||||
for ch in '\0'..=char::MAX {
|
||||
if unicode_ident::is_xid_continue(ch) {
|
||||
bitmap.insert(ch as u32);
|
||||
}
|
||||
}
|
||||
bitmap
|
||||
}
|
Loading…
Reference in New Issue
Block a user