Skip to content

Commit 4db83ac

Browse files
committed
Add initial unicodedata module.
1 parent c96680a commit 4db83ac

File tree

5 files changed

+375
-0
lines changed

5 files changed

+375
-0
lines changed

Cargo.lock

Lines changed: 269 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/snippets/unicode_fu.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,11 @@
1111
c = *3
1212

1313
assert c == '👋👋👋'
14+
15+
import unicodedata
16+
assert unicodedata.category('a') == 'Ll'
17+
assert unicodedata.category('A') == 'Lu'
18+
assert unicodedata.name('a') == 'LATIN SMALL LETTER A'
19+
assert unicodedata.lookup('LATIN SMALL LETTER A') == 'a'
20+
assert unicodedata.bidirectional('a') == 'L'
21+
assert unicodedata.normalize('NFC', 'bla') == 'bla'

vm/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ indexmap = "1.0.2"
3232
crc = "^1.0.0"
3333
bincode = "1.1.4"
3434
unicode_categories = "0.1.1"
35+
unicode_names2 = "0.2.2"
36+
unic = "0.9.0"
3537
maplit = "1.0"
3638
proc-macro-hack = "0.5"
3739
bitflags = "1.1"

vm/src/stdlib/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ mod string;
1616
mod thread;
1717
mod time_module;
1818
mod tokenize;
19+
mod unicodedata;
1920
mod warnings;
2021
mod weakref;
2122
use std::collections::HashMap;
@@ -54,6 +55,7 @@ pub fn get_module_inits() -> HashMap<String, StdlibInitFunc> {
5455
"tokenize".to_string() => Box::new(tokenize::make_module),
5556
"_weakref".to_string() => Box::new(weakref::make_module),
5657
"_imp".to_string() => Box::new(imp::make_module),
58+
"unicodedata".to_string() => Box::new(unicodedata::make_module),
5759
"_warnings".to_string() => Box::new(warnings::make_module),
5860
};
5961

0 commit comments

Comments
 (0)