diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-05-19 00:50:09 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-05-19 00:50:09 +0200 |
commit | d6b1db5c14ca1e731db299748d2df9eb955c9f7c (patch) | |
tree | f35522863ce32244454dd1ba77fd3c7003395cdb /gen | |
parent | 40e7a4384bcead4db0559b30a46d4bfb0fbf3049 (diff) |
Add uprop_is_ce() and uprop_is_comp_ex()
Diffstat (limited to 'gen')
-rwxr-xr-x | gen/data-files | 1 | ||||
-rwxr-xr-x | gen/prop/bool-props | 17 | ||||
-rwxr-xr-x | gen/prop/bool-props.py | 20 |
3 files changed, 29 insertions, 9 deletions
diff --git a/gen/data-files b/gen/data-files index ac984b9..c648868 100755 --- a/gen/data-files +++ b/gen/data-files @@ -14,6 +14,7 @@ readonly PATHS=' BidiMirroring Blocks CaseFolding + CompositionExclusions DerivedAge DerivedCoreProperties DerivedNormalizationProps diff --git a/gen/prop/bool-props b/gen/prop/bool-props index a79f858..010dbf8 100755 --- a/gen/prop/bool-props +++ b/gen/prop/bool-props @@ -62,12 +62,17 @@ extpict=Extended_Pictographic props4=' cwkcf=Changes_When_NFKC_Casefolded +comp_ex=Full_Composition_Exclusion ' props5=' bidi_m=Bidi_Mirrored ' +props6=' +ce=Composition_Exclusion +' + manual=' idst=IDS_Trinary_Operator idsu=IDS_Unary_Operator @@ -87,16 +92,18 @@ gen() IFS=' ' parallel-moreutils -- $( - for prop in $props1; do gen $prop PropList & done - for prop in $props2; do gen $prop DerivedCoreProperties & done - for prop in $props3; do gen $prop emoji-data & done + for prop in $props1; do gen $prop PropList & done + for prop in $props2; do gen $prop DerivedCoreProperties & done + for prop in $props3; do gen $prop emoji-data & done for prop in $props4; do gen $prop DerivedNormalizationProps & done - for prop in $props5; do gen $prop DerivedBinaryProperties & done + for prop in $props5; do gen $prop DerivedBinaryProperties & done + for prop in $props6; do gen $prop CompositionExclusions & done ) ) printf '[[_mlib_pure]] bool uprop_is_%s(rune);\n' \ - $(printf '%s\n' $props1 $props2 $props3 $props4 $props5 | cut -d= -f1) \ + $(printf '%s\n' $props1 $props2 $props3 $props4 $props5 $props6 \ + | cut -d= -f1) \ | gawk ' /PROP PREDICATES END/ { no = 0 } FILENAME != "-" && !no { print } diff --git a/gen/prop/bool-props.py b/gen/prop/bool-props.py index 62cfe74..5ac0287 100755 --- a/gen/prop/bool-props.py +++ b/gen/prop/bool-props.py @@ -8,17 +8,29 @@ from lib import * def parse(file: str) -> list[bool]: xs = [False] * 0x110000 - if sys.argv[1] == 'Indic_Conjunct_Break': - sys.argv[1] = 'InCB;' + + sys.argv[1] = ({ + 'Composition_Exclusion': '', + 'Indic_Conjunct_Break': 'InCB;', + }).get(sys.argv[1], sys.argv[1]) + with open(file, 'r') as f: for line in f.readlines(): if ( - len(line) == 0 + len(line.strip()) == 0 or line[0] == '#' or sys.argv[1] not in line ): continue - parts = [int(x, 16) for x in line.split(';')[0].strip().split('..')] + parts = [ + int(x, 16) for x in ( + line + .split('#')[0] + .split(';')[0] + .strip() + .split('..') + ) + ] for i in range(parts[0], parts[len(parts) - 1] + 1): xs[i] = True return xs |