[Bug 4176] [UPD] Syntax "do rename ... as ..." problematic with tokenization

http://www.w3.org/Bugs/Public/show_bug.cgi?id=4176


scott_boag@us.ibm.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |scott_boag@us.ibm.com




------- Comment #5 from scott_boag@us.ibm.com  2007-01-31 16:06 -------
Irrespecitive of proposals for new syntax such as rename(a, b), the current
syntax does not seem to have an ambiguity problem, as far as I can tell.  

"Building a Tokenizer for XPath or XQuery"
(http://www.w3.org/TR/xquery-xpath-parsing/ was supposed to be marked as
obsolete.  That it's not is probably my fault.  I know someone had an action
from a working group meeting to do so.  We were running into certain brick
walls with trying to do lexical-based disambiguation, which is why we dropped
much of the lexical state machine in the test parser in favor of a lookahead
mechanism (http://www.w3.org/2006/11/applets/xqueryApplet.html ... I can send
you an xquery-update version of this, including .jjt file), and made the note
obsolete.

I think you are saying that something like:

do rename foo treat as element() as baz

or 

do rename let $x as element() := foo return $x as baz

They are not ambiguous as the first is clearly associated with the "treat", and
the second more stand-alone "as" only occurs within limited defined contexts
which expects a type declaration or a non-default thing such as ":=" or "," or
"{".  Lexicially, they don't have to be distinguished... they can be the same
token.  I don't think you actually need lookahead for this.   The test parser
evaluates both expressions correctly.

Received on Wednesday, 31 January 2007 16:06:17 UTC