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

[XQuery] Lexical rules for named constructor is wrong

From: Alberto Massari <amassari@progress.com>
Date: Fri, 10 Sep 2004 15:28:41 +0200
Message-Id: <6.1.2.0.2.20040910151021.02a69a08@webmail.bedford.progress.com>
To: public-qt-comments@w3.org

The lexical rules for <"element" "{"> and  <"attribute" "{"> state 
that a double push should occur (pushState(OPERATOR);pushState(DEFAULT)). 
But this is wrong, because this XQuery is not considered valid

<result>
{
	element  {"name"} {"value"}
}
</result>

(the grammar test page says
"Encountered "<" at line 5, column 1.
Was expecting one of:
    "<?" ...
    "<?" ...
    "<![CDATA[" ...
    "<![CDATA[" ...
    <PredefinedEntityRef> ...
    <CharRef> ...
    "<" ...
    "<" ...
    "</" ...
    "{" ...
    "{" ...
    "{{" ...
    "}}" ...
    <ElementContentChar> ...
    "<!--" ...
    "<!--" ...
")

This is the state machine for this expression

Current state		Lexeme  	Next State	Stack

DEFAULT		<		START_TAG	OPERATOR;
START_TAG		result		START_TAG	OPERATOR;
START_TAG		>		ELEMENT_CONTENT	OPERATOR;
ELEMENT_CONTENT	{		DEFAULT		OPERATOR; ELEMENT_CONTENT;
DEFAULT 		element {	DEFAULT 	OPERATOR; ELEMENT_CONTENT; OPERATOR; DEFAULT;
DEFAULT		"name"		OPERATOR	OPERATOR; ELEMENT_CONTENT; OPERATOR; DEFAULT;
OPERATOR		}		DEFAULT		OPERATOR; ELEMENT_CONTENT; OPERATOR;
DEFAULT		{		DEFAULT		OPERATOR; ELEMENT_CONTENT; OPERATOR; OPERATOR;
DEFAULT		"value"		OPERATOR	OPERATOR; ELEMENT_CONTENT; OPERATOR; OPERATOR;
OPERATOR		}		OPERATOR	OPERATOR; ELEMENT_CONTENT; OPERATOR;

The issue is that when the last } is encountered, we should be brought 
back to the ELEMENT_CONTENT state, but there is an extra OPERATOR state 
in the stack that makes the </ being recognized as "less than" instead 
of "end tag"

The proper transition should be "pushState(DEFAULT); DEFAULT"

Alberto
Received on Friday, 10 September 2004 15:16:53 UTC

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