[XQuery] Lexical rules for named constructor is wrong

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