Expand description
AST types for the Media Queries Level 4 grammar (<media-query-list>
and below), as parsed by crate::parser.
Pure syntax/structure — see CLAUDE.md: this crate has no “matches
a real device/viewport” concept.
Grammar reference: Media Queries Level 4 §3, which already
defines the <mf-range> alternative (comparison operators, one- and
two-sided ranges) normatively alongside <mf-plain>/<mf-boolean>
— see plan/DECISIONS.md for why this is Level 4, not Level 5.
MediaFeature covers all three.
Structs§
- General
Enclosed <general-enclosed>: a syntactically well-bracketed but not further interpretable block, kept verbatim as a forward- compatibility fallback (spec §3, prose right after the grammar) — not a parse error. Holds the raw tokens of the block’s content: for the( <any-value>? )alternative, the tokens between the parentheses (parentheses themselves excluded); for the<function-token> <any-value>? )alternative, the function token followed by its argument tokens (closing)excluded). Seecrate::parser.- Media
Query List <media-query-list> = <media-query>#- Media
Type <media-type> = <ident>, structurally excludingnot/and/or/only/layer(spec §3: “The<media-type>production does not include the keywordsonly,not,and,or, andlayer”).- MfName
<mf-name> = <ident>
Enums§
- Media
Condition <media-condition> = <media-not> | <media-in-parens> [ <media-and>* | <media-or>* ]- Media
Condition Without Or <media-condition-without-or> = <media-not> | <media-in-parens> <media-and>*- Media
Feature <media-feature> = [ <mf-plain> | <mf-boolean> | <mf-range> ]- Media
InParens <media-in-parens> = ( <media-condition> ) | ( <media-feature> ) | <general-enclosed>- Media
Modifier not|only, as used in the<media-type>branch of<media-query>.- Media
Query <media-query> = <media-condition> | [ not | only ]? <media-type> [ and <media-condition-without-or> ]?- MfComparison
<mf-comparison> = <mf-lt> | <mf-gt> | <mf-eq>, for the one-sided<mf-range>forms (MfRange::NameFirst/MfRange::ValueFirst).<mf-lt> = '<' '='?,<mf-gt> = '>' '='?,<mf-eq> = '='.- MfRange
<mf-range>, all four grammar alternatives:- MfRange
Direction - Direction of a two-sided
<mf-range>:Ascendingis the<mf-lt>family (lower < name < upper),Descendingis the<mf-gt>family (lower > name > upper). - MfValue
<mf-value> = <number> | <dimension> | <ident> | <ratio>