Re: [css-mediaqueries] whitespace handling

On Wed, 10 Jul 2013 01:32:01 +0200, L. David Baron <dbaron@dbaron.org>  
wrote:

> 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 ]? ')'
>    ;

Thanks, that does sound better indeed.

  - Florian

Received on Wednesday, 10 July 2013 15:01:23 UTC