This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 1382 - [XQuery] some editorial comments on A.1.1 grammar-note: occurrence-indicators
Summary: [XQuery] some editorial comments on A.1.1 grammar-note: occurrence-indicators
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQuery 1.0 (show other bugs)
Version: Last Call drafts
Hardware: All All
: P2 minor
Target Milestone: ---
Assignee: Scott Boag
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard: grammar
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-11 07:34 UTC by Michael Dyck
Modified: 2007-02-25 23:52 UTC (History)
0 users

See Also:


Attachments

Description Michael Dyck 2005-05-11 07:34:58 UTC
A.1.1 grammar-note: occurrence-indicators

[See a later comment for suggested alternate wording.]

"Any occurrence of '+' and '*', as well as '?', following a sequence type is
assumed to be an occurrence indicator."
    Even when the only possible derivation says it's not an occurrence
    indicator?  So in
        4 treat as item() + 5
    the '+' is assumed to be an occurrence indicator, which would then lead to a
    syntax error? Probably yes, but might be good to say so.
Comment 1 Scott Boag 2005-05-17 15:52:42 UTC
> Even when the only possible derivation says it's not an occurrence
> indicator?  So in
>       4 treat as item() + 5
> the '+' is assumed to be an occurrence indicator, which would then lead to a
> syntax error? Probably yes, but might be good to say so.

Yes, and it does say so.  But it could be clarified, along with an example.
Comment 2 C. M. Sperberg-McQueen 2005-07-07 03:22:24 UTC
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.

Comment 3 Scott Boag 2005-07-09 05:17:51 UTC
(In reply to comment #2)
> Here is a proposed rewording to make clearer that the
> priority rule applies in all cases, not just cases of
> ambiguity.

I've adapted your rewording.
Comment 4 Scott Boag 2005-07-22 19:36:34 UTC
A joint meeting of the Query and XSLT working groups considered this comment on 
July 20, 2005.  

The WGs agreed to resolve these editorial issues as listed in my previous comment.

If you do not agree with this resolution, please add a comment explaining why.
If you wish to appeal the WG's decision to the Director, then change the Status
of the record to Reopened. If we do not hear from you in the next two weeks, we
will assume you agree with the WG decision.
Comment 5 Jim Melton 2007-02-25 23:52:53 UTC
Closing bug because commenter has not objected to the resolution posted and more than two weeks have passed.