|
17 | 17 | # - confusables.txt
|
18 | 18 | # - ReadMe.txt
|
19 | 19 | # This script also uses the following Unicode UCD data:
|
| 20 | +# - DerivedCoreProperties.txt |
20 | 21 | # - Scripts.txt
|
21 | 22 | #
|
22 | 23 | # Since this should not require frequent updates, we just store this
|
@@ -526,6 +527,26 @@ def emit_identifier_module(f):
|
526 | 527 | pfun=lambda x: "(%s,%s, IdentifierType::%s)" % (escape_char(x[0]), escape_char(x[1]), x[2]))
|
527 | 528 | f.write("}\n\n")
|
528 | 529 |
|
| 530 | +def emit_default_ignorable_detection_module(f): |
| 531 | + f.write("pub mod default_ignorable_code_point {") |
| 532 | + f.write(""" |
| 533 | +
|
| 534 | + #[inline] |
| 535 | + pub fn default_ignorable_code_point(c: char) -> bool { |
| 536 | + match c as usize { |
| 537 | + _ => super::util::bsearch_range_table(c, DEFAULT_IGNORABLE) |
| 538 | + } |
| 539 | + } |
| 540 | +
|
| 541 | +""") |
| 542 | + |
| 543 | + f.write(" // Default ignorable code point table:\n") |
| 544 | + default_ignorable_table = load_properties(fetch_unidata("DerivedCoreProperties.txt"), ["Default_Ignorable_Code_Point"]) |
| 545 | + emit_table(f, "DEFAULT_IGNORABLE", default_ignorable_table["Default_Ignorable_Code_Point"], "&'static [(char, char)]", is_pub=False, |
| 546 | + pfun=lambda x: "(%s,%s)" % (escape_char(x[0]), escape_char(x[1]))) |
| 547 | + |
| 548 | + f.write("}\n\n") |
| 549 | + |
529 | 550 | def emit_confusable_detection_module(f):
|
530 | 551 | f.write("pub mod confusable_detection {")
|
531 | 552 | f.write("""
|
@@ -654,6 +675,8 @@ def emit_util_mod(f):
|
654 | 675 | emit_util_mod(rf)
|
655 | 676 | ### identifier module
|
656 | 677 | emit_identifier_module(rf)
|
| 678 | + ### default_ignorable_detection module |
| 679 | + emit_default_ignorable_detection_module(rf) |
657 | 680 | ### confusable_detection module
|
658 | 681 | emit_confusable_detection_module(rf)
|
659 | 682 | ### mixed_script_confusable_detection module
|
|
0 commit comments