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

Re: [XQuery] A.1.1 Grammar Notes: parens

From: Michael Dyck <jmdyck@ibiblio.org>
Date: Mon, 16 Feb 2004 11:19:18 -0800
To: public-qt-comments@w3.org
Message-id: <403117B6.7FA4EE47@ibiblio.org>

Michael Kay wrote:
> I can't see why the note is there at all. Distinguishing "(" from "(:"
> is no different from distinguishing "<" from "<<" or child:x from
> child::x.

It isn't exactly a matter of distinguishing "(" from "(:". The note is
there (I imagine) because, given the input
    address (: this may be empty :)
A.2's "longest possible match" rule forces the A.2.2 machine to prefer
the pattern
    <QName "(">
(which will lead to a lexer error) over the pattern
(which wouldn't). Since presumably this input should be considered
valid, some way had to be found to get the machine to prefer the shorter
pattern. I guess this extra lookahead is supposed to achieve that,
though exactly how it fits into the operation of the machine is unclear.

(An alternative would have been to add a pattern
    <QName "(:">
with a transition of "EXPR_COMMENT; pushState(OPERATOR)", but:
(a) I think you'd have to add about 17 more transitions to handle
    similar cases, and
(b) it would wreak havoc with the EBNF.)

-Michael Dyck
Received on Monday, 16 February 2004 14:21:57 UTC

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