[mediaqueries] Excluding '!' and ';' in <general-enclosed>?

The MQ4 ED currently uses <any-value> in its grammar:

> <general-enclosed> = [ <function-token> | ( ] <any-value>* )

and refers to css-variables, which defines it:

> The <any-value> production matches any sequence of one or more
> tokens, so long as the sequence does not contain <bad-string-token>,
> <bad-url-token>, unmatched <)-token>, <]-token>, or <}-token>, or
> top-level <semicolon-token> tokens or <delim-token> tokens with a
> value of "!".


First of all, since <any-value> is already "one or more" tokens, so the 
repetition in `<any-value>*` could be replaced with  `<any-value>?`.


Some tokens are excluded:

A. bad-string, bad-url, unmatched ), ], or }. These always represent 
parse errors.

B. Top-level ';'. This is so that '@support (--a: b; c) {}' doesn’t 
parse as a custom property with value 'b; c', which could not be 
represented in a style rule.

C. Top-level '!'. This is to allow future extensions similar to 
!important to the property declaration syntax.


A. makes sense for <general-enclosed> (or anything similarly open-ended) 
but B. and C. seem arbitrary there, the reasons for these restrictions 
just don’t apply.

Note that the @supports grammar has a similar general-enclosed grammar 
production, but refers to CSS 2 to define it and so has the equivalent 
of A. but not B. or C.

-- 
Simon Sapin

Received on Monday, 23 March 2015 18:44:46 UTC