Re: [css3-page] Error in grammar of section 3.4.1

On Mon, Apr 23, 2012 at 11:39 AM, Simon Sapin <simon.sapin@kozea.fr> wrote:
> Alternatively, we could define the syntax in terms of a state machine rather
> that a grammar, as Tab is doing in css3-syntax. (This is apparently a better
> fit for the precise rules of error handling.)

Best of all is to stop defining almost anything in terms of low-level
tokens - the tokenizer itself handles those.  Instead, we should just
introduce a few more higher-level tokens that can be used to define
at-rules in a similar fashion to properties.

For example, @page could be defined as:

@page <page-selector>? { [ <margin-rule> | <declaration> ]* }
<page-selector> is compound selector with type selector and/or page
pseudo-class (:first, :left, :right), type selector can be anything
but "auto".
<declaration> matches the declaration production in the current CSS2.1
grammar, but capped with a ';' token at the end.
<margin-rule> = @<foo> { <declaration>* } where <foo> is "left", "right", etc.

I expect to define a bunch of these useful tokens in Syntax, and
redefine all the current at-rules in terms of this higher-level
grammar.

~TJ

Received on Monday, 23 April 2012 21:47:02 UTC