- From: Christoph Päper <christoph.paeper@crissov.de>
- Date: Fri, 3 Sep 2010 12:07:27 +0200
- To: "www-style@w3.org list" <www-style@w3.org>
Mark:
> On Thu, Sep 2, 2010 at 1:32 PM, Jorrit Vermeiren <mercator+w3c@gmail.com> wrote:
>> On Thu, Sep 2, 2010 at 09:49, Mark <markjord@gmail.com> wrote:
>>>
>>> ruleset
>>> : selector [ ',' S* selector ]*
>>> '{' S* declaration? [ ';' S* declaration? ]* '}' S*
>>
>> selector
>> : simple_selector [ combinator selector | S+ [ combinator? selector ]? ]?
>
> If I only have a simple_selector, how is it taken care of?
You only have only a ‘simple_selector’ if there’s no space betweeen it and the opening brace, otherwise you have ‘simple_selector S+’ as ‘selector’. There’s no problem, although I agree that ‘S*’ in front of the brace would look more intuitive, when you consider the space a divider and not part of the selector. I think you could then remove one question mark:
ruleset
: selector [ ',' S* selector ]*
S* '{' S* declaration? [ ';' S* declaration? ]* '}' S*
selector
: simple_selector [ combinator selector | S+ [ combinator? selector ] ]?
Note that there’s also no explicit ‘S*’ in front of the closing brace or the semicolon, because most productions end with ‘S*’ anyhow.
PS: I believe grammars would become more human readable if phrases like
'{' S* declaration? [ ';' S* declaration? ]* '}'
could be shortened to
'{' [ [ ';' ]^ S* declaration? ]* '}'
where ‘X^’ meant exactly one ‘X’, but no ‘X’ in the first instance of the parent group.
Received on Friday, 3 September 2010 10:08:02 UTC