Commit graph

17 commits

Author SHA1 Message Date
Callum Law
099c3fa590 Meta: Handle juxtaposition in CSS value parsing code generation 2026-05-13 11:26:20 +01:00
Callum Law
30e58a48c6 Meta: Handle optionals in CSS value parsing code generation 2026-05-13 11:26:20 +01:00
Callum Law
6361dcaae5 Meta: Handle groups in CSS value parsing code generation
We don't yet support required groups so for the moment these just fall
back to generating the parsing code of their child
2026-05-13 11:26:20 +01:00
Callum Law
b39bcaf1e4 Meta: Optimize keyword alternatives parsing 2026-05-13 11:00:07 +01:00
Callum Law
f578d95be0 LibWeb: Support multiple keywords in parse_specific_keyword_value
This will allow us to combine multiple calls into one and avoid
repeatedly parsing and then discarding `KeywordStyleValue`s
2026-05-13 11:00:07 +01:00
Callum Law
a9d2b1dde6 Meta: Read dimensions from Units.json in CSS grammar parser
Avoids us having to maintain a separate hardcoded list.

This does mean we don't support parsing of `decibel` but it's not used
anywhere yet and will be supported automatically when added to
Units.json
2026-05-13 11:00:07 +01:00
Zaggy1024
8f7a4754fe Meta: Change the Token.component_value() check to 'is not None'
Python 3.9 doesn't support isinstance of union types.
2026-04-30 09:32:22 +02:00
Zaggy1024
c5060fb6cf Meta: Forward reference the return type for Token static constructors
Self isn't supported in python 3.9.
2026-04-30 09:32:22 +02:00
Zaggy1024
cce3b03532 Meta: Don't use union operator syntax in generators
These aren't supported in Python 3.9.
2026-04-30 09:32:22 +02:00
Zaggy1024
ccaaefbf27 LibWeb+Meta: Don't require the custom ident blacklist parameter
With a default parameter, we can avoid having to store None for the
blacklist when it's not applicable.
2026-04-30 09:32:22 +02:00
Zaggy1024
d253d53b29 Meta: Add typing to some lists in CSSGrammar
This makes Pylance happier.
2026-04-30 09:32:22 +02:00
Zaggy1024
0b96209a1e Meta: Avoid match statements in CSS generators 2026-04-30 09:32:22 +02:00
Sam Atkins
39c997b102 Meta: Use consume_specific in Python CSS Grammar tokenizer
A stealth merge conflict meant consume_specific_string() and
consume_specific_char() got combined into a single method and no longer
exist.
2026-04-29 13:23:53 +01:00
Callum Law
0d75d66f2e Meta: Handle bracketed range notations in CSS value grammar 2026-04-29 11:42:57 +01:00
Callum Law
521beb5a96 Meta: Implement code generation for CSS keyword values 2026-04-29 11:42:57 +01:00
Callum Law
dd9f0b8838 Meta: Implement code generation for CSS custom ident value blacklists 2026-04-29 11:42:57 +01:00
Callum Law
09418e8c77 Meta: Implement CSS value type parsing code generation
To do this we parse the grammar supplied in `ValueTypes.json` and
generate the appropriate parsing function in `CSS::Parser::Parser`

Only a small subset of the CSS grammar (i.e. types `<foo>` and
alternatives `<foo> | <bar>`) is implemented so far, it will be
expanded in later commits.
2026-04-29 11:42:57 +01:00