Skip to main content

Module ast

Module ast 

Source
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§

GeneralEnclosed
<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). See crate::parser.
MediaQueryList
<media-query-list> = <media-query>#
MediaType
<media-type> = <ident>, structurally excluding not/and/or/ only/layer (spec §3: “The <media-type> production does not include the keywords only, not, and, or, and layer”).
MfName
<mf-name> = <ident>

Enums§

MediaCondition
<media-condition> = <media-not> | <media-in-parens> [ <media-and>* | <media-or>* ]
MediaConditionWithoutOr
<media-condition-without-or> = <media-not> | <media-in-parens> <media-and>*
MediaFeature
<media-feature> = [ <mf-plain> | <mf-boolean> | <mf-range> ]
MediaInParens
<media-in-parens> = ( <media-condition> ) | ( <media-feature> ) | <general-enclosed>
MediaModifier
not | only, as used in the <media-type> branch of <media-query>.
MediaQuery
<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:
MfRangeDirection
Direction of a two-sided <mf-range>: Ascending is the <mf-lt> family (lower < name < upper), Descending is the <mf-gt> family (lower > name > upper).
MfValue
<mf-value> = <number> | <dimension> | <ident> | <ratio>