- From: Peter Moulder <peter.moulder@monash.edu>
- Date: Sat, 05 Mar 2011 01:39:04 +1100
- To: www-style@w3.org
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 '|'.
pjrm.
Received on Friday, 4 March 2011 14:39:35 UTC