RE: [XQuery] Comment - Pragma/MUExtension confusion

<scott_boag@us.ibm.com> wrote:
> 
> "Kirmse, Daniel" wrote:
> ...
> > Just for understanding: Could "(Char+ - (Char* ':)' Char*))"
> > actually evaluate to nothing?
> 
> It can't evaluate to nothing. So I guess it should be:
> 
> [152] CommentContents ::= (Char - ':') (Char+ - (Char* ':)' Char*))?

Or

  [152] CommentContents ::= (Char - ':') (Char* - (Char* ':)' Char*))

However, disallowing ':' at the start of CommentContents has a
side-effect that you may not have considered: it would disallow
a comment such as this:

     (: blah (: nested comment :): blah :)

where there is a colon immediately after a nested comment. (Not a
great loss, but an unnecessary restriction, and probably unintended.)

Instead, you could define a comment as

  [149] Comment ::= "(:" (CommentContents | Comment)* - (':' Char*) ":)"

However, it's not clear to me why you would. I mean, *if* you had
decided that the "longest possible match" rule was a kludgey way to
define the XQuery syntax, and you were trying to eliminate the need for
it, then sure, you'd want to express such restrictions in the EBNF
instead. But if the "longest possible match" rule is staying, then why
would you redundantly express some of its restrictions in the EBNF?
(It seems like you might mislead people as to the completeness of the
EBNF.)

-Michael Dyck

Received on Saturday, 4 September 2004 03:03:24 UTC