1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:48:11 +00:00

LibJS+LibUnicode: Do not generate the PluralCategory enum

The PluralCategory enum is currently generated for plural rules. Instead
of generating it, this moves the enum to the public LibUnicode header.
While it was nice to auto-discover these values, they are well defined
by TR-35, and we will need their values from within the number format
code generator (which can't rely on the plural rules generator having
run yet). Further, number format will require additional values in the
enum that plural rules doesn't know about.
This commit is contained in:
Timothy Flynn 2022-07-08 07:52:54 -04:00 committed by Linus Groh
parent 9369610bf4
commit cc5c707649
5 changed files with 50 additions and 48 deletions

View file

@ -6,18 +6,8 @@
#include <LibUnicode/PluralRules.h>
#if ENABLE_UNICODE_DATA
# include <LibUnicode/UnicodePluralRules.h>
#endif
namespace Unicode {
#if !ENABLE_UNICODE_DATA
enum class PluralCategory : u8 {
Other,
};
#endif
PluralForm plural_form_from_string(StringView plural_form)
{
if (plural_form == "cardinal"sv)
@ -39,18 +29,6 @@ StringView plural_form_to_string(PluralForm plural_form)
}
}
Optional<PluralCategory> __attribute__((weak)) plural_category_from_string(StringView category)
{
VERIFY(category == "other"sv);
return PluralCategory::Other;
}
StringView __attribute__((weak)) plural_category_to_string(PluralCategory category)
{
VERIFY(category == PluralCategory::Other);
return "other"sv;
}
PluralCategory __attribute__((weak)) determine_plural_category(StringView, PluralForm, PluralOperands)
{
return PluralCategory::Other;