mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-08 20:32:56 +03:00
LibUnicode: Move GenerateUnicodeData's Alias struct to generator header
This will be used for locale aliases as well. Also rename the "property" field in this struct to "name", as it no longer is only used for property aliases.
This commit is contained in:
parent
186e1b7624
commit
9d1519e21c
Notes:
sideshowbarker
2024-07-18 01:00:17 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/9d1519e21c4 Pull-request: https://github.com/SerenityOS/serenity/pull/10947
@ -45,12 +45,6 @@ struct SpecialCasing {
|
||||
// Property descriptions: https://www.unicode.org/reports/tr44/tr44-13.html#PropList.txt
|
||||
using PropList = HashMap<String, Vector<CodePointRange>>;
|
||||
|
||||
// PropertyAliases source: https://www.unicode.org/Public/13.0.0/ucd/PropertyAliases.txt
|
||||
struct Alias {
|
||||
String property;
|
||||
String alias;
|
||||
};
|
||||
|
||||
// Normalization source: https://www.unicode.org/Public/13.0.0/ucd/DerivedNormalizationProps.txt
|
||||
// Normalization descriptions: https://www.unicode.org/reports/tr44/#DerivedNormalizationProps.txt
|
||||
enum class QuickCheck {
|
||||
@ -479,7 +473,7 @@ enum class @name@ : @underlying@ {)~~~");
|
||||
|
||||
for (auto const& alias : aliases) {
|
||||
generator.set("alias", alias.alias);
|
||||
generator.set("value", alias.property);
|
||||
generator.set("value", alias.name);
|
||||
generator.append(R"~~~(
|
||||
@alias@ = @value@,)~~~");
|
||||
}
|
||||
@ -929,7 +923,7 @@ static void normalize_script_extensions(PropList& script_extensions, PropList co
|
||||
|
||||
for (auto const& extension : extensions) {
|
||||
auto it = find_if(script_aliases.begin(), script_aliases.end(), [&](auto const& alias) { return extension.key == alias.alias; });
|
||||
auto const& key = (it == script_aliases.end()) ? extension.key : it->property;
|
||||
auto const& key = (it == script_aliases.end()) ? extension.key : it->name;
|
||||
|
||||
auto& code_points = script_extensions.find(key)->value;
|
||||
code_points.extend(extension.value);
|
||||
|
@ -91,6 +91,11 @@ private:
|
||||
HashMap<StringView, StringIndexType> m_unique_string_indices;
|
||||
};
|
||||
|
||||
struct Alias {
|
||||
String name;
|
||||
String alias;
|
||||
};
|
||||
|
||||
template<typename StringIndexType>
|
||||
struct CanonicalLanguageID {
|
||||
static Optional<CanonicalLanguageID> parse(UniqueStringStorage<StringIndexType>& unique_strings, StringView language)
|
||||
|
Loading…
Reference in New Issue
Block a user