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

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 UTC