Re: [CSS21] core grammar doesn't generate example in 4.1.6 Blocks

On Wed, 2009-10-21 at 18:03 +0200, Bert Bos wrote:
> On Wednesday 21 October 2009, Dan Connolly wrote:
> > In 4.1.6 Blocks
> >  http://www.w3.org/TR/CSS2/syndata.html#block
> >
> > this is given as an example of a block:
> >
> >   { causta: "}" + ({7} * '\'') }
> >
> > but it doesn't match the core grammar in 4.1.1,
> > because between ()s can only be any*, and
> > the { token isn't part of any. i.e. any doesn't
> > contain blocks.
> 
> True, but it is marked as illegal already.

This leaves me wondering what is the role of the core syntax,
especially this statement:

  "The meaning of input that cannot be tokenized or parsed is
   undefined in CSS 2.1."

Is the definition of block in 4.1.6 supposed to be a re-statement
of the grammar or an independent definition?

>  The idea is to show that 
> curly braces must be balanced, even in input that is going to be 
> ignored. The rules further down in 4.2 under "malformed declarations" 
> apply: there is an unexpected token in the value of the property

Which part of the spec tells me that the { token is _in_ the
value of the property? Clearly not the core syntax.

>  and 
> thus the property and its value must be ignored. And to know where the 
> value ends, you must know where the block ends.

You seem to be saying "don't confuse the block production with
the definition in 4.1.6; the latter is the real definition of
a block." Well, I am confused. I think the spec is confusing.

If the names of the productions under core syntax get clobbered
by text later in the spec, perhaps the core syntax grammar is
just a distraction.

Another distraction is mixing parsing and tokenization:

  A block starts with a left curly brace ({) and ends with the
  matching right curly brace (}). In between there may be any
  tokens, except that parentheses (( )), brackets ([ ]), and
  braces ({ }) must always occur in matching pairs and may be
  nested. Single (') and double quotes (") must also occur in matching
  pairs, and characters between them are parsed as a string.

The "Single (') and double quotes (") must also occur..."
is parallel to "braces ({ }) must always occur" and so
suggest that single and double quotes are tokens. But
they're not. It's not even strictly true, since
  { "\"" }
is a block but its "s don't all occur in matching pairs.

Perhaps more clear would be:

  A block starts with a left curly brace ({) and ends with the
  matching right curly brace (}). In between there may be any
  tokens, except that parentheses (( )), brackets ([ ]), and
  braces ({ }) must always occur in matching pairs and may be
  nested. (Note that tokenization ensures matching of single (') and
  double quotes (") in strings.)



-- 
Dan Connolly, W3C http://www.w3.org/People/Connolly/
gpg D3C2 887B 0F92 6005 C541  0875 0F91 96DE 6E52 C29E

Received on Wednesday, 21 October 2009 16:46:10 UTC