authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-12-24 16:47:45 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-12-24 16:47:45 -08:00
log10b157fd88ac9baecd0ab2f0c5bdd36081684edc
tree93013c42cf53514975ce69c0b876825e3f9edff2
parentefca9d55662b8bcee7e804672a87fb768b9a922c

add PropertyAliases, closes #30


5 files changed, 182 insertions(+), 1 deletions(-)

generate.zig+1
......@@ -21,6 +21,7 @@ const files = [_]type{
2121 @import("./scripts/NameAliases.zig"),
2222 @import("./scripts/NamedSequences.zig"),
2323 @import("./scripts/NamedSequencesProv.zig"),
24 @import("./scripts/PropertyAliases.zig"),
2425 @import("./scripts/PropList.zig"),
2526 @import("./scripts/ScriptExtensions.zig"),
2627 @import("./scripts/Scripts.zig"),
scripts/PropertyAliases.zig created+35
......@@ -0,0 +1,35 @@
1const std = @import("std");
2const common = @import("./_common.zig");
3
4pub usingnamespace common.Main(struct {
5 pub const source_file = "PropertyAliases";
6
7 pub const dest_file = "src/property_aliases.zig";
8
9 pub const dest_header =
10 \\const std = @import("std");
11 \\
12 \\pub const data = blk: {
13 \\ @setEvalBranchQuota(4000);
14 \\ const map = std.ComptimeStringMap([]const u8, .{
15 \\
16 ;
17
18 pub const dest_footer =
19 \\ });
20 \\ break :blk map;
21 \\};
22 ;
23
24 pub fn exec(alloc: std.mem.Allocator, line: []const u8, writer: anytype) !bool {
25 _ = alloc;
26 var it = std.mem.tokenize(u8, line, "; ");
27
28 try writer.print(" .{{ \"{}\", \"{}\" }},\n", .{
29 std.zig.fmtEscapes(it.next().?),
30 std.zig.fmtEscapes(it.next().?),
31 });
32
33 return true;
34 }
35});
src/lib.zig+1-1
......@@ -21,7 +21,7 @@ pub const name_aliases = @import("./name_aliases.zig");
2121pub const named_sequences = @import("./named_sequences.zig");
2222pub const named_sequences_prov = @import("./named_sequences_prov.zig");
2323pub const prop_list = @import("./prop_list.zig");
24// PropertyAliases.txt
24pub const property_aliases = @import("./property_aliases.zig");
2525// PropertyValueAliases.txt
2626pub const script_extensions = @import("./script_extensions.zig");
2727pub const scripts = @import("./scripts.zig");
src/main.zig+1
......@@ -31,6 +31,7 @@ pub fn main() !void {
3131 ucd.vertical_orientation,
3232 ucd.emoji,
3333 ucd.script_extensions,
34 ucd.property_aliases,
3435 };
3536
3637 inline for (data) |b| {
src/property_aliases.zig created+144
......@@ -0,0 +1,144 @@
1// This file is part of the Unicode Character Database
2// For documentation, see http://www.unicode.org/reports/tr44/
3//
4// Based on the source file: https://unicode.org/Public/13.0.0/ucd/PropertyAliases.txt
5//
6// zig fmt: off
7
8const std = @import("std");
9
10pub const data = blk: {
11 @setEvalBranchQuota(4000);
12 const map = std.ComptimeStringMap([]const u8, .{
13 .{ "cjkAccountingNumeric", "kAccountingNumeric" },
14 .{ "cjkOtherNumeric", "kOtherNumeric" },
15 .{ "cjkPrimaryNumeric", "kPrimaryNumeric" },
16 .{ "nv", "Numeric_Value" },
17 .{ "cf", "Case_Folding" },
18 .{ "cjkCompatibilityVariant", "kCompatibilityVariant" },
19 .{ "dm", "Decomposition_Mapping" },
20 .{ "FC_NFKC", "FC_NFKC_Closure" },
21 .{ "lc", "Lowercase_Mapping" },
22 .{ "NFKC_CF", "NFKC_Casefold" },
23 .{ "scf", "Simple_Case_Folding" },
24 .{ "slc", "Simple_Lowercase_Mapping" },
25 .{ "stc", "Simple_Titlecase_Mapping" },
26 .{ "suc", "Simple_Uppercase_Mapping" },
27 .{ "tc", "Titlecase_Mapping" },
28 .{ "uc", "Uppercase_Mapping" },
29 .{ "bmg", "Bidi_Mirroring_Glyph" },
30 .{ "bpb", "Bidi_Paired_Bracket" },
31 .{ "cjkIICore", "kIICore" },
32 .{ "cjkIRG_GSource", "kIRG_GSource" },
33 .{ "cjkIRG_HSource", "kIRG_HSource" },
34 .{ "cjkIRG_JSource", "kIRG_JSource" },
35 .{ "cjkIRG_KPSource", "kIRG_KPSource" },
36 .{ "cjkIRG_KSource", "kIRG_KSource" },
37 .{ "cjkIRG_MSource", "kIRG_MSource" },
38 .{ "cjkIRG_SSource", "kIRG_SSource" },
39 .{ "cjkIRG_TSource", "kIRG_TSource" },
40 .{ "cjkIRG_UKSource", "kIRG_UKSource" },
41 .{ "cjkIRG_USource", "kIRG_USource" },
42 .{ "cjkIRG_VSource", "kIRG_VSource" },
43 .{ "cjkRSUnicode", "kRSUnicode" },
44 .{ "EqUIdeo", "Equivalent_Unified_Ideograph" },
45 .{ "isc", "ISO_Comment" },
46 .{ "JSN", "Jamo_Short_Name" },
47 .{ "na", "Name" },
48 .{ "na1", "Unicode_1_Name" },
49 .{ "Name_Alias", "Name_Alias" },
50 .{ "scx", "Script_Extensions" },
51 .{ "age", "Age" },
52 .{ "blk", "Block" },
53 .{ "sc", "Script" },
54 .{ "bc", "Bidi_Class" },
55 .{ "bpt", "Bidi_Paired_Bracket_Type" },
56 .{ "ccc", "Canonical_Combining_Class" },
57 .{ "dt", "Decomposition_Type" },
58 .{ "ea", "East_Asian_Width" },
59 .{ "gc", "General_Category" },
60 .{ "GCB", "Grapheme_Cluster_Break" },
61 .{ "hst", "Hangul_Syllable_Type" },
62 .{ "InPC", "Indic_Positional_Category" },
63 .{ "InSC", "Indic_Syllabic_Category" },
64 .{ "jg", "Joining_Group" },
65 .{ "jt", "Joining_Type" },
66 .{ "lb", "Line_Break" },
67 .{ "NFC_QC", "NFC_Quick_Check" },
68 .{ "NFD_QC", "NFD_Quick_Check" },
69 .{ "NFKC_QC", "NFKC_Quick_Check" },
70 .{ "NFKD_QC", "NFKD_Quick_Check" },
71 .{ "nt", "Numeric_Type" },
72 .{ "SB", "Sentence_Break" },
73 .{ "vo", "Vertical_Orientation" },
74 .{ "WB", "Word_Break" },
75 .{ "AHex", "ASCII_Hex_Digit" },
76 .{ "Alpha", "Alphabetic" },
77 .{ "Bidi_C", "Bidi_Control" },
78 .{ "Bidi_M", "Bidi_Mirrored" },
79 .{ "Cased", "Cased" },
80 .{ "CE", "Composition_Exclusion" },
81 .{ "CI", "Case_Ignorable" },
82 .{ "Comp_Ex", "Full_Composition_Exclusion" },
83 .{ "CWCF", "Changes_When_Casefolded" },
84 .{ "CWCM", "Changes_When_Casemapped" },
85 .{ "CWKCF", "Changes_When_NFKC_Casefolded" },
86 .{ "CWL", "Changes_When_Lowercased" },
87 .{ "CWT", "Changes_When_Titlecased" },
88 .{ "CWU", "Changes_When_Uppercased" },
89 .{ "Dash", "Dash" },
90 .{ "Dep", "Deprecated" },
91 .{ "DI", "Default_Ignorable_Code_Point" },
92 .{ "Dia", "Diacritic" },
93 .{ "EBase", "Emoji_Modifier_Base" },
94 .{ "EComp", "Emoji_Component" },
95 .{ "EMod", "Emoji_Modifier" },
96 .{ "Emoji", "Emoji" },
97 .{ "EPres", "Emoji_Presentation" },
98 .{ "Ext", "Extender" },
99 .{ "ExtPict", "Extended_Pictographic" },
100 .{ "Gr_Base", "Grapheme_Base" },
101 .{ "Gr_Ext", "Grapheme_Extend" },
102 .{ "Gr_Link", "Grapheme_Link" },
103 .{ "Hex", "Hex_Digit" },
104 .{ "Hyphen", "Hyphen" },
105 .{ "IDC", "ID_Continue" },
106 .{ "Ideo", "Ideographic" },
107 .{ "IDS", "ID_Start" },
108 .{ "IDSB", "IDS_Binary_Operator" },
109 .{ "IDST", "IDS_Trinary_Operator" },
110 .{ "Join_C", "Join_Control" },
111 .{ "LOE", "Logical_Order_Exception" },
112 .{ "Lower", "Lowercase" },
113 .{ "Math", "Math" },
114 .{ "NChar", "Noncharacter_Code_Point" },
115 .{ "OAlpha", "Other_Alphabetic" },
116 .{ "ODI", "Other_Default_Ignorable_Code_Point" },
117 .{ "OGr_Ext", "Other_Grapheme_Extend" },
118 .{ "OIDC", "Other_ID_Continue" },
119 .{ "OIDS", "Other_ID_Start" },
120 .{ "OLower", "Other_Lowercase" },
121 .{ "OMath", "Other_Math" },
122 .{ "OUpper", "Other_Uppercase" },
123 .{ "Pat_Syn", "Pattern_Syntax" },
124 .{ "Pat_WS", "Pattern_White_Space" },
125 .{ "PCM", "Prepended_Concatenation_Mark" },
126 .{ "QMark", "Quotation_Mark" },
127 .{ "Radical", "Radical" },
128 .{ "RI", "Regional_Indicator" },
129 .{ "SD", "Soft_Dotted" },
130 .{ "STerm", "Sentence_Terminal" },
131 .{ "Term", "Terminal_Punctuation" },
132 .{ "UIdeo", "Unified_Ideograph" },
133 .{ "Upper", "Uppercase" },
134 .{ "VS", "Variation_Selector" },
135 .{ "WSpace", "White_Space" },
136 .{ "XIDC", "XID_Continue" },
137 .{ "XIDS", "XID_Start" },
138 .{ "XO_NFC", "Expands_On_NFC" },
139 .{ "XO_NFD", "Expands_On_NFD" },
140 .{ "XO_NFKC", "Expands_On_NFKC" },
141 .{ "XO_NFKD", "Expands_On_NFKD" },
142 });
143 break :blk map;
144};
\ No newline at end of file