W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2012

Re: [selectors-api] NAMESPACE_ERR or SYNTAX_ERR when both applied

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Sun, 17 Jun 2012 22:29:37 -0400
Message-ID: <4FDE9291.5060903@mit.edu>
To: Anne van Kesteren <annevk@annevk.nl>
CC: "public-webapps@w3.org" <public-webapps@w3.org>
On 6/17/12 9:50 AM, Anne van Kesteren wrote:
> On Jun 17, 2012, at 3:44 PM, Boris Zbarsky<bzbarsky@mit.edu>  wrote:
>> Also probably incompatible with a depth-first recursive descent parser implementation.  Are we sure we want to overconstrain implementations like that?
>
> Incompatible how?

Consider how this is parsed in a depth-first recursive descent parser:

   a|b +,

1)  The identifier "a" is scanned.  This might be a tag name or a
     namespace; look at the next token.
2)  The symbol '|' is scanned.  Great. "a" was a namespace.  Resolve it.

And you're done.  You have an error and bail out.  You never even got to 
the '+'.

-Boris

P.S.  This is basically what the Gecko parser does, afaik.  On the other 
hand, WebKit's parser is breadth-first, again as far as I know: it first 
breaks up the selector on ',', then tries to match the various bits 
against the relevant productions and only after that actually deals with 
the leaf parse nodes.  Hence it actually sees the "missing stuff after 
'+'" error before it ever tries to figure out anything about "a" in there.
Received on Monday, 18 June 2012 02:30:09 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:52 GMT