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

[mediaqueries] Editorial: <media-condition> grammar requires unbounded look-ahead

From: Simon Sapin <simon.sapin@exyr.org>
Date: Mon, 23 Mar 2015 17:19:08 +0100
Message-ID: <55103CFC.4000506@exyr.org>
To: www-style list <www-style@w3.org>
The grammar currently is:

> <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> ]+

When parsing <media-condition>, deciding which of the alternatives 
should be taken may require looking ahead by an unbounded amount.

To avoid this, it could be rewritten as:

<media-condition> = <media-not>
                   | <media-in-parens> [ <media-and>* | <media-or>* ]
<media-not> = not <media-in-parens>
<media-and> = and <media-in-parens>
<media-or> = or <media-in-parens>


Unfortunately that makes more awkward the definitions that follow

> Each of the major terms of <media-condition> is associated with a
> boolean result, as follows:


Note that we made a similar change to the @page grammar for this reason:

https://lists.w3.org/Archives/Public/www-style/2012Apr/0620.html

(Although the @page one is even more awkward, since we had to use 
recursion instead of repetition.)

-- 
Simon Sapin
Received on Monday, 23 March 2015 16:19:31 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:30 UTC