- From: Kirmse, Daniel <daniel.kirmse@sap.com>
- Date: Thu, 2 Sep 2004 08:42:01 +0200
- To: "'scott_boag@us.ibm.com'" <scott_boag@us.ibm.com>
- Cc: "'public-qt-comments@w3.org'" <public-qt-comments@w3.org>
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 06:42:46 UTC