W3C home > Mailing lists > Public > www-style@w3.org > March 2015

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

From: Simon Sapin <simon.sapin@exyr.org>
Date: Mon, 23 Mar 2015 19:44:21 +0100
Message-ID: <55105F05.9070802@exyr.org>
To: www-style list <www-style@w3.org>
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

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:52 UTC