<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>29501</bug_id>
          
          <creation_ts>2016-02-23 16:34:12 +0000</creation_ts>
          <short_desc>[xp31] syntactic problems around the colon of a MapConstructorEntry</short_desc>
          <delta_ts>2016-04-25 21:34:53 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>XPath 3.1</component>
          <version>Candidate Recommendation</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Kay">mike</reporter>
          <assigned_to name="Jonathan Robie">jonathan.robie</assigned_to>
          <cc>andrew_coleman</cc>
    
    <cc>jmdyck</cc>
    
    <cc>josh.spiegel</cc>
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>125237</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-02-23 16:34:12 +0000</bug_when>
    <thetext>The list of non-terminal symbols in A.2.2 does not include colon, which is present in the syntax of MapConstructor.

It would seem to make sense to make it a delimiting terminal symbol, and to treat it like &quot;.&quot; and &quot;-&quot; as an exception case (see last para of the section) where a symbol separator is needed if the character follows an NCName. Whether it also needs a symbol separator if it follows a prefixed QName is an open question.

These choices would invalidate a number of test cases recently added to the MapConstructor test set: for example MapConstructor-029 uses map{*:b:b} where not only the parser but also the human reader can otherwise be easily misled into an incorrect reading.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>125238</commentid>
    <comment_count>1</comment_count>
    <who name="Josh Spiegel">josh.spiegel</who>
    <bug_when>2016-02-23 16:44:56 +0000</bug_when>
    <thetext>I agree that a constraint should be added to require a separator when &quot;:&quot; follows NCName. 

It seems &quot;:&quot; is already a delimiting symbol - it is identified in the list as &quot;(colon)&quot;.  

However, I don&apos;t see why it should require a separator if &quot;:&quot; follows a QName.  If we don&apos;t do this, then MapConstructor-029 should still pass.  i.e.

   map{*:b:b}

Is equivalent to:

   map{(*:b) : b}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>125239</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-02-23 16:48:48 +0000</bug_when>
    <thetext>Benito pointed out that I didn&apos;t read carefully enough. The list does include &quot;:&quot; (written out as (colon), for some reason).

The other comment, about treating it like &quot;.&quot; and &quot;-&quot;, remains.

We do have a note in 3.11.1.1

Note:

In some circumstances, it is necessary to include whitespace before or after the colon to ensure that this grammar is correctly parsed; this arises for example when the MapKeyExpr ends with a name and the MapValueExpr starts with a name.

But it&apos;s a Note, it&apos;s very unspecific about what the exact rules are, and it&apos;s in the wrong place.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>125240</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-02-23 17:00:21 +0000</bug_when>
    <thetext>MapConstructor-029 is actually quite interesting, because the wildcard *:b is not one terminal symbol, but three (even though whitespace is not allowed). If it were one terminal symbol, then it would be chosen in preference to &quot;*&quot; by the &quot;longest token&quot; rule. But it isn&apos;t, so one could legitimately argue:

Given the input *:b:b

(a) the first token is unambiguously &quot;*&quot;

(b) the second token is unambiguously &quot;:&quot;

(c) the third token can be either the NCName &quot;b&quot; or the QName &quot;b:b&quot;. Both are &quot;consistent with the EBNF&quot; in the sense that there is a grammatical production that accepts this token as a continuation - a Wildcard accepts the NCName, while a MapConstructorEntry accepts the QName. The QName is longer, so this should be chosen, meaning that the construct parses as map{*: (b:b)}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>125242</commentid>
    <comment_count>4</comment_count>
    <who name="Josh Spiegel">josh.spiegel</who>
    <bug_when>2016-02-23 17:47:56 +0000</bug_when>
    <thetext>Yes, it seems that simply requiring a separator when colon follows NCName also breaks this wildcard.  

  foo:*</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>125312</commentid>
    <comment_count>5</comment_count>
    <who name="Josh Spiegel">josh.spiegel</who>
    <bug_when>2016-03-01 19:36:56 +0000</bug_when>
    <thetext>Setting aside &quot;how&quot; for a moment, I would like the specification to clarify the meaning of these queries:

(1)  map{a:b:c}
(2)  map{*:b:c}
(3)  map{a:*:c}

The W3C applets currently identify these key expressions:

(1)  a:b
(2)  *:b
(3)  a:*

My implementation gives the same answers.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>125314</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-03-01 21:21:33 +0000</bug_when>
    <thetext>I agree that if these three expressions are allowed, then they should have the meanings described. I was very surprised by the discovery that the &quot;longest token&quot; rule currently leads to *:a:b parsing as * : a:b

But I think my preference is probably to impose restrictions requiring the use of whitespace - I think that reduces the risk of users writing something they didn&apos;t intend. Again, I&apos;m not sure exactly what the rule should be. Part of it is probably that (like &quot;-&quot; and &quot;.&quot;) &quot;:&quot; as a token is not allowed immediately after an NCName (including an NCName that is part of a QName). That leaves questions about &quot;:&quot; after &quot;*&quot;.

We might find that the grammar works better if we define wildcards using composite tokens &quot;*:&quot; and &quot;:*&quot;, or even if we make wildcards (like QNames) into single tokens.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>125315</commentid>
    <comment_count>7</comment_count>
    <who name="Josh Spiegel">josh.spiegel</who>
    <bug_when>2016-03-01 21:55:34 +0000</bug_when>
    <thetext>&gt; We might find that the grammar works better if we define wildcards using composite tokens &quot;*:&quot; and &quot;:*&quot;, 

I like this.  It would be a simple fix and have a small editorial impact.

&gt; or even if we make wildcards (like QNames) into single tokens.

My implementation arrives at the answers in comment 5 because it already does this.  I don&apos;t this distinction mattered until map constructors were added (notice, ws:explicit is in effect for Wildcard).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126041</commentid>
    <comment_count>8</comment_count>
    <who name="Andrew Coleman">andrew_coleman</who>
    <bug_when>2016-04-22 08:31:08 +0000</bug_when>
    <thetext>At the meeting on 2016-04-19, the WG discussed the options presented in https://lists.w3.org/Archives/Public/public-xsl-query/2016Mar/0035.html (action A-635-03).

It was decided to adopt option 2b.  The change to appendix A, the applet and the test cases will be tracked by action A640-02</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>