RE: Comments

--- Bert Bos <Bert.Bos@sophia.inria.fr> wrote:
> Matthew Brealey writes:
> > --- Bill dehOra <Wdehora@cromwellmedia.co.uk>
> wrote:
> > > 
> > >    :  Given that
> > >    :  P {colour: red /* comment */}
> > >    :  isn't valid, should the declaration (i.e.,
> > > color: red)
> > >    :  be ignored as invalid?
> > >    
> > > 
> > > If you are referring to the comment placement,
> why
> > > isn't this valid? A
> > > comment can appear anywhere between tokens; here
> it
> > > appears between
> > > <whitespace> and a <}>, which are both tokens
> (in
> > > CSS2 at least).  
> > 
> > No no no.
> > 
> > When you refer to <whitespace>, I presume you mean
> the
> > S token. 
> > 
> > However, } isn't a token at all.
> 
> Hmm, that is rather a narrow interpretation of
> "token"...
> 
> The only reason '}' isn't spelled "RBRACE" is that
> the former is
> shorter. 

Please, as general practice, if one option is shorter
and the other is unambiguous, take the unambiguous
option - grammar is not designed to be an easy-to-read
page turner.

> When the spec says "comments [...] may
> occur anywhere between
> tokens" it certainly intends '}' to be a token. In
> fact, if you look
> at 4.1.1[1], you see that '}' is explicitly listed
> as a token.

I had noticed, but given that it didn't appear to be
defined as such in the tokeniser at:

http://www.w3.org/TR/REC-CSS2/syndata.html#tokenization

, I assumed that it was included for
forward-compatibility reasons in case it was used as a
token in future.

Even given that this is so, I fail to see why P[/* a
comment */class] is valid (comment betwen [ token and
IDENT token, but
P/* comment */:first-line and P/* comment */.class
are't (: and . aren't tokens).

Equally, compare
P {color/* comment */: red}
and
P {color: red/* comment*/}

Why should one be valid and not the other, and why
bother tokenising {}()[]S; but not . and :?

> 
> [1]
>
http://www.w3.org/TR/REC-CSS2/syndata.html#tokenization


=====
----------------------------------------------------------
From Matthew Brealey (http://members.tripod.co.uk/lawnet (for law)or http://members.tripod.co.uk/lawnet/WEBFRAME.HTM (for CSS))
__________________________________________________
Do You Yahoo!?
Thousands of Stores.  Millions of Products.  All in one place.
Yahoo! Shopping: http://shopping.yahoo.com

Received on Wednesday, 15 December 1999 05:13:51 UTC