Re: Grammatical ambiguity in namespaces draft

"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 UTC