Re: Malformed declarations incorrectly parsed?

On Sat, 15 Mar 2008, Benjamin Hawkes-Lewis wrote:

> Yves Lafon wrote:
>> The tool is consistent... but it depends on the error case. Lexical errors 
>> are handled with a skip to matching brace,
>
> That doesn't appear to be true.
>
> p { color:red; color:; color:green }
>
> includes a lexical error since "color:;" cannot be parsed as "property ':' S* 
> expr prio?" from:
>
> http://www.w3.org/TR/CSS21/grammar.html#scanner
>
> The validator calls it a "parse error".
>
> If what you were saying were true, the validator would skip to the matching 
> brace, but instead it reports color: green; as valid CSS information.
>
>> Clearly, "skip to matching brace" is useful to recover, but not in line 
>> with the error recovery scheme of the CSS21 spec.
>
> I can see the utility of having no error recovery and I can see the utility 
> of having the error recovery mandated by the spec. I'm hazy on the merits of 
> having a second, undocumented form of error recovery that differs from the 
> spec. It renders the report of "valid CSS information" deceptive.

I dug a bit more in the code, and found the culprit. while skipStatement 
was correctly skipping {} blocks, it was not the case for 
skipAfterExpression (responsible for errors happening when parsing right 
hand side of <prop> : <value>. Now fixed and in place at:

http://qa-dev.w3.org:8001/css-validator/

Note that it is not in sync completely with the error recovery rules 
defined by CSS21 (like on EOF)

-- 
Baroula que barouleras, au tiéu toujou t'entourneras.

         ~~Yves

Received on Monday, 17 March 2008 14:05:06 UTC