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

Re: [XQuery] A.2.2 Lexical Rules: bad transitions

From: <scott_boag@us.ibm.com>
Date: Mon, 26 Jan 2004 01:47:06 -0500
To: Michael Dyck <jmdyck@ibiblio.org>
Cc: public-qt-comments@w3.org
Message-ID: <OF886ECD7F.FC00DB83-ON85256E27.0023B184-85256E27.002532F3@lotus.com>

Hi Michael.  Your last call comment in [1] has been given the ID 
qt-2004Jan0243-01.  This is the official response from the XQuery and XSLT 
working groups.

Your comments have been classified as flagging errors, and the resolution 
as follows.

> ------------------------------------------------------------------------
> Query:   <!---- blah ----> | e
> Query:   <?PITarget ?> | e
> Query:   <![CDATA[x]]> | e
> 
> Problem: In each case, after the ">", the lexer is in DEFAULT, which
>          doesn't recognize "|" (or any other operator).
> 
> Fix:     In DEFAULT, for the transitions on "<!----", "<?", and
 
> "<![CDATA[", change "pushState()" to "pushState(OPERATOR)".

Note: I
> reported this on November 28, 2002 (three versions ago), in
http:
> //lists.w3.org/Archives/Public/public-qt-comments/2002Nov/0105.html


The relevant patterns now "pushState(OPERATOR)" when in non-element 
content, and "pushState"  in the ELEMENT_CONTENT state.  I apologize for 
missing your first comment on this.  The samples you gave have been added 
to the regression tests for the test parser.

> 

Query:   <Q> { typeswitch (e) case e return e default return e } 
> </Q>

Problem: After the "}", the lexer is in OPERATOR, which 
> doesn't
         recognize "</".

Fix:     In DEFAULT, the 
> transition for <"typeswitch" "("> should not
         involve 
> "pushState(OPERATOR)".



<"typeswitch" "("> no longer pushes a state.  The sample you gave has been 
added to the regression tests for the test parser.

> 

Query:   processing-instruction {x} {x}

Problem: Accepting the 
> last "}" causes popState() on an empty stack.

Fix:     In OPERATOR,
> the transition for "{" needs "pushState()".



I believe I have now balanced the "{" "}" push/pops.  This also required 
some fixes to a few of the validate long patterns, so that they no longer 
push.  The sample you gave has been added to the regression tests for the 
test parser.

> 

Query:   declare variable $x as processing-instruction()? 
> external; e

Problem: After the ")", the lexer is in OPERATOR, which
> doesn't
         recognize "?".

Fix:     In ITEMTYPE, the 
> transition for <"processing-instruction" "(">
         should change
> "pushState(OPERATOR)" to
         "pushState(OCCURRENCEINDICATOR)".


Your suggested fix has been made, and the sample query added to the 
regression set.

> 

Query:   declare variable $x  external; e
Query:   declare 
> function Q() external; e

Problem: These leave DEFAULT on the stack.
> It's not clear whether this
         means that the lexer should 
> reject them, but even if not, it's
         still bad form: a lexer 
> with a maximum stack size would be much
         more likely to hit 
> its limit.

Fix:     In DEFAULT, for the transitions on <"declare" 
> "variable" "$">
         and <"declare" "function">, don't 
> "pushState(DEFAULT)".



The extraneous pushes have been removed.

Thank you for raising the comment.  I would be grateful if you would 
confirm that this provides an adequate resolution.

-scott

[1]  
http://lists.w3.org/Archives/Public/public-qt-comments/2004Jan/0243.html
Received on Monday, 26 January 2004 01:47:13 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:16 UTC