summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibUnicode/CodeGenerators
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2021-07-31 16:21:01 -0400
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-08-02 21:02:09 +0430
commitf63287cd63a9c713b369248f22214fa1345fdf70 (patch)
tree6059d94058ffe6c1e49f630402c3bcf81f7dc03d /Userland/Libraries/LibUnicode/CodeGenerators
parent16e86ae743e5b645b1155ca7045dbf8356f78fed (diff)
downloadserenity-f63287cd63a9c713b369248f22214fa1345fdf70.zip
LibUnicode: Initialize manually created Unicode properties inline
Using initializer lists directly in the UnicodeData struct definition feels a bit cleaner than invoking HashMap::set in main().
Diffstat (limited to 'Userland/Libraries/LibUnicode/CodeGenerators')
-rw-r--r--Userland/Libraries/LibUnicode/CodeGenerators/GenerateUnicodeData.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/Userland/Libraries/LibUnicode/CodeGenerators/GenerateUnicodeData.cpp b/Userland/Libraries/LibUnicode/CodeGenerators/GenerateUnicodeData.cpp
index b85ea1e947..de18f2adba 100644
--- a/Userland/Libraries/LibUnicode/CodeGenerators/GenerateUnicodeData.cpp
+++ b/Userland/Libraries/LibUnicode/CodeGenerators/GenerateUnicodeData.cpp
@@ -103,8 +103,17 @@ struct UnicodeData {
};
Vector<Alias> general_category_aliases;
- PropList prop_list;
+ // The Unicode standard defines additional properties (Any, Assigned, ASCII) which are not in
+ // any UCD file. Assigned is set as the default enum value 0 so "property & Assigned == Assigned"
+ // is always true. Any is not assigned code points here because this file only parses assigned
+ // code points, whereas Any will include unassigned code points.
+ // https://unicode.org/reports/tr18/#General_Category_Property
+ PropList prop_list {
+ { "Any"sv, {} },
+ { "ASCII"sv, { { 0, 0, 0x7f } } },
+ };
Vector<Alias> prop_aliases;
+
PropList word_break_prop_list;
};
@@ -774,15 +783,6 @@ int main(int argc, char** argv)
parse_prop_list(derived_core_prop_file, unicode_data.prop_list);
parse_alias_list(prop_alias_file, unicode_data.prop_list, unicode_data.prop_aliases);
parse_prop_list(word_break_file, unicode_data.word_break_prop_list);
-
- // The Unicode standard defines additional properties (Any, Assigned, ASCII) which are not in
- // any UCD file. Assigned is set as the default enum value 0 so "property & Assigned == Assigned"
- // is always true. Any is not assigned code points here because this file only parses assigned
- // code points, whereas Any will include unassigned code points.
- // https://unicode.org/reports/tr18/#General_Category_Property
- unicode_data.prop_list.set("Any"sv, {});
- unicode_data.prop_list.set("ASCII"sv, { { 0, 0, 0x7f } });
-
parse_unicode_data(unicode_data_file, unicode_data);
parse_value_alias_list(prop_value_alias_file, "gc"sv, unicode_data.general_categories, unicode_data.general_category_unions, unicode_data.general_category_aliases);