W3C home > Mailing lists > Public > public-qt-comments@w3.org > September 2004

Re: [XQuery] Comment - Pragma/MUExtension confusion

From: <scott_boag@us.ibm.com>
Date: Wed, 1 Sep 2004 14:25:14 -0400
To: "Kirmse, Daniel" <daniel.kirmse@sap.com>
Cc: "'public-qt-comments@w3.org'" <public-qt-comments@w3.org>
Message-ID: <OF441ED5A3.52ACDE83-ON85256F02.00635BF3-85256F02.00653053@lotus.com>

Hi Daniel.  Please bear with me, as I'm not 100% sure I understand your 
issue.

I would think the longest token rule covers your examples.  "When 
tokenizing, the longest possible match that is valid in the current 
lexical state is preferred ."  (A.2 Lexical structure).   So:

 "(: :)"   ...is a valid comment
"(::)"      ...is not valid (ill-formed pragma or extension)
"(: ::)"   ...is a valid comment (with a space and ":" char within it)
"(:: :)"   ...is not valid (ill-formed pragma or extension)
"(::::)"   ...is not valid (ill-formed pragma or extension)
"(:::)"    ...is not valid (ill-formed pragma or extension)

No look-ahead should be required.

Please let me know if I've addressed your issue, or misunderstood it.

-scott

public-qt-comments-request@w3.org wrote on 09/01/2004 04:59:55 AM:

> Hi,
> I found a disturbing thing in the XQuery grammar. Consider these 
productions:
> [146]    Pragma    ::=    "(::" S? "pragma" S QName (S 
> ExtensionContents)? "::)" /* ws: explicit */ 
> [147]    MUExtension    ::=    "(::" S? "extension" S QName (S 
> ExtensionContents)? "::)" /* ws: explicit */ 
> [148]    ExtensionContents    ::=    (Char* - (Char* '::)' Char*)) 
> [149]    Comment    ::=    "(:" (CommentContents | Comment)* ":)" /*
> ws: explicit */ 
>     /* gn: comments */ 
> [150]    CommentContents    ::=    (Char+ - (Char* ':)' Char*))
> The XQuery Expression "(: :)" is a valid comment, even so the 
> expression (::) because no whitespace is required by production 
> [149]. The example parser on http://www.w3.
> org/2004/08/applets/xqueryApplet.html however returns an "Lexical 
> error at line 1, column 4.  Encountered: ")" (41), after : """. 
> Obviously it thinks to have found the begin of a Pragma or MUExtension.
> The expression "(::::)" is as valid a comment as "(:::)". To be honest I 

> claim each Pragma or MUExtension would make up a valid comment as long 
as 
> ":)" is not part of it. First I thought it would be a case of 
> lookahead 1 vs. lookahead 2. But no. It rather looks like a serious 
> problem that no lookahead possibly could resolve. As long as a ":" 
> is a valid character inside a comment (only the sequence ":)" is 
> forbidden) only a human being could tell a comment from a Pragma or 
> MUExtension. 
> Either there is a serious problem in the grammar or I made myself a 
> complete idiot. I'm not sure which would relief me more.
> What is the resolution of this?
> Cheers,
> Daniel
Received on Wednesday, 1 September 2004 18:25:54 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:56:59 UTC