W3C home > Mailing lists > Public > www-style@w3.org > April 2011

Re: [css3-namespace] grammar for toto|A, whitespace & comments

From: fantasai <fantasai.lists@inkedblade.net>
Date: Wed, 06 Apr 2011 22:18:43 -0700
Message-ID: <4D9D4933.5090103@inkedblade.net>
To: Peter Moulder <peter.moulder@monash.edu>, www-style@w3.org
On 03/04/2011 06:39 AM, Peter Moulder wrote:
> Sections 3.1 and 4 give the following grammar fragments, each said to be
> using "the notation from the Grammar appendix of CSS 2.1".
>
> Section 4:
>
>    qname_prefix
>      : [namespace_prefix]? '|'
>      ;
>    wqname_prefix
>      : namespace_prefix? '|'
>      | '*' '|'
>      ;
>
> where namespace_prefix is defined in section 3.1 as:
>
>    namespace_prefix
>      : IDENT
>      ;
>
> (where it is used by the namespace production, which explicitly follows
> it with S*).
>
> Note that the Grammar appendix of CSS2.1 (as with the core grammar in
> CSS21/syndata.html) uses explicit S tokens for white space, but the lexer
> in the grammar appendix ignores comments.
>
> I believe this means that
>
>    toto/* comment */|/* comment */A    and
>    */* comment */|/* comment */A
>
> are syntactically valid, while
>
>    toto |A    and
>    * |A
>
> are not.
>
> (It isn't completely clear whether white space is allowed after the '|';
> though I'd tend to read it that space isn't allowed there.)
>
> This is surprising.
>
> I believe it is worth commenting explicitly on whether white space and/or
> comments can occur either side of the '|' token.
>
> At least in CSS 2.1 (including the core grammar), the set of places where
> comments can occur equals the set of places where S tokens can occur,
> namely before or after any other token [ignoring @charset issues].  I
> don't know if any other CSS modules require distinguishing between S and
> comment tokens; but on the basis of this limited knowledge of CSS
> modules, I would tend to suggest that if '|' is to be considered a
> separate token (which it is in the core grammar) then it would be good to
> allow UAs to accept white space and/or comments either side of the '|'.
> Of course that doesn't preclude making authoring/stylistic
> recommendations not to have any space or comments around the '|'.

We currently have three implementations (Webkit, Gecko, Opera) that
accept comments but not white space around the |. So I think that's
the behavior we ought to stick with.

I've appended to
   # The syntax uses notation from the Grammar appendix of CSS 2.1.
the following
   | Note this means that comments, but not white space, are implicitly
   | allowed between tokens.

Would that be a sufficient edit to clarify this situation, or would
there be other (or different) changes necessary?

~fantasai
Received on Thursday, 7 April 2011 05:19:15 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:39 GMT