Re: [css3-syntax] non-preserved tokens

On Sun, Nov 25, 2012 at 9:04 PM, Cameron McCormack <cam@mcc.id.au> wrote:
> css3-syntax says that a primitive is a preserved token, a function or a
> simple block, and that a preserved token is any except for:
>
>   function, bad-string, bad-url, [, (, {
>
> In the tree construction algorithm, often the "consume a primitive"
> definition is invoked, and that doesn't say what to do with a token that
> isn't a primitive.
>
> For example if my style sheet is:
>
> <style>@supports (font-family:'Helvetica
> ){}</style>
>
> this would generate the following sequence of tokens:
>
>   at-keyword
>   whitespace
>   (
>   ident
>   colon
>   bad-string
>   whitespace
>   )
>   {
>   }
>   end-of-file
>
> which will result in the tree construction algorithm being in the "at-rule
> prelude" mode when it encounters the bad-string.  In that mode, the
> "anything else" branch is chosen, which says to "consume a primitive", and
> in those steps the last branch is chosen, which is just "return the current
> input token", even though the token is not a preserved token (or a
> primitive).  This contradicts the note earlier in section 3.5 that says only
> preserved tokens will be in the output tree.

You're right!  Bad me.  I already need to do a review and fix up the
places where EOF isn't properly handled in tree-construction; I'll
make sure to handle non-preserved tokens as well.

~TJ

Received on Monday, 26 November 2012 18:16:53 UTC