Re: [css-mediaqueries] whitespace handling

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