<?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>1882</bug_id>
          
          <creation_ts>2005-08-23 09:55:57 +0000</creation_ts>
          <short_desc>comment syntax</short_desc>
          <delta_ts>2005-09-29 12:55:14 +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 2.0</component>
          <version>Last Call drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows XP</op_sys>
          <bug_status>CLOSED</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="David Carlisle">davidc</reporter>
          <assigned_to name="Scott Boag">scott_boag</assigned_to>
          
          
          <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>5488</commentid>
    <comment_count>0</comment_count>
    <who name="David Carlisle">davidc</who>
    <bug_when>2005-08-23 09:55:57 +0000</bug_when>
    <thetext>The Xquery Test file

 Queries/XQuery/Expressions/Operators/CompExpr/GenComprsn/
                           GenCompEq/generalexpression12.xq

Has what is apparently a malformed comment

(:  operand2 = empty sequence)
                             ^
(:*******************************************************:)

and the test parser applet and saxon both report a parse error on this file.
I was going to raise a bug under the test suite but the grammar for comments
is
[154] Comment         ::= &quot;(:&quot; (CommentContents | Comment)* &quot;:)&quot;
[155] CommentContents ::= (Char+ - (Char* &apos;:)&apos; Char*))

note that [155] is any string of characacters that don&apos;t include an
_end_ marker. As such it would appear that

  operand2 = empty sequence)
(:*******************************************************

matches CommentContents  and so 

(:  operand2 = empty sequence)
(:*******************************************************:)

is a valid (single) comment. It would appear that [155] is in error and should
forbid a comment start rather than a comment end:

[155] CommentContents ::= (Char+ - (Char* &apos;(:&apos; Char*))
                                            ^^
          
which would then force a nested (: to be parsed as a nested Comment as allowed
by [154]. (And the test file would then be in error and require 

(:  operand2 = empty sequence)

changing to

(:  operand2 = empty sequence:)

David</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>5562</commentid>
    <comment_count>1</comment_count>
    <who name="Paul Cotton">pcotton</who>
    <bug_when>2005-08-29 16:39:34 +0000</bug_when>
    <thetext>Changing Component to XPath since this impacts both XQuery and XPath.

/paulc</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>5582</commentid>
    <comment_count>2</comment_count>
    <who name="C. M. Sperberg-McQueen">cmsmcq</who>
    <bug_when>2005-08-30 16:33:30 +0000</bug_when>
    <thetext>Good catch.  But I think the new rule should continue to
forbid comment-end delimiters, otherwise we risk recreating
the mirror image of this problem.

I think:

[155] CommentContents ::= (Char+ - (Char* (&apos;(:&apos;|&apos;:)&apos;) Char*))

(although i am not sure why the first token on the RHS is
Char+ instead of Char*.  By the current rule, (::) is not
a legal comment, which seems restrictive.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>5594</commentid>
    <comment_count>3</comment_count>
    <who name="David Carlisle">davidc</who>
    <bug_when>2005-08-31 09:58:42 +0000</bug_when>
    <thetext>Yes, I was going to send a follow on saying to catch (: and :).

However seing as most regex engines don&apos;t (I think) have this &quot;subtraction&quot;
syntax, and people might want to find comments with regex tools it might be
simpler to give an additive definition rather than a subtractive one.

Basically CommentContents is a run of 
any character other than : or (
or 
: followed by not-(
or
( followed by not-:

That is:

([^:\(]|\([^:]|:[^\)*

or in your EBNF syntax

(((Char - &quot;:&quot;) - &quot;(&quot;) | (&quot;(&quot; (Char - &quot;:&quot;)) | (&quot;:&quot; (Char - &quot;)&quot;)))*

&gt; (although i am not sure why the first token on the RHS is
&gt; Char+ instead of Char*.

I noticed that, I suspect it&apos;s a hang over from the earlier draft&apos;s (:: pragma
syntax.

David

(I assume I don&apos;t need to open a bugzilla entry on the  test suite
generalexpression12.xq)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>5625</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2005-08-31 21:58:24 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt;
&gt; Basically CommentContents is a run of 
&gt; any character other than : or (
&gt; or 
&gt; : followed by not-(
&gt; or
&gt; ( followed by not-:

You mean &quot;: followed by not-)&quot;. (Which is what you say in the regex and EBNF.)

&gt; That is:
&gt; 
&gt; ([^:\(]|\([^:]|:[^\)*
&gt; 
&gt; or in your EBNF syntax
&gt; 
&gt; (((Char - &quot;:&quot;) - &quot;(&quot;) | (&quot;(&quot; (Char - &quot;:&quot;)) | (&quot;:&quot; (Char - &quot;)&quot;)))*

Note that these exclude a CommentContents ending in &quot;(&quot; or &quot;:&quot;, which is not
excluded by the current EBNF or the EBNF proposed in Comment #2.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>5626</commentid>
    <comment_count>5</comment_count>
    <who name="David Carlisle">davidc</who>
    <bug_when>2005-08-31 22:08:32 +0000</bug_when>
    <thetext>&gt; Note that these exclude a CommentContents ending in &quot;(&quot; or &quot;:&quot;, which is not
&gt; excluded by the current EBNF or the EBNF proposed in Comment #2.

sorry, yes that would be a (fixable) bug in my expressions.
Not sure whether it&apos;s worth fixing or to stick with the subtraction originally
proposed?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>6508</commentid>
    <comment_count>6</comment_count>
    <who name="Scott Boag">scott_boag</who>
    <bug_when>2005-09-27 16:43:03 +0000</bug_when>
    <thetext>Changed EBNF to:
[85] CommentContents ::= (Char+ - (Char* (&apos;(:&apos; | &apos;:)&apos;) Char*))</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>