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

Re: [css-mediaqueries] whitespace handling

From: Shiki Okasaka <shiki.okasaka@gmail.com>
Date: Fri, 30 Aug 2013 20:55:08 +0900
Message-ID: <CALQi=3e6G6MLbmpk6H5zgCo9Cs66Z34KiazmHr_VRdQr93AJfg@mail.gmail.com>
To: Florian Rivoal <florian@rivoal.net>
Cc: "L. David Baron" <dbaron@dbaron.org>, www-style@w3.org
On Wed, 10 Jul 2013 01:32:01 +0200, L. David Baron <dbaron@dbaron.org> wrote:
> media_query
>    : [ONLY | NOT]? S+ media_type [ S+ AND S+ expression ]* S*
>      | expression [ S+ AND S+ expression ]* S*
>    ;

With this grammar, media_query needs to begin with at least one S if
neither ONLY nor NOT is used.
I guess what we are expecting would be like:

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

Right?

 - Shiki

2013/7/11 Florian Rivoal <florian@rivoal.net>:
> 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 Friday, 30 August 2013 11:55:36 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:31 UTC