1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 15:54:58 +00:00

Unicode: s/codepoint/code_point/g

Unicode calls them "code points" so let's follow their style.
This commit is contained in:
Andreas Kling 2020-08-03 19:06:41 +02:00
parent b139fb9f38
commit ea9ac3155d
45 changed files with 449 additions and 449 deletions

View file

@ -31,12 +31,12 @@
namespace Web {
namespace HTML {
Optional<EntityMatch> codepoints_from_entity(const StringView& entity)
Optional<EntityMatch> code_pointss_from_entity(const StringView& entity)
{
constexpr struct {
StringView entity;
u32 codepoint;
} single_codepoint_entities[] = {
u32 code_points;
} single_code_points_entities[] = {
{ "AElig;", 0x000C6 },
{ "AElig", 0x000C6 },
{ "AMP;", 0x00026 },
@ -2179,9 +2179,9 @@ Optional<EntityMatch> codepoints_from_entity(const StringView& entity)
constexpr struct {
StringView entity;
u32 codepoint1;
u32 codepoint2;
} double_codepoint_entities[] = {
u32 code_points1;
u32 code_points2;
} double_code_points_entities[] = {
{ "NotEqualTilde;", 0x02242, 0x00338 },
{ "NotGreaterFullEqual;", 0x02267, 0x00338 },
{ "NotGreaterGreater;", 0x0226B, 0x00338 },
@ -2279,17 +2279,17 @@ Optional<EntityMatch> codepoints_from_entity(const StringView& entity)
EntityMatch match;
for (auto& single_codepoint_entity : single_codepoint_entities) {
if (entity.starts_with(single_codepoint_entity.entity)) {
if (match.entity.is_null() || single_codepoint_entity.entity.length() > match.entity.length())
match = { { single_codepoint_entity.codepoint }, single_codepoint_entity.entity };
for (auto& single_code_points_entity : single_code_points_entities) {
if (entity.starts_with(single_code_points_entity.entity)) {
if (match.entity.is_null() || single_code_points_entity.entity.length() > match.entity.length())
match = { { single_code_points_entity.code_points }, single_code_points_entity.entity };
}
}
for (auto& double_codepoint_entity : double_codepoint_entities) {
if (entity.starts_with(double_codepoint_entity.entity)) {
if (match.entity.is_null() || double_codepoint_entity.entity.length() > match.entity.length())
match = EntityMatch { { double_codepoint_entity.codepoint1, double_codepoint_entity.codepoint2 }, StringView(double_codepoint_entity.entity) };
for (auto& double_code_points_entity : double_code_points_entities) {
if (entity.starts_with(double_code_points_entity.entity)) {
if (match.entity.is_null() || double_code_points_entity.entity.length() > match.entity.length())
match = EntityMatch { { double_code_points_entity.code_points1, double_code_points_entity.code_points2 }, StringView(double_code_points_entity.entity) };
}
}