W3C home > Mailing lists > Public > www-style@w3.org > July 2013

Re: [css-mediaqueries] whitespace handling

From: L. David Baron <dbaron@dbaron.org>
Date: Tue, 9 Jul 2013 16:32:01 -0700
To: Florian Rivoal <florian@rivoal.net>
Cc: www-style@w3.org
Message-ID: <20130709233201.GA22283@crum.dbaron.org>
On Monday 2013-07-08 12:35 +0200, Florian Rivoal wrote:
> media_query
>    : [ONLY | NOT]? S+ media_type S* [S AND S+ expression ]*
>      | expression [ S AND S+ expression ]*
>    ;

So you don't want occurrences of "S" without a * or a +, and I think
you also don't want to write the grammar such that you have to read
backwards (e.g., "S* S", which requires working backwards to figure
out which part of the whitespace matches the S*).

So I think it would be better to write:

media_query
   : [ONLY | NOT]? S+ media_type [ S+ AND S+ expression ]* S*
     | expression [ S+ AND S+ expression ]* S*
   ;

and then remove the trailing "S*" in expression so that it is:

expression
   : '(' S* media_feature S* [ ':' S* expr ]? ')'
   ;

-David

-- 
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                           http://www.mozilla.org/   𝄂
Received on Tuesday, 9 July 2013 23:32:26 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 9 July 2013 23:32:27 UTC