2004-08-31 Atsushi Enomoto <atsushi@ximian.com>
[mono.git] / mcs / class / System.XML / System.Xml.Query / XQueryParser.jay
index fc9971760737419ec7a2baee37c251353ef9e1fc..48490132d75035741a9e705313c05a884922c102 100755 (executable)
@@ -373,6 +373,7 @@ namespace Mono.Xml.XQuery.Parser
 %token END_TAG_START // "</". Its appearance depends on the context
 %token ATT_VALUE_LITERAL
 %token ELEM_CONTENT_LITERAL
+%token EXT_CONTENT
 %token APOS                    "'"
 //%token APOS2                 "''"
 %token QUOT                    //""""
@@ -809,7 +810,7 @@ FunctionDecl // returns FunctionDeclaration
        {
                $$ = new FunctionDeclaration (
                        (XmlQualifiedName) $4,
-                       (FunctionParamList) $6,
+                       (XQueryFunctionArgumentList) $6,
                        (SequenceType) $9,
                        (EnclosedExpr) $10);
        }
@@ -859,34 +860,37 @@ OccurenceIndicator // returns Occurence
        }
        ;
 
-OptionalParamList
+OptionalParamList // returns XQueryFunctionArgumentList
        : // empty
+       {
+               $$ = new XQueryFunctionArgumentList ();
+       }
        | ParamList
        ;
 
-ParamList // returns FunctionParamList 
+ParamList // returns XQueryFunctionArgumentList 
        : Param
        {
-               FunctionParamList pl = new FunctionParamList ();
-               pl.Add ((FunctionParam) $1);
+               XQueryFunctionArgumentList pl = new XQueryFunctionArgumentList ();
+               pl.Add ((XQueryFunctionArgument) $1);
                $$ = pl;
        }
        | Param COMMA ParamList
        {
-               FunctionParamList pl = (FunctionParamList) $3;
-               pl.Insert (0, (FunctionParam) $1);
+               XQueryFunctionArgumentList pl = (XQueryFunctionArgumentList) $3;
+               pl.Insert (0, (XQueryFunctionArgument) $1);
                $$ = pl;
        }
        ;
 
-Param // returns FunctionParam 
+Param // returns XQueryFunctionArgument 
        : DOLLAR {
                tokenizer.State = ParseState.VarName;
          } VarName {
                tokenizer.State = ParseState.Operator;
          } OptionalTypeDeclaration
        {
-               $$ = new FunctionParam ((XmlQualifiedName) $3, (SequenceType) $5);
+               $$ = new XQueryFunctionArgument ((XmlQualifiedName) $3, (SequenceType) $5);
        }
        ;
 
@@ -940,7 +944,7 @@ FLWORExpr // returns FLWORExpr
          } ExprSingle
        {
                ForLetClauseCollection col = (ForLetClauseCollection) $1;
-               $$ = new FLWORExpr (col, (ExprSequence) $2, (OrderSpecList) $3, (ExprSingle) $5);
+               $$ = new FLWORExpr (col, (ExprSequence) $2, (OrderSpecList) $3, (ExprSingle) $6);
        }
        ;
 
@@ -1489,13 +1493,13 @@ AdditiveExpr
                tokenizer.State = ParseState.Default;
          } AdditiveExpr
        {
-               $$ = new ArithmeticOperationExpr ((ExprSingle) $1, (ExprSingle) $4, ArithmeticOperator.Plus);
+               $$ = new ArithmeticOperationExpr ((ExprSingle) $1, (ExprSingle) $4, ArithmeticOperator.Add);
        }
        | MultiplicativeExpr MINUS {
                tokenizer.State = ParseState.Default;
          } AdditiveExpr
        {
-               $$ = new ArithmeticOperationExpr ((ExprSingle) $1, (ExprSingle) $4, ArithmeticOperator.Minus);
+               $$ = new ArithmeticOperationExpr ((ExprSingle) $1, (ExprSingle) $4, ArithmeticOperator.Sub);
        }
        ;
 
@@ -1618,11 +1622,11 @@ PathExpr // returns PathExpr
        }
        | Slash RelativePathExpr
        {
-               $$ = new PathChildExpr (new PathRootExpr (), (ExprSingle) $2);
+               $$ = new PathSlashExpr (new PathRootExpr (), (ExprSingle) $2);
        }
        | Slash2 RelativePathExpr
        {
-               $$ = new PathDescendantExpr (new PathRootExpr (), (ExprSingle) $2);
+               $$ = new PathSlash2Expr (new PathRootExpr (), (ExprSingle) $2);
        }
        | RelativePathExpr
        ;
@@ -1631,11 +1635,11 @@ RelativePathExpr // returns PathExpr
        : StepExpr
        | StepExpr Slash RelativePathExpr
        {
-               $$ = new PathChildExpr ((ExprSingle) $1, (ExprSingle) $3);
+               $$ = new PathSlashExpr ((ExprSingle) $1, (ExprSingle) $3);
        }
        | StepExpr Slash2 RelativePathExpr
        {
-               $$ = new PathDescendantExpr ((ExprSingle) $1, (ExprSingle) $3);
+               $$ = new PathSlash2Expr ((ExprSingle) $1, (ExprSingle) $3);
        }
        ;
 
@@ -1756,7 +1760,7 @@ AbbrevForwardStep // returns NodeTestExpr
 AbbrevReverseStep // returns AxisStepExpr
        : DOT2
        {
-               $$ = AxisStepExpr.ParentStep;
+               $$ = new AxisStepExpr (XPathAxis.Parent, null);
        }
        ;
 
@@ -2161,7 +2165,7 @@ ParenthesizedExpr // returns ParenthesizedExpr
 OptionalExpr
        : // empty
        {
-               $$ = null;
+               $$ = new ExprSequence ();
        }
        | Expr
        ;
@@ -2236,8 +2240,7 @@ DirElemConstructor // returns XmlElemConstructor
                        tokenizer.PushState (ParseState.Operator);
                tokenizer.State = ParseState.StartTag;
                // FIXME: tokenizer.Space = WhitespaceHandling.Significant;
-         } QName AttributeList {
-         } FollowDirElemConstructor {
+         } QName AttributeList FollowDirElemConstructor {
                tokenizer.PopState ();
          }
        {
@@ -2357,6 +2360,9 @@ EnclosedExpr // returns EnclosedExpr
 
 ElementContent // returns ExprSingle 
        : ELEM_CONTENT_LITERAL // including "{{", "}}" and char/predefined entities
+       {
+               $$ = new XmlTextConstructor ((string) $1);
+       }
        | DirElemConstructor
        | EnclosedExpr
        | XmlCData