W3C home > Mailing lists > Public > www-style@w3.org > April 2000

Re: Grammatical ambiguity in namespaces draft

From: Peter S. Linss <peter@linss.com>
Date: Sun, 09 Apr 2000 01:02:57 -0700
Message-ID: <38F03930.46AA727A@linss.com>
To: "L. David Baron" <dbaron@fas.harvard.edu>
CC: www-style@w3.org


"L. David Baron" wrote:

> The working draft on namespaces in CSS [1] extends attribute selectors
> by allowing namespace qualifiers on attribute names, separated by '|'.
> This creates an ambiguity that I think (?) does not exist elsewhere in
> the CSS grammar.

Actually a similar issue also exists in element selector parsing with
namespaces. Once you have parsed the first token, you don't know if it is an
element selector or a namespace prefix until you look at the next token (ie.
is a '|' following?). CSS1 & CSS2 generally don't require this kind of
look-ahead (although it does help some implementations in some places).

> Once a CSS parser has parsed a selector up to
>
> [ident|
>
> it isn't yet clear whether a hyphen-separated attribute selector or an
> attribute with a namespace is being parsed.  The selector could be one
> of (among others):
>
> [ident|ident="value"]
> [ident|="value"]
>
> Is this a bad thing?

Yes and no. It requires a one token look ahead during parsing which is
something new and is also something that has been historically avoided (I
believe to make it easier to use generated parsers to parse CSS). However,
the reality is that no major CSS parser implementation actually uses a
generated parser, so this functionality is trivial to add. The working group
has discussed this issue, and when I last heard about it, it was decided to
accept the parsing issue because it allowed a more logical "human readable"
namespace syntax (and it looks more like namespaces in XML). Although if
someone can propose a namespace syntax which isn't cumbersome for humans and
doesn't require parser look-ahead it would be welcomed (though it needs to
be real soon...)

Peter

>
>
> -David
>
> [1] http://www.w3.org/TR/css3-namespace/
>
> L. David Baron    Sophomore, Harvard (Physics)    dbaron@fas.harvard.edu
> Links, SatPix, CSS, etc.     <URL: http://www.fas.harvard.edu/~dbaron/ >
> WSP CSS AC                      <URL: http://www.webstandards.org/css/ >



Received on Sunday, 9 April 2000 04:03:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:04 GMT