[Bug 1378] [XQuery] some editorial comments on A.1.1 grammar-note: leading-lone-slash

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





------- Additional Comments From cmsmcq@w3.org  2005-07-07 01:31 -------
For what it's worth, I agree that this note should probably be
reworded.  On the other hand, I have some isuses with the 
rewording proposed in Bug 1390.

Working partly from the current text, partly from this comment,
and partly from the proposal in bug 1390, I produce this sketch,
for what it's worth:

   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 RelativePathExpression, which can take the form
   of a NameTest ("*" or a QName).  In contexts where operators
   like "*", "union", etc., can occur, parsers may have
   difficulty distinguishing operators from NameTests.  For
   example, without lookahead the first part of the expression "/
   * 5", for example is easily taken to be a complete expression,
   "/ *", which has a very different interpretation (the child
   nodes of "/").

   [Optionally display the two parse trees from bug 1390 here.]

   To reduce the need for lookahead, therefore, if the token
   immediately following a slash is "*" or a keyword, then the
   slash must be the beginning, but not the entirety, of a
   PathExpression (and the following token must be a NameTest,
   not an operator).

   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.

This is longer and clumsier than I'd like, and could use a
cold-eyed revision by a merciless editor.  But I offer it
as a possible improvement.

Received on Thursday, 7 July 2005 01:31:55 UTC