[Bug 5727] [XQuery] Syntax ambiguities with leading "/"

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


John Snelson <john.snelson@oracle.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |john.snelson@oracle.com




--- Comment #8 from John Snelson <john.snelson@oracle.com>  2008-08-04 13:42:29 ---
The leading-lone-slash grammar can be found here:

http://www.w3.org/TR/xquery/#parse-note-leading-lone-slash

Having looked over the XQuery grammar, I agree with Michael Kay that the only
token that we need to add to this rule is "<". However I think that we can
still firm up the grammar constraint to cover all eventualities. I propose the
following new wording for the constraint:

<new>
A single slash may appear either as a complete path expression or as the first
part of a path expression in which it is followed by a RelativePathExpr.
After a single slash, there are several tokens which have an ambiguous
interpretation according to the grammar: the "*" token and keywords like
"union" could indicate either an operator or a NameTest, and the "<" token
could indicate a ComparisonExpr or the start of a DirectConstructor.
For example, without lookahead the first part of the expression "/ * 5" is
easily taken to be a complete expression, "/ *", which has a very different
interpretation (the child nodes of "/").

Therefore to reduce the need for lookahead, if the token immediately following
a slash can form the start of a RelativePathExpr, then the slash must be the
beginning of a PathExpr, not the entirety of it.

A single slash may be used as the left-hand argument of an operator by
parenthesizing it: "(/) * 5". The expression "5 * /", on the other hand, is
legal without parentheses.
</new>


-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Monday, 4 August 2008 13:43:07 UTC