Re: CSS parser recovery

On Fri, 13 Dec 2002, REFSTRUP,JACOB (HP-Vancouver,ex1) wrote:
>
> p {color: green; /* missing "}" */
> q {color: blue;}
> samp {color:red;}

That should parse as something like (froom memory):

   Selector: p
   Block:
     Declaration:
       Property: 'color'
       Value: 'green'
     Ignored Declaration:
       Comment: ' missing "}" '
       Property: 'q'       
       Block:
         Identifier: 'color'
         Token: ':'
         Identifier: 'blue'
       Identifier: 'samp'
       Block:
         Identifier: 'color'
         Token: ':'
         Identifier: 'red'
   Error: Unexpected EOF (Expected '}')

...and therefore is equivalent to the following stylesheet:

   p { color: green }

The bit from the comment to the end is definitely ignored as being an
unrecognised syntax for a declaration. The spec is extremely clear about
this, I think.

The bit I'm not clear about is whether 'q' gets treated as an identifier
or a property. I think I may be mixing two parts of the parsing process,
and that it would start of as an identifier and then be considered as a
property only if the syntax for that declaration was correct? I'm not
sure. David can probably tell us...

-- 
Ian Hickson                                      )\._.,--....,'``.    fL
"meow"                                          /,   _.. \   _\  ;`._ ,.
http://index.hixie.ch/                         `._.-(,_..'--(,_..'`-.;.'

Received on Friday, 13 December 2002 14:00:56 UTC