[Bug 1882] New: comment syntax

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

           Summary: comment syntax
           Product: XPath / XQuery / XSLT
           Version: Last Call drafts
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery
        AssignedTo: chamberl@almaden.ibm.com
        ReportedBy: davidc@nag.co.uk
         QAContact: public-qt-comments@w3.org


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         ::= "(:" (CommentContents | Comment)* ":)"
[155] CommentContents ::= (Char+ - (Char* ':)' Char*))

note that [155] is any string of characacters that don'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* '(:' 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

Received on Tuesday, 23 August 2005 10:08:36 UTC