[Bug 1382] [XQuery] some editorial comments on A.1.1 grammar-note: occurrence-indicators

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





------- Additional Comments From cmsmcq@w3.org  2005-07-07 03:22 -------
Here is a proposed rewording to make clearer that the
priority rule applies in all cases, not just cases of
ambiguity.

       As written, the grammar in A.1 is ambiguous for some forms
       using the '+' and '*' Kleene operators.  The ambiguity is
       resolved as follows:  these operators are tightly bound
       to the SequenceType expression, and have higher precedence
       than other uses of these symbols. Any occurrence of '+'
       and '*', as well as '?', following a sequence type is
       assumed to be an occurrence indicator.  That is, a 
       "+", "*", or "?" immediately following an ItemType MUST
       be an OccurrenceIndicator.  Thus, "4 treat as
       item() + - 5" MUST be interpreted as (4 treat as item()+) - 5,
       taking the '+' as an OccurrenceIndicator and the
       '-' as a subtraction operator. To force the interpretation
       of "+" as an addition operator (and the corresponding
       interpretation of the "-" as a unary minus), parentheses
       may be used:  the form "(4 treat as item()) + -5" surrounds
       the SequenceType expression with parentheses and leads
       to the desired interpretation.

       This rule has as a consequence that certain forms which
       would otherwise be legal and unambiguous are not
       recognized:  in "4 treat as item() + 5", the "+" is
       taken as an OccurrenceIndicator, and not as an operator,
       which means this is not a legal expression.

Received on Thursday, 7 July 2005 03:22:26 UTC