- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Mon, 23 Apr 2012 14:46:13 -0700
- To: Simon Sapin <simon.sapin@kozea.fr>
- Cc: Werner Donné <werner.donne@pincette.biz>, www-style@w3.org
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