W3C home > Mailing lists > Public > public-qt-comments@w3.org > August 2008

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

From: <bugzilla@wiggum.w3.org>
Date: Mon, 04 Aug 2008 21:38:46 +0000
To: public-qt-comments@w3.org
Message-Id: <E1KQ7lO-0005w9-Eg@wiggum.w3.org>


--- Comment #11 from Michael Dyck <jmdyck@ibiblio.org>  2008-08-04 21:38:46 ---
(In reply to comment #8)
> <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:

This uses "ambiguous" with not quite its technical meaning, which I don't
think we should do when we're talking about grammars and parsers.
I suggest changing "After ... grammar:" to:
    In some cases, the next token after the slash is insufficient to
    allow a parser to distinguish these two possibilities:

> 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.

I think it would be clearer to change "indicate" to "be" and
"ComparisonExpr" to "operator". (Why say "ComparisonExpr" for "<" and not
"MultiplicativeExpr" for "*"?) And maybe toss in another "either":
    the "*" token and keywords like "union" could be either an operator or
    a NameTest, and the "<" token could be either an operator or the start
    of a DirectConstructor.

(Actually, a keyword token in this context could be something other than an
operator, e.g. the example from comment #7:
    if ($doclevel) then / else /*
But since (a) we don't formally define "operator", and (b) we're about to
disallow that parse anyway, the fix is probably not worth it.)


So, just checking: Under this rule, these queries are all syntax errors:
    /<a div 3
    if ($doclevel) then / else /*
    / is $a
    / instance of document-node(schema-element(x))
    let $doc := / return $doc/*

these are PathExprs:
    /<a div="3"/>

and these are other kinds of Exprs:


(It might be worth putting such examples in the doc.)

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 21:39:19 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:57:24 UTC