Re: Allow whitespace before the commas?

On Monday 2008-12-08 20:11 -0800, fantasai wrote:
> There are several places where white space seems to have been
> left out of the grammar.
>
> Unless I'm missing something we need to replace
>   : selector [ COMMA S* selector ]*
> with
>   : selector [ S* COMMA S* selector ]*
> and
>   : PLUS S* | GREATER S* | TILDE S* | S+
> with
>   : S* PLUS S* | S* GREATER S* | S* TILDE S* | S+
>
> Bert or dbaron, could you check that? If it's correct I'll
> edit these changes into the spec.

That seems correct, although insufficient (see below).  However, I
think it fits better with the existing style to instead have the
whitespace at the end of the simple_selector production.  (Might
there also be technical reasons for preferring the
whitespace-at-end-of-production habit?  Doing that at least often
has helpful affects of propagating the allowance of whitespace up to
other productions.)

In other words, instead of the above two changes, change:
  # simple_selector
  #   : element_name [ HASH | class | attrib | pseudo ]*
  #   | [ HASH | class | attrib | pseudo ]+
  #   ;
to be either:
  # simple_selector
  #   : element_name [ HASH | class | attrib | pseudo ]* S*
  #   | [ HASH | class | attrib | pseudo ]+ S*
  #   ;
or probably preferably:
  # simple_selector
  #   : [ element_name [ HASH | class | attrib | pseudo ]* |
  #       [ HASH | class | attrib | pseudo ]+ ] S*
  #   ;

Having optional whitespace at the end of simple_selector would both
fix the combinator issue and ensure that there is also optional
whitespace at the end of selector.   It would also fix the third bug
that the current Appendix D grammar does not allow whitespace
between the selector and the "{" to begin the ruleset.

-David

-- 
L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/

Received on Tuesday, 9 December 2008 04:48:10 UTC