LibWeb: Rename "identifier" and "ValueID" to "Keyword" where correct

For a long time, we've used two terms, inconsistently:
- "Identifier" is a spec term, but refers to a sequence of alphanumeric
  characters, which may or may not be a keyword. (Keywords are a
  subset of all identifiers.)
- "ValueID" is entirely non-spec, and is directly called a "keyword" in
  the CSS specs.

So to avoid confusion as much as possible, let's align with the spec
terminology. I've attempted to change variable names as well, but
obviously we use Keywords in a lot of places in LibWeb and so I may
have missed some.

One exception is that I've not renamed "valid-identifiers" in
Properties.json... I'd like to combine that and the "valid-types" array
together eventually, so there's no benefit to doing an extra rename
now.
This commit is contained in:
Sam Atkins 2024-08-14 14:06:03 +01:00 committed by Sam Atkins
parent 9559f0f123
commit 6a74b01644
Notes: github-actions[bot] 2024-08-15 12:59:33 +00:00
48 changed files with 702 additions and 702 deletions

View file

@ -109,11 +109,11 @@ static Optional<RoundingStrategy> parse_rounding_strategy(Vector<ComponentValue>
if (stream.has_next_token())
return {};
auto maybe_identifier = value_id_from_string(ident.token().ident());
if (!maybe_identifier.has_value())
auto maybe_keyword = keyword_from_string(ident.token().ident());
if (!maybe_keyword.has_value())
return {};
return value_id_to_rounding_strategy(maybe_identifier.value());
return keyword_to_rounding_strategy(maybe_keyword.value());
}
OwnPtr<CalculationNode> Parser::parse_math_function(PropertyID property_id, Function const& function)
@ -357,15 +357,15 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
{
StringView generated_header_path;
StringView generated_implementation_path;
StringView identifiers_json_path;
StringView json_path;
Core::ArgsParser args_parser;
args_parser.add_option(generated_header_path, "Path to the MathFunctions header file to generate", "generated-header-path", 'h', "generated-header-path");
args_parser.add_option(generated_implementation_path, "Path to the MathFunctions implementation file to generate", "generated-implementation-path", 'c', "generated-implementation-path");
args_parser.add_option(identifiers_json_path, "Path to the JSON file to read from", "json-path", 'j', "json-path");
args_parser.add_option(json_path, "Path to the JSON file to read from", "json-path", 'j', "json-path");
args_parser.parse(arguments);
auto json = TRY(read_entire_file_as_json(identifiers_json_path));
auto json = TRY(read_entire_file_as_json(json_path));
VERIFY(json.is_object());
auto math_functions_data = json.as_object();