- From: Kirmse, Daniel <daniel.kirmse@sap.com>
- Date: Thu, 2 Sep 2004 17:19:36 +0200
- To: "'scott_boag@us.ibm.com'" <scott_boag@us.ibm.com>
- Cc: "'public-qt-comments@w3.org'" <public-qt-comments@w3.org>
Well, I admit this looks a bit more complicated but I'd prefer it anyhow for the grammar being correct w/o annotations like 'longest possible match' and alike. Just for understanding: Could "(Char+ - (Char* ':)' Char*))" actually evaluate to nothing? In order to allow comments with exactly one non-":"-character in it? Somehow I struggle with this kind of notation ... Daniel -----Original Message----- From: scott_boag@us.ibm.com [mailto:scott_boag@us.ibm.com] Sent: Donnerstag, 2. September 2004 17:07 To: Kirmse, Daniel Cc: 'public-qt-comments@w3.org' Subject: RE: [XQuery] Comment - Pragma/MUExtension confusion That's more than a cosmetic change, and would disallow things like "(:?:)", which are perfectly reasonable. Maybe: [151] Comment ::= "(:" (CommentContents | Comment)+ ":)" Then restrict CommentContents from having ":" as the first character. [152] CommentContents ::= (Char - ':') (Char+ - (Char* ':)' Char*)) ...is the medicine worse than the ailment? -scott "Kirmse, Daniel" <daniel.kirmse@sap.com> wrote on 09/02/2004 02:42:01 AM: > Hi Scott, > > lookahead wasn't realy an issue in that. It's more about ambiguity > of productions. However, considering this longest possible match > rule the issue could be covered from a parsers point of view. I'll > follow this rule for my implementation. > The concerns still remain, though. Because from a users point of > view even (::) would be a perfectly correct comment according to > grammar production [149]. So my confusion arose from that. Looks > like [149] rather should be like this: > > [149] Comment :== "(:" S (CommentContents | Comment)* ":)" /* ws:explicit */ > > To avoid this kind of confusion. > > Cheers, > Daniel > > -----Original Message----- > From: public-qt-comments-request@w3.org [mailto:public-qt-comments- > request@w3.org] On Behalf Of scott_boag@us.ibm.com > Sent: Mittwoch, 1. September 2004 20:26 > To: Kirmse, Daniel > Cc: 'public-qt-comments@w3.org' > Subject: Re: [XQuery] Comment - Pragma/MUExtension confusion > > > 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 Thursday, 2 September 2004 15:20:20 UTC