- From: Henrik Andersson <henke@henke37.cjb.net>
- Date: Mon, 23 Mar 2015 18:56:17 +0100
- To: Simon Sapin <simon.sapin@exyr.org>, www-style list <www-style@w3.org>
Simon Sapin skrev: > MQ Level 4 extends the syntax to allow arbitrary nesting of "not", > "and", and "or" boolean operators. It avoids the question of whether > `A or B and C` should be interpreted as `A or (B and C)` or `(A or B) > and C` by requiring the parentheses: > > Extract of the grammar: > >> <media-condition> = <media-not> | <media-and> | <media-or> | >> <media-in-parens> >> <media-not> = not <media-in-parens> >> <media-and> = <media-in-parens> [ and <media-in-parens> ]+ >> <media-or> = <media-in-parens> [ or <media-in-parens> ]+ >> <media-in-parens> = ( <media-condition> ) | <media-feature> | >> <general-enclosed> > > > However, there is one case left that may seem ambiguous. The > <media-query> grammar: > >> <media-query> = <media-condition> >> | [ not | only ]? <media-type> [ and <media-condition> ]? > > accepts `<media-type> and <media-or>`, e.g. `screen and (foo) or (bar)`. > > The grammar makes it unambiguously the same as `screen and ((foo) or > (bar))`, but that’s not obvious without referring to the spec. > > > Should the grammar be restricted to require parenthenses in this case > as well? > Given that or traditionally has lower predecease than and, it's certainly confusing.
Received on Monday, 23 March 2015 17:56:55 UTC