Re: Core syntax error handling

On Thu, 27 Feb 2003, Etan Wexler wrote:
>>
>> At a basic level it is very simple: you hit an unexpected character, and
>> therefore parse the declaration as an unknown stream of tokens, honouring
>> the nesting of {}, [], and (), and the special rules for '' and ""
>> strings, and /* */ comments, until you reach the end of the declaration
>> or the end of the block.
>
> What declaration?

In my book, a declaration is a stream of tokens found in a a block, ending
with a semicolon or the end of the block.


> What block?

A stream of tokens delimited by { and }.


> These constructs have clear syntactic definitions and the case you
> describe does not match those definitions. Any parsing past the
> unexpected character is really just guessing on the part of the parser.

But it doesn't have to be. David Baron is doing some great work in the
Syntax module defining the core syntax and the CSS3 syntax in such a way
that any character stream is parseable.


> If you write a new syntax, we will at least have some basis from
> which to consider dropping the old core syntax, despite the
> latter's promise of indefinite longevity and stability.

The new syntax would simply be increasing the range of files that can be
considered valid CSS, so I do not see a problem here. No UA throws out
entire stylesheets just because they don't match the core grammar; instead
they all do the same as they did with HTML: They follow proprietary rules
to recover from errors. I do _not_ want to see a repeat of the HTML Tag
Soup nightmare repeated with CSS, and I don't want to go down the route of
XML (parse or die).

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

Received on Thursday, 27 February 2003 08:47:24 UTC