From d6b1db5c14ca1e731db299748d2df9eb955c9f7c Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sun, 19 May 2024 00:50:09 +0200 Subject: Add uprop_is_ce() and uprop_is_comp_ex() --- gen/prop/bool-props | 17 ++++++++++++----- gen/prop/bool-props.py | 20 ++++++++++++++++---- 2 files changed, 28 insertions(+), 9 deletions(-) (limited to 'gen/prop') 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 -- cgit v1.2.3