Re: Error Parsing

David Woolley wrote:

>> p {
>>   color: red;
>>   /*
>>   font-size: 12pt;
>... 
>> According to CSS21 parsing rules, it must be:
>
>That really depends on whether you treat it as being a broken comment at
>the lexical level or as a non-comment token followed by other tokens.
>This is a lexical error rather than a parsing error.

The tokenization sequence at this point is:

 ; 
 DELIM(/) 
 DELIM(*) 
 IDENT(font-size) 
 :

Since tokenization is normatively defined [1] and the first step in
parsing the CSS, there is not much to do at higher levels except for
applying the Rules for handling parsing errors.

>so, to me the only reasonable way of treating this is to assume that
>you are dealing with a comment and proceed on that basis until 
>contradicted, thus causing the whole of the balance of the sheet to be
>eaten, in this case.

I'm not arguing on this - as I said, this is exactly what I would have
expected. However, I want to point out that this expected behaviour is
not the one that is described in the CSS21 Syntax specification.

The issue (resp. issues: see [2]) I have raised may not appeal to CSS
users, but they do to those trying to write a conforming parser. Since
there is no CSS parser reference implementation ([3] received no
replies), it's solely the specification that implementors can consult.
And as such, it should faithfully describe the expected behaviour and
leave no room for interpretation.

I'm really not raising these issues to annoy people on this list, but in
an honest effort to identify possibly insufficiently specified corners or
unexpected consequences of parts of the specification and have them
changed and/or clarified for the benefit of a complete, unambiguous spec.

[1] <http://www.w3.org/TR/CSS21/syndata.html#tokenization>
[2] <http://www.w3.org/mid/20041018160911.7591@mail.visualclick.de>
[3] <http://lists.w3.org/Archives/Public/www-style/2004Aug/0169.html>

Kind regards,
Christian

Received on Saturday, 23 October 2004 14:16:33 UTC