mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 10:14:57 +00:00
![]() We know what types and identifiers a property can accept, so we can use that information to only parse things that can be accepted. This solves some awkward ambiguity problems that we have now or will face in the future, including: - Is `0` a number or a length with no unit? - Is `3.5` a number or a ratio? - Is `bottom` an identifier, or a custom-ident? Two CSS Parser methods are introduced here: `parse_css_value_for_property()` attempts to parse a StyleValue that the property can accept, skipping any types that it doesn't want. `parse_css_value_for_properties()` does the same, but takes multiple PropertyIDs and additionally returns which one the parsed StyleValue is for. This is intended for parsing shorthands, so you can give it a list of longhands you haven't yet parsed. Subsequent commits will actually use these new methods. |
||
---|---|---|
.. | ||
Block.cpp | ||
Block.h | ||
ComponentValue.cpp | ||
ComponentValue.h | ||
Declaration.cpp | ||
Declaration.h | ||
DeclarationOrAtRule.cpp | ||
DeclarationOrAtRule.h | ||
Function.cpp | ||
Function.h | ||
Parser.cpp | ||
Parser.h | ||
Rule.cpp | ||
Rule.h | ||
Token.cpp | ||
Token.h | ||
Tokenizer.cpp | ||
Tokenizer.h | ||
TokenStream.h |