/// <summary>
 /// Initializes relationship navigation expression.
 /// </summary>
 internal RelshipNavigationExpr(Node refExpr, Node relshipTypeName, Identifier toEndIdentifier, Identifier fromEndIdentifier)
 {
     _refExpr = refExpr;
     _relshipTypeName = relshipTypeName;
     _toEndIdentifier = toEndIdentifier;
     _fromEndIdentifier = fromEndIdentifier;
 }
 /// <summary>
 /// Initializes function definition using the name, the optional argument definitions and the body expression.
 /// </summary>
 internal FunctionDefinition(Identifier name, NodeList<PropDefinition> argDefList, Node body, int startPosition, int endPosition)
 {
     this._name = name;
     this._paramDefList = argDefList;
     this._body = body;
     this._startPosition = startPosition;
     this._endPosition = endPosition;
 }
        /// <summary>
        /// Constructs an aliased expression node.
        /// </summary>
        internal AliasedExpr(Node expr, Identifier alias)
        {
            Debug.Assert(expr != null, "expr != null");
            Debug.Assert(alias != null, "alias != null");

            if (String.IsNullOrEmpty(alias.Name))
            {
                throw EntityUtil.EntitySqlError(alias.ErrCtx, System.Data.Entity.Strings.InvalidEmptyIdentifier);
            }

            _expr = expr;
            _alias = alias;
        }
        /// <summary>
        /// Initializes aliased import.
        /// </summary>
        internal NamespaceImport(BuiltInExpr bltInExpr)
        {
            _namespaceAlias = null;

            var aliasId = bltInExpr.Arg1 as Identifier;
            if (aliasId == null)
            {
                var errCtx = bltInExpr.Arg1.ErrCtx;
                var message = Strings.InvalidNamespaceAlias;
                throw EntitySqlException.Create(errCtx, message, null);
            }

            _namespaceAlias = aliasId;
            _namespaceName = bltInExpr.Arg2;
        }
Esempio n. 5
0
        /// <summary>
        /// Constructs an aliased expression node.
        /// </summary>
        internal AliasedExpr(Node expr, Identifier alias)
        {
            Debug.Assert(expr != null, "expr != null");
            Debug.Assert(alias != null, "alias != null");

            if (String.IsNullOrEmpty(alias.Name))
            {
                var errCtx = alias.ErrCtx;
                var message = Strings.InvalidEmptyIdentifier;
                throw EntitySqlException.Create(errCtx, message, null);
            }

            _expr = expr;
            _alias = alias;
        }
        private Token MapUnescapedIdentifier(string symbol)
        {
            // Validate before calling ResetSymbolAsIdentifierState(...) because it will reset _symbolAsInlineFunctionNameState
            bool invalidIdentifier = CqlLexer.InternalInvalidAliasNames.Contains(symbol);

            if (_symbolAsInlineFunctionNameState)
            {
                invalidIdentifier |= CqlLexer.InternalInvalidInlineFunctionNames.Contains(symbol);
            }

            ResetSymbolAsIdentifierState(true);

            if (invalidIdentifier)
            {
                throw EntityUtil.EntitySqlError(_query, System.Data.Entity.Strings.InvalidAliasName(symbol), _iPos);
            }
            else
            {
                AST.Identifier id = new AST.Identifier(symbol, false, _query, _iPos);
                id.ErrCtx.ErrorContextInfo = EntityRes.CtxIdentifier;
                return(NewToken(CqlParser.IDENTIFIER, id));
            }
        }
 private bool IsEscapedIdentifier(string symbol, out Token identifierToken)
 {
     if (symbol.Length > 1 && symbol[0] == '[')
     {
         if (symbol[symbol.Length - 1] == ']')
         {
             string         name = symbol.Substring(1, symbol.Length - 2);
             AST.Identifier id   = new AST.Identifier(name, true, _query, _iPos);
             id.ErrCtx.ErrorContextInfo = EntityRes.CtxEscapedIdentifier;
             identifierToken            = NewToken(CqlParser.ESCAPED_IDENTIFIER, id);
             return(true);
         }
         else
         {
             throw EntityUtil.EntitySqlError(_query, System.Data.Entity.Strings.InvalidEscapedIdentifier(symbol), _iPos);
         }
     }
     else
     {
         identifierToken = null;
         return(false);
     }
 }
Esempio n. 8
0
        private Token MapUnescapedIdentifier(string symbol)
        {
            // Validate before calling ResetSymbolAsIdentifierState(...) because it will reset _symbolAsInlineFunctionNameState
            bool invalidIdentifier = CqlLexer.InternalInvalidAliasNames.Contains(symbol);
            if (_symbolAsInlineFunctionNameState)
            {
                invalidIdentifier |= CqlLexer.InternalInvalidInlineFunctionNames.Contains(symbol);
            }

            ResetSymbolAsIdentifierState(true);

            if (invalidIdentifier)
            {
                throw EntityUtil.EntitySqlError(_query, System.Data.Entity.Strings.InvalidAliasName(symbol), _iPos);
            }
            else
            {
                AST.Identifier id = new AST.Identifier(symbol, false, _query, _iPos);
                id.ErrCtx.ErrorContextInfo = EntityRes.CtxIdentifier;
                return NewToken(CqlParser.IDENTIFIER, id);
            }
        }
Esempio n. 9
0
 private bool IsEscapedIdentifier(string symbol, out Token identifierToken)
 {
     if (symbol.Length > 1 && symbol[0] == '[')
     {
         if (symbol[symbol.Length - 1] == ']')
         {
             string name = symbol.Substring(1, symbol.Length - 2);
             AST.Identifier id = new AST.Identifier(name, true, _query, _iPos);
             id.ErrCtx.ErrorContextInfo = EntityRes.CtxEscapedIdentifier;
             identifierToken = NewToken(CqlParser.ESCAPED_IDENTIFIER, id);
             return true;
         }
         else
         {
             throw EntityUtil.EntitySqlError(_query, System.Data.Entity.Strings.InvalidEscapedIdentifier(symbol), _iPos);
         }
     }
     else
     {
         identifierToken = null;
         return false;
     }
 }
 /// <summary>
 /// Initializes a single name import.
 /// </summary>
 internal NamespaceImport(Identifier idenitifier)
 {
     _namespaceName = idenitifier;
 }
Esempio n. 11
0
 /// <summary>
 /// initializes 
 /// </summary>
 internal DotExpr(Node leftExpr, Identifier id)
 {
     _leftExpr = leftExpr;
     _identifier = id;
 }
        private Token MapUnescapedIdentifier(string symbol)
        {
            // Validate before calling ResetSymbolAsIdentifierState(...) because it will reset _symbolAsInlineFunctionNameState
            var invalidIdentifier = InternalInvalidAliasNames.Contains(symbol);
            if (_symbolAsInlineFunctionNameState)
            {
                invalidIdentifier |= InternalInvalidInlineFunctionNames.Contains(symbol);
            }

            ResetSymbolAsIdentifierState(true);

            if (invalidIdentifier)
            {
                var errorMessage = Strings.InvalidAliasName(symbol);
                throw EntitySqlException.Create(_query, errorMessage, _iPos, null, false, null);
            }
            else
            {
                var id = new Identifier(symbol, false, _query, _iPos);
                id.ErrCtx.ErrorContextInfo = EntityRes.CtxIdentifier;
                return NewToken(CqlParser.IDENTIFIER, id);
            }
        }
 private bool IsEscapedIdentifier(string symbol, out Token identifierToken)
 {
     if (symbol.Length > 1
         && symbol[0] == '[')
     {
         if (symbol[symbol.Length - 1] == ']')
         {
             var name = symbol.Substring(1, symbol.Length - 2);
             var id = new Identifier(name, true, _query, _iPos);
             id.ErrCtx.ErrorContextInfo = EntityRes.CtxEscapedIdentifier;
             identifierToken = NewToken(CqlParser.ESCAPED_IDENTIFIER, id);
             return true;
         }
         else
         {
             var errorMessage = Strings.InvalidEscapedIdentifier(symbol);
             throw EntitySqlException.Create(_query, errorMessage, _iPos, null, false, null);
         }
     }
     else
     {
         identifierToken = null;
         return false;
     }
 }
Esempio n. 14
0
 /// <summary>
 /// Initializes collated order by clause item.
 /// </summary>
 /// <param name="optCollationIdentifier">optional Collation identifier</param>
 internal OrderByClauseItem(Node orderExpr, OrderKind orderKind, Identifier optCollationIdentifier)
 {
     _orderExpr = orderExpr;
     _orderKind = orderKind;
     _optCollationIdentifier = optCollationIdentifier;
 }
Esempio n. 15
0
 /// <summary>
 /// Initializes property definition using the name and the type definition.
 /// </summary>
 /// <param name="identifier"></param>
 internal PropDefinition(Identifier name, Node typeDefExpr)
 {
     this._name = name;
     this._typeDefExpr = typeDefExpr;
 }
Esempio n. 16
0
//###############################################################
// method: yyparse : parse input and execute indicated items
//###############################################################
        private int yyparse()
        {
            int yyn; //next thing to do
            int yym; //
            int yystate; //current parsing state from state table
#if YYDEBUG
    String yys;    //current token string
#endif
            init_stacks();
            yynerrs = 0;
            yyerrflag = 0;
            yychar = (-1);

            yystate = 0;
            state_push(yystate);

            yyloop:
#if YYDEBUG
    debug("yyloop"); 
#endif
            yyn = yydefred[yystate];
            if (yyn != 0)
            {
                goto yyreduce;
            }
#if YYDEBUG
	debug("yyn:"+yyn+"  state:"+yystate+"  char:"+yychar);
#endif
            if (yychar < 0)
            {
                yychar = yylex();
                if (yychar < 0)
                {
                    yychar = 0;
                }
            }
            yyn = yysindex[yystate];
            if ((yyn != 0) && (yyn += yychar) >= 0 &&
                yyn <= YYTABLESIZE
                && yycheck[yyn] == yychar)
            {
#if YYDEBUG
        debug("state "+yystate+", shifting to state "+yytable[yyn]+"");
#endif
                yystate = yytable[yyn];
                state_push(yystate);
                val_push(yylval);
                yychar = (-1);
                if (yyerrflag > 0)
                {
                    --yyerrflag;
                }
                goto yyloop;
            }
            yyn = yyrindex[yystate];
            if ((yyn != 0) && (yyn += yychar) >= 0 &&
                yyn <= YYTABLESIZE
                && yycheck[yyn] == yychar)
            {
                yyn = yytable[yyn];
#if YYDEBUG
	     debug("reduce");
#endif
                goto yyreduce;
            }
            if (yyerrflag != 0)
            {
                goto yyinrecovery;
            }
            yyerror("syntax error");

            ++yynerrs;
            yyinrecovery:
            if (yyerrflag < 3)
            {
                yyerrflag = 3;
                for (;;)
                {
                    if (stateptr < 0)
                    {
                        goto yyoverflow;
                    }
                    yyn = yysindex[state_peek(0)];
                    if ((yyn != 0) && (yyn += YYERRCODE) >= 0 &&
                        yyn <= YYTABLESIZE
                        && yycheck[yyn] == YYERRCODE)
                    {
                        if (stateptr < 0)
                        {
                            goto yyoverflow;
                        }
#if YYDEBUG
                debug("state "+state_peek(0)+", error recovery shifting to state "+yytable[yyn]+" ");
#endif
                        yystate = yytable[yyn];
                        state_push(yystate);
                        val_push(yylval);
                        goto yyloop;
                    }
                    else
                    {
                        if (stateptr < 0)
                        {
                            goto yyoverflow;
                        }
#if YYDEBUG
                debug("error recovery discarding state "+state_peek(0)+" ");
#endif
                        state_pop();
                        val_pop();
                    }
                }
            }
            else
            {
                if (yychar == 0)
                {
                    goto yyabort;
                }
#if YYDEBUG
        if (yydebug)
        {
            yys = null;
            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
            if (yys == null) yys = "illegal-symbol";
            debug("state "+yystate+", error recovery discards token "+yychar+" ("+yys+")");
        }
#endif
                yychar = (-1);
                goto yyloop;
            }
            yyreduce:
            yym = yylen[yyn];
#if YYDEBUG
      debug("state "+yystate+", reducing "+yym+" by rule "+yyn+" ("+yyrule[yyn]+")");
#endif
            yyval = val_peek(yym - 1);
            switch (yyn)
            {
//########## USER-SUPPLIED ACTIONS ##########
                case 1:
//#line 108 "CqlGrammar.y"
                    {
                        yyval = _parsedTree = null;
                    }
                    break;
                case 2:
//#line 112 "CqlGrammar.y"
                    {
                        yyval = _parsedTree = (Node)val_peek(0);
                    }
                    break;
                case 3:
//#line 118 "CqlGrammar.y"
                    {
                        yyval = new Command(ToNodeList<NamespaceImport>(val_peek(1)), (Statement)val_peek(0));
                        SetErrCtx(
                            AstNode(yyval), (val_peek(1) != null) ? AstNodePos(val_peek(1)) : AstNodePos(val_peek(0)),
                            EntityRes.CtxCommandExpression);
                    }
                    break;
                case 4:
//#line 129 "CqlGrammar.y"
                    {
                        yyval = null;
                    }
                    break;
                case 5:
//#line 133 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 6:
//#line 139 "CqlGrammar.y"
                    {
                        yyval = new NodeList<NamespaceImport>((NamespaceImport)val_peek(0));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(0)), EntityRes.CtxNamespaceImportList);
                    }
                    break;
                case 7:
//#line 144 "CqlGrammar.y"
                    {
                        yyval = ToNodeList<NamespaceImport>(val_peek(1)).Add((NamespaceImport)val_peek(0));
                    }
                    break;
                case 8:
//#line 150 "CqlGrammar.y"
                    {
                        yyval = new NamespaceImport((Identifier)val_peek(1));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(2)), EntityRes.CtxNamespaceImport);
                    }
                    break;
                case 9:
//#line 155 "CqlGrammar.y"
                    {
                        yyval = new NamespaceImport((DotExpr)val_peek(1));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(2)), EntityRes.CtxNamespaceImport);
                    }
                    break;
                case 10:
//#line 160 "CqlGrammar.y"
                    {
                        yyval = new NamespaceImport((BuiltInExpr)val_peek(1));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(2)), EntityRes.CtxAliasedNamespaceImport);
                    }
                    break;
                case 11:
//#line 171 "CqlGrammar.y"
                    {
                        yyval = new QueryStatement(ToNodeList<AST.FunctionDefinition>(val_peek(2)), (Node)val_peek(1));
                        SetErrCtx(
                            AstNode(yyval), (val_peek(2) != null) ? AstNodePos(val_peek(2)) : AstNodePos(val_peek(1)),
                            EntityRes.CtxQueryStatement);
                    }
                    break;
                case 12:
//#line 182 "CqlGrammar.y"
                    {
                        yyval = null;
                    }
                    break;
                case 13:
//#line 186 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 14:
//#line 192 "CqlGrammar.y"
                    {
                        yyval = new NodeList<AST.FunctionDefinition>((AST.FunctionDefinition)val_peek(0));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(0)), AstNode(val_peek(0)).ErrCtx.ErrorContextInfo);
                    }
                    break;
                case 15:
//#line 197 "CqlGrammar.y"
                    {
                        yyval = ToNodeList<AST.FunctionDefinition>(val_peek(1)).Add((AST.FunctionDefinition)val_peek(0));
                        SetErrCtx(AstNode(yyval), AstNodePos(yyval), AstNode(val_peek(0)).ErrCtx.ErrorContextInfo);
                    }
                    break;
                case 16:
//#line 204 "CqlGrammar.y"
                    {
                        yyval = new AST.FunctionDefinition(
                            (Identifier)val_peek(5), ToNodeList<PropDefinition>(val_peek(4)), (Node)val_peek(1), Terminal(val_peek(6)).IPos,
                            Terminal(val_peek(0)).IPos);
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(6)), EntityRes.CtxFunctionDefinition);
                    }
                    break;
                case 17:
//#line 211 "CqlGrammar.y"
                    {
                        yyval = null;
                    }
                    break;
                case 18:
//#line 215 "CqlGrammar.y"
                    {
                        yyval = val_peek(1);
                    }
                    break;
                case 19:
//#line 221 "CqlGrammar.y"
                    {
                        yyval = new NodeList<PropDefinition>((PropDefinition)val_peek(0));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(0)), AstNode(val_peek(0)).ErrCtx.ErrorContextInfo);
                    }
                    break;
                case 20:
//#line 226 "CqlGrammar.y"
                    {
                        yyval = ToNodeList<PropDefinition>(val_peek(2)).Add((PropDefinition)val_peek(0));
                        SetErrCtx(AstNode(yyval), AstNodePos(yyval), AstNode(val_peek(0)).ErrCtx.ErrorContextInfo);
                    }
                    break;
                case 21:
//#line 233 "CqlGrammar.y"
                    {
                        yyval = new PropDefinition((Identifier)val_peek(1), (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(1)), EntityRes.CtxFunctionDefinition);
                    }
                    break;
                case 22:
//#line 244 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 23:
//#line 248 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 24:
//#line 254 "CqlGrammar.y"
                    {
                        yyval = null;
                    }
                    break;
                case 25:
//#line 258 "CqlGrammar.y"
                    {
                        yyval = null;
                    }
                    break;
                case 26:
//#line 268 "CqlGrammar.y"
                    {
                        yyval = new QueryExpr(
                            (SelectClause)val_peek(5),
                            (FromClause)val_peek(4),
                            (Node)val_peek(3),
                            (GroupByClause)val_peek(2),
                            (HavingClause)val_peek(1),
                            (OrderByClause)val_peek(0));

                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(5)), EntityRes.CtxQueryExpression);
                    }
                    break;
                case 27:
//#line 281 "CqlGrammar.y"
                    {
                        StartMethodExprCounting();
                    }
                    break;
                case 28:
//#line 287 "CqlGrammar.y"
                    {
                        yyval = new SelectClause(
                            ToNodeList<AliasedExpr>(val_peek(0)), SelectKind.Row, (DistinctKind)val_peek(2), (Node)val_peek(1),
                            EndMethodExprCounting());
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(4)), EntityRes.CtxSelectRowClause);
                    }
                    break;
                case 29:
//#line 292 "CqlGrammar.y"
                    {
                        StartMethodExprCounting();
                    }
                    break;
                case 30:
//#line 299 "CqlGrammar.y"
                    {
                        yyval = new SelectClause(
                            ToNodeList<AliasedExpr>(val_peek(0)), SelectKind.Value, (DistinctKind)val_peek(2), (Node)val_peek(1),
                            EndMethodExprCounting());
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(5)), EntityRes.CtxSelectValueClause);
                    }
                    break;
                case 31:
//#line 306 "CqlGrammar.y"
                    {
                        yyval = DistinctKind.None;
                    }
                    break;
                case 32:
//#line 310 "CqlGrammar.y"
                    {
                        yyval = DistinctKind.All;
                    }
                    break;
                case 33:
//#line 314 "CqlGrammar.y"
                    {
                        yyval = DistinctKind.Distinct;
                    }
                    break;
                case 34:
//#line 320 "CqlGrammar.y"
                    {
                        yyval = null;
                    }
                    break;
                case 35:
//#line 324 "CqlGrammar.y"
                    {
                        yyval = val_peek(1);
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(3)), EntityRes.CtxTopSubClause);
                    }
                    break;
                case 36:
//#line 331 "CqlGrammar.y"
                    {
                        yyval = new FromClause(ToNodeList<FromClauseItem>(val_peek(0)));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxFromClause);
                    }
                    break;
                case 37:
//#line 338 "CqlGrammar.y"
                    {
                        yyval = new NodeList<FromClauseItem>((FromClauseItem)val_peek(0));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(0)), AstNode(val_peek(0)).ErrCtx.ErrorContextInfo);
                    }
                    break;
                case 38:
//#line 343 "CqlGrammar.y"
                    {
                        yyval = ToNodeList<FromClauseItem>(val_peek(2)).Add((FromClauseItem)val_peek(0));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(2)), EntityRes.CtxFromClauseList);
                    }
                    break;
                case 39:
//#line 350 "CqlGrammar.y"
                    {
                        yyval = new FromClauseItem((AliasedExpr)val_peek(0));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(0)), EntityRes.CtxFromClauseItem);
                    }
                    break;
                case 40:
//#line 355 "CqlGrammar.y"
                    {
                        yyval = new FromClauseItem((JoinClauseItem)val_peek(1));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(1)), EntityRes.CtxFromJoinClause);
                    }
                    break;
                case 41:
//#line 360 "CqlGrammar.y"
                    {
                        yyval = new FromClauseItem((JoinClauseItem)val_peek(0));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(0)), EntityRes.CtxFromJoinClause);
                    }
                    break;
                case 42:
//#line 365 "CqlGrammar.y"
                    {
                        yyval = new FromClauseItem((ApplyClauseItem)val_peek(1));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(1)), EntityRes.CtxFromApplyClause);
                    }
                    break;
                case 43:
//#line 370 "CqlGrammar.y"
                    {
                        yyval = new FromClauseItem((ApplyClauseItem)val_peek(0));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(0)), EntityRes.CtxFromApplyClause);
                    }
                    break;
                case 44:
//#line 377 "CqlGrammar.y"
                    {
                        yyval = new JoinClauseItem((FromClauseItem)val_peek(2), (FromClauseItem)val_peek(0), (JoinKind)val_peek(1));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(2)), EntityRes.CtxJoinClause);
                    }
                    break;
                case 45:
//#line 382 "CqlGrammar.y"
                    {
                        yyval = new JoinClauseItem(
                            (FromClauseItem)val_peek(4), (FromClauseItem)val_peek(2), (JoinKind)val_peek(3), (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(4)), EntityRes.CtxJoinOnClause);
                    }
                    break;
                case 46:
//#line 389 "CqlGrammar.y"
                    {
                        yyval = new ApplyClauseItem((FromClauseItem)val_peek(2), (FromClauseItem)val_peek(0), (ApplyKind)val_peek(1));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(2)), EntityRes.CtxApplyClause);
                    }
                    break;
                case 47:
//#line 396 "CqlGrammar.y"
                    {
                        yyval = JoinKind.Cross;
                    }
                    break;
                case 48:
//#line 400 "CqlGrammar.y"
                    {
                        yyval = JoinKind.LeftOuter;
                    }
                    break;
                case 49:
//#line 404 "CqlGrammar.y"
                    {
                        yyval = JoinKind.LeftOuter;
                    }
                    break;
                case 50:
//#line 408 "CqlGrammar.y"
                    {
                        yyval = JoinKind.RightOuter;
                    }
                    break;
                case 51:
//#line 412 "CqlGrammar.y"
                    {
                        yyval = JoinKind.RightOuter;
                    }
                    break;
                case 52:
//#line 416 "CqlGrammar.y"
                    {
                        yyval = JoinKind.Inner;
                    }
                    break;
                case 53:
//#line 420 "CqlGrammar.y"
                    {
                        yyval = JoinKind.Inner;
                    }
                    break;
                case 54:
//#line 424 "CqlGrammar.y"
                    {
                        yyval = JoinKind.FullOuter;
                    }
                    break;
                case 55:
//#line 428 "CqlGrammar.y"
                    {
                        yyval = JoinKind.FullOuter;
                    }
                    break;
                case 56:
//#line 432 "CqlGrammar.y"
                    {
                        yyval = JoinKind.FullOuter;
                    }
                    break;
                case 57:
//#line 438 "CqlGrammar.y"
                    {
                        yyval = ApplyKind.Cross;
                    }
                    break;
                case 58:
//#line 442 "CqlGrammar.y"
                    {
                        yyval = ApplyKind.Outer;
                    }
                    break;
                case 59:
//#line 447 "CqlGrammar.y"
                    {
                        yyval = null;
                    }
                    break;
                case 60:
//#line 451 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 61:
//#line 457 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(0)), EntityRes.CtxWhereClause);
                    }
                    break;
                case 62:
//#line 464 "CqlGrammar.y"
                    {
                        yyval = null;
                    }
                    break;
                case 63:
//#line 468 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 64:
//#line 474 "CqlGrammar.y"
                    {
                        yyval = new GroupByClause(ToNodeList<AliasedExpr>(val_peek(0)));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(2)), EntityRes.CtxGroupByClause);
                    }
                    break;
                case 65:
//#line 481 "CqlGrammar.y"
                    {
                        yyval = null;
                    }
                    break;
                case 66:
//#line 485 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 67:
//#line 491 "CqlGrammar.y"
                    {
                        StartMethodExprCounting();
                    }
                    break;
                case 68:
//#line 495 "CqlGrammar.y"
                    {
                        yyval = new HavingClause((Node)val_peek(0), EndMethodExprCounting());
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(0)), EntityRes.CtxHavingClause);
                    }
                    break;
                case 69:
//#line 502 "CqlGrammar.y"
                    {
                        yyval = null;
                    }
                    break;
                case 70:
//#line 506 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 71:
//#line 512 "CqlGrammar.y"
                    {
                        StartMethodExprCounting();
                    }
                    break;
                case 72:
//#line 518 "CqlGrammar.y"
                    {
                        yyval = new OrderByClause(
                            ToNodeList<OrderByClauseItem>(val_peek(2)), (Node)val_peek(1), (Node)val_peek(0), EndMethodExprCounting());
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(5)), EntityRes.CtxOrderByClauseItem);
                    }
                    break;
                case 73:
//#line 525 "CqlGrammar.y"
                    {
                        yyval = null;
                    }
                    break;
                case 74:
//#line 529 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxSkipSubClause);
                    }
                    break;
                case 75:
//#line 536 "CqlGrammar.y"
                    {
                        yyval = null;
                    }
                    break;
                case 76:
//#line 540 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxLimitSubClause);
                    }
                    break;
                case 77:
//#line 547 "CqlGrammar.y"
                    {
                        yyval = new NodeList<OrderByClauseItem>((OrderByClauseItem)val_peek(0));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(0)), AstNode(val_peek(0)).ErrCtx.ErrorContextInfo);
                    }
                    break;
                case 78:
//#line 552 "CqlGrammar.y"
                    {
                        yyval = ToNodeList<OrderByClauseItem>(val_peek(2)).Add((OrderByClauseItem)val_peek(0));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(2)), EntityRes.CtxOrderByClause);
                    }
                    break;
                case 79:
//#line 559 "CqlGrammar.y"
                    {
                        yyval = new OrderByClauseItem((Node)val_peek(1), (OrderKind)val_peek(0));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(1)), EntityRes.CtxOrderByClauseItem);
                    }
                    break;
                case 80:
//#line 564 "CqlGrammar.y"
                    {
                        yyval = new OrderByClauseItem((Node)val_peek(3), (OrderKind)val_peek(0), (Identifier)val_peek(1));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(3)), EntityRes.CtxCollatedOrderByClauseItem);
                    }
                    break;
                case 81:
//#line 571 "CqlGrammar.y"
                    {
                        yyval = OrderKind.None;
                    }
                    break;
                case 82:
//#line 575 "CqlGrammar.y"
                    {
                        yyval = OrderKind.Asc;
                    }
                    break;
                case 83:
//#line 579 "CqlGrammar.y"
                    {
                        yyval = OrderKind.Desc;
                    }
                    break;
                case 84:
//#line 588 "CqlGrammar.y"
                    {
                        yyval = new NodeList<Node>((Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(0)), AstNode(val_peek(0)).ErrCtx.ErrorContextInfo);
                    }
                    break;
                case 85:
//#line 593 "CqlGrammar.y"
                    {
                        yyval = ToNodeList<Node>(val_peek(2)).Add((Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(2)), EntityRes.CtxExpressionList);
                    }
                    break;
                case 86:
//#line 600 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 87:
//#line 604 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 88:
//#line 608 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 89:
//#line 612 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 90:
//#line 616 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 91:
//#line 620 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 92:
//#line 624 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 93:
//#line 628 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 94:
//#line 632 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                        IncrementMethodExprCount();
                    }
                    break;
                case 95:
//#line 637 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                        IncrementMethodExprCount();
                    }
                    break;
                case 96:
//#line 642 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 97:
//#line 646 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 98:
//#line 650 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 99:
//#line 654 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 100:
//#line 660 "CqlGrammar.y"
                    {
                        yyval = new ParenExpr((Node)val_peek(1));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(2)), EntityRes.CtxParen);
                    }
                    break;
                case 101:
//#line 667 "CqlGrammar.y"
                    {
                        yyval = new NodeList<Node>((Node)val_peek(2)).Add((Node)val_peek(0));
                    }
                    break;
                case 102:
//#line 673 "CqlGrammar.y"
                    {
                        yyval = new NodeList<Node>((Node)val_peek(3)).Add((Node)val_peek(0));
                    }
                    break;
                case 103:
//#line 682 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.Plus, Terminal(val_peek(1)).Token, (Node)val_peek(2), (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxPlus);
                    }
                    break;
                case 104:
//#line 687 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.Minus, Terminal(val_peek(1)).Token, (Node)val_peek(2), (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxMinus);
                    }
                    break;
                case 105:
//#line 692 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.Multiply, Terminal(val_peek(1)).Token, (Node)val_peek(2), (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxMultiply);
                    }
                    break;
                case 106:
//#line 697 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.Divide, Terminal(val_peek(1)).Token, (Node)val_peek(2), (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxDivide);
                    }
                    break;
                case 107:
//#line 702 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.Modulus, Terminal(val_peek(1)).Token, (Node)val_peek(2), (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxModulus);
                    }
                    break;
                case 108:
//#line 707 "CqlGrammar.y"
                    {
                        var literal = val_peek(0) as Literal;
                        if (literal != null && literal.IsNumber
                            && !literal.IsSignedNumber)
                        {
                            literal.PrefixSign(Terminal(val_peek(1)).Token);
                            yyval = val_peek(0);
                        }
                        else
                        {
                            yyval = new BuiltInExpr(BuiltInKind.UnaryMinus, Terminal(val_peek(1)).Token, (Node)val_peek(0));
                            SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxUnaryMinus);
                        }
                    }
                    break;
                case 109:
//#line 722 "CqlGrammar.y"
                    {
                        var literal = val_peek(0) as Literal;
                        if (null != literal && literal.IsNumber
                            && !literal.IsSignedNumber)
                        {
                            literal.PrefixSign(Terminal(val_peek(1)).Token);
                            yyval = val_peek(0);
                        }
                        else
                        {
                            yyval = new BuiltInExpr(BuiltInKind.UnaryPlus, Terminal(val_peek(1)).Token, (Node)val_peek(0));
                            SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxUnaryPlus);
                        }
                    }
                    break;
                case 110:
//#line 739 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.NotEqual, Terminal(val_peek(1)).Token, (Node)val_peek(2), (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxNotEqual);
                    }
                    break;
                case 111:
//#line 744 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.GreaterThan, Terminal(val_peek(1)).Token, (Node)val_peek(2), (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxGreaterThan);
                    }
                    break;
                case 112:
//#line 749 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.GreaterEqual, Terminal(val_peek(1)).Token, (Node)val_peek(2), (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxGreaterThanEqual);
                    }
                    break;
                case 113:
//#line 754 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.LessThan, Terminal(val_peek(1)).Token, (Node)val_peek(2), (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxLessThan);
                    }
                    break;
                case 114:
//#line 759 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.LessEqual, Terminal(val_peek(1)).Token, (Node)val_peek(2), (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxLessThanEqual);
                    }
                    break;
                case 115:
//#line 767 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.Intersect, Terminal(val_peek(1)).Token, (Node)val_peek(2), (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxIntersect);
                    }
                    break;
                case 116:
//#line 772 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.Union, Terminal(val_peek(1)).Token, (Node)val_peek(2), (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxUnion);
                    }
                    break;
                case 117:
//#line 777 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.UnionAll, Terminal(val_peek(2)).Token, (Node)val_peek(3), (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(2)), EntityRes.CtxUnionAll);
                    }
                    break;
                case 118:
//#line 782 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.Except, Terminal(val_peek(1)).Token, (Node)val_peek(2), (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxExcept);
                    }
                    break;
                case 119:
//#line 787 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.Overlaps, Terminal(val_peek(1)).Token, (Node)val_peek(2), (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxOverlaps);
                    }
                    break;
                case 120:
//#line 792 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.In, Terminal(val_peek(1)).Token, (Node)val_peek(2), (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxIn);
                    }
                    break;
                case 121:
//#line 797 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.NotIn, Terminal(val_peek(2)).Token, (Node)val_peek(3), (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(2)), EntityRes.CtxNotIn);
                    }
                    break;
                case 122:
//#line 802 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.Exists, Terminal(val_peek(3)).Token, (Node)val_peek(1));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(3)), EntityRes.CtxExists);
                    }
                    break;
                case 123:
//#line 807 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.AnyElement, Terminal(val_peek(3)).Token, (Node)val_peek(1));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(3)), EntityRes.CtxAnyElement);
                    }
                    break;
                case 124:
//#line 812 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.Element, Terminal(val_peek(3)).Token, (Node)val_peek(1));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(3)), EntityRes.CtxElement);
                    }
                    break;
                case 125:
//#line 817 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.Flatten, Terminal(val_peek(3)).Token, (Node)val_peek(1));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(3)), EntityRes.CtxFlatten);
                    }
                    break;
                case 126:
//#line 822 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.Distinct, Terminal(val_peek(3)).Token, (Node)val_peek(1));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(3)), EntityRes.CtxSet);
                    }
                    break;
                case 127:
//#line 830 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.IsNull, "IsNull", (Node)val_peek(2));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxIsNull);
                    }
                    break;
                case 128:
//#line 835 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.IsNotNull, "IsNotNull", (Node)val_peek(3));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(2)), EntityRes.CtxIsNotNull);
                    }
                    break;
                case 129:
//#line 843 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 130:
//#line 850 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.Treat, Terminal(val_peek(5)).Token, (Node)val_peek(3), (Node)val_peek(1));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(5)), EntityRes.CtxTreat);
                    }
                    break;
                case 131:
//#line 855 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.Cast, Terminal(val_peek(5)).Token, (Node)val_peek(3), (Node)val_peek(1));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(5)), EntityRes.CtxCast);
                    }
                    break;
                case 132:
//#line 864 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(
                            BuiltInKind.OfType,
                            Terminal(val_peek(5)).Token,
                            (Node)val_peek(3),
                            (Node)val_peek(1),
                            Literal.NewBooleanLiteral(false) /* only */);

                        SetErrCtx(AstNode(yyval), Terminal(val_peek(5)), EntityRes.CtxOfType);
                    }
                    break;
                case 133:
//#line 874 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(
                            BuiltInKind.OfType,
                            "OFTYPE ONLY",
                            (Node)val_peek(4),
                            (Node)val_peek(1),
                            Literal.NewBooleanLiteral(true) /* only */);

                        SetErrCtx(AstNode(yyval), Terminal(val_peek(6)), EntityRes.CtxOfTypeOnly);
                    }
                    break;
                case 134:
//#line 887 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(
                            BuiltInKind.IsOf,
                            "IS OF",
                            (Node)val_peek(5),
                            (Node)val_peek(1),
                            Literal.NewBooleanLiteral(false), /* only */
                            Literal.NewBooleanLiteral(false) /* not  */
                            );

                        SetErrCtx(AstNode(yyval), Terminal(val_peek(4)), EntityRes.CtxIsOf);
                    }
                    break;
                case 135:
//#line 899 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(
                            BuiltInKind.IsOf,
                            "IS NOT OF",
                            (Node)val_peek(6), /* instance */
                            (Node)val_peek(1), /* type */
                            Literal.NewBooleanLiteral(false), /* only */
                            Literal.NewBooleanLiteral(true) /* not  */
                            );

                        SetErrCtx(AstNode(yyval), Terminal(val_peek(5)), EntityRes.CtxIsNotOf);
                    }
                    break;
                case 136:
//#line 911 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(
                            BuiltInKind.IsOf,
                            "IS OF ONLY",
                            (Node)val_peek(6), /* instance */
                            (Node)val_peek(1), /* type */
                            Literal.NewBooleanLiteral(true), /* only */
                            Literal.NewBooleanLiteral(false) /* not  */
                            );

                        SetErrCtx(AstNode(yyval), Terminal(val_peek(5)), EntityRes.CtxIsOf);
                    }
                    break;
                case 137:
//#line 923 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(
                            BuiltInKind.IsOf,
                            "IS NOT OF ONLY",
                            (Node)val_peek(7), /* instance */
                            (Node)val_peek(1), /* type */
                            Literal.NewBooleanLiteral(true), /* only */
                            Literal.NewBooleanLiteral(true) /* not  */
                            );

                        SetErrCtx(AstNode(yyval), Terminal(val_peek(6)), EntityRes.CtxIsNotOf);
                    }
                    break;
                case 138:
//#line 938 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.Like, Terminal(val_peek(1)).Token, (Node)val_peek(2), (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxLike);
                    }
                    break;
                case 139:
//#line 943 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(
                            BuiltInKind.Not,
                            Terminal(val_peek(2)).Token,
                            new BuiltInExpr(BuiltInKind.Like, Terminal(val_peek(1)).Token, (Node)val_peek(3), (Node)val_peek(0)));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(2)), EntityRes.CtxNotLike);
                    }
                    break;
                case 140:
//#line 950 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(
                            BuiltInKind.Like, Terminal(val_peek(3)).Token, (Node)val_peek(4), (Node)val_peek(2), (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(3)), EntityRes.CtxLike);
                    }
                    break;
                case 141:
//#line 955 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(
                            BuiltInKind.Not,
                            Terminal(val_peek(4)).Token,
                            new BuiltInExpr(
                                BuiltInKind.Like, Terminal(val_peek(3)).Token, (Node)val_peek(5), (Node)val_peek(2), (Node)val_peek(0)));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(4)), EntityRes.CtxNotLike);
                    }
                    break;
                case 142:
//#line 965 "CqlGrammar.y"
                    {
                        var elist = (NodeList<Node>)val_peek(2);
                        Debug.Assert(elist.Count == 2);
                        yyval = new BuiltInExpr(BuiltInKind.Between, "between", elist[0], elist[1], (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxBetween);
                    }
                    break;
                case 143:
//#line 975 "CqlGrammar.y"
                    {
                        var elist = (NodeList<Node>)val_peek(2);
                        Debug.Assert(elist.Count == 2);
                        yyval = new BuiltInExpr(BuiltInKind.NotBetween, "notbetween", elist[0], elist[1], (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxNotBetween);
                    }
                    break;
                case 144:
//#line 985 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.Or, "or", (Node)val_peek(2), (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxOr);
                    }
                    break;
                case 145:
//#line 990 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.Not, "not", (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxNot);
                    }
                    break;
                case 146:
//#line 995 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.And, "and", (Node)val_peek(2), (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxAnd);
                    }
                    break;
                case 147:
//#line 1000 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 148:
//#line 1006 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 149:
//#line 1010 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 150:
//#line 1016 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.Equal, Terminal(val_peek(1)).Token, (Node)val_peek(2), (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxEquals);
                    }
                    break;
                case 151:
//#line 1023 "CqlGrammar.y"
                    {
                        yyval = new BuiltInExpr(BuiltInKind.Equal, Terminal(val_peek(1)).Token, (Node)val_peek(2), (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxEquals);
                    }
                    break;
                case 152:
//#line 1030 "CqlGrammar.y"
                    {
                        yyval = new AliasedExpr((Node)val_peek(2), (Identifier)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxAlias);
                    }
                    break;
                case 153:
//#line 1035 "CqlGrammar.y"
                    {
                        yyval = new AliasedExpr((Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(0)), AstNode(val_peek(0)).ErrCtx.ErrorContextInfo);
                    }
                    break;
                case 154:
//#line 1042 "CqlGrammar.y"
                    {
                        yyval = new NodeList<AliasedExpr>((AliasedExpr)val_peek(0));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(0)), AstNode(val_peek(0)).ErrCtx.ErrorContextInfo);
                    }
                    break;
                case 155:
//#line 1047 "CqlGrammar.y"
                    {
                        yyval = ToNodeList<AliasedExpr>(val_peek(2)).Add((AliasedExpr)val_peek(0));
                        SetErrCtx(AstNode(yyval), AstNodePos(yyval), EntityRes.CtxExpressionList);
                    }
                    break;
                case 156:
//#line 1054 "CqlGrammar.y"
                    {
                        yyval = new CaseExpr(ToNodeList<WhenThenExpr>(val_peek(1)));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(2)), EntityRes.CtxCase);
                    }
                    break;
                case 157:
//#line 1059 "CqlGrammar.y"
                    {
                        yyval = new CaseExpr(ToNodeList<WhenThenExpr>(val_peek(2)), (Node)val_peek(1));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(3)), EntityRes.CtxCase);
                    }
                    break;
                case 158:
//#line 1066 "CqlGrammar.y"
                    {
                        yyval = new NodeList<WhenThenExpr>(new WhenThenExpr((Node)val_peek(2), (Node)val_peek(0)));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(3)), EntityRes.CtxCaseWhenThen);
                    }
                    break;
                case 159:
//#line 1071 "CqlGrammar.y"
                    {
                        yyval = ToNodeList<WhenThenExpr>(val_peek(4)).Add(new WhenThenExpr((Node)val_peek(2), (Node)val_peek(0)));
                    }
                    break;
                case 160:
//#line 1077 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxCaseElse);
                    }
                    break;
                case 161:
//#line 1084 "CqlGrammar.y"
                    {
                        yyval = new RowConstructorExpr(ToNodeList<AliasedExpr>(val_peek(1)));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(3)), EntityRes.CtxRowCtor);
                    }
                    break;
                case 162:
//#line 1089 "CqlGrammar.y"
                    {
                        yyval = new MultisetConstructorExpr(ToNodeList<Node>(val_peek(1)));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(3)), EntityRes.CtxMultisetCtor);
                    }
                    break;
                case 163:
//#line 1094 "CqlGrammar.y"
                    {
                        yyval = new MultisetConstructorExpr(ToNodeList<Node>(val_peek(1)));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(2)), EntityRes.CtxMultisetCtor);
                    }
                    break;
                case 164:
//#line 1101 "CqlGrammar.y"
                    {
                        yyval = new DotExpr((Node)val_peek(2), (Identifier)val_peek(0));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(1)), EntityRes.CtxMemberAccess);
                    }
                    break;
                case 165:
//#line 1108 "CqlGrammar.y"
                    {
                        yyval = new RefExpr((Node)val_peek(1));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(3)), EntityRes.CtxRef);
                    }
                    break;
                case 166:
//#line 1115 "CqlGrammar.y"
                    {
                        yyval = new DerefExpr((Node)val_peek(1));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(3)), EntityRes.CtxDeref);
                    }
                    break;
                case 167:
//#line 1122 "CqlGrammar.y"
                    {
                        yyval = new CreateRefExpr((Node)val_peek(3), (Node)val_peek(1));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(5)), EntityRes.CtxCreateRef);
                    }
                    break;
                case 168:
//#line 1127 "CqlGrammar.y"
                    {
                        yyval = new CreateRefExpr((Node)val_peek(5), (Node)val_peek(3), (Node)val_peek(1));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(7)), EntityRes.CtxCreateRef);
                    }
                    break;
                case 169:
//#line 1134 "CqlGrammar.y"
                    {
                        yyval = new KeyExpr((Node)val_peek(1));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(3)), EntityRes.CtxKey);
                    }
                    break;
                case 170:
//#line 1141 "CqlGrammar.y"
                    {
                        yyval = new GroupPartitionExpr((DistinctKind)val_peek(2), (Node)val_peek(1));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(4)), EntityRes.CtxGroupPartition);
                    }
                    break;
                case 171:
//#line 1148 "CqlGrammar.y"
                    {
                        yyval = new MethodExpr((Node)val_peek(2), DistinctKind.None, null);
                        SetErrCtx(AstNode(yyval), AstNodePos(((DotExpr)val_peek(2)).Identifier), EntityRes.CtxMethod);
                    }
                    break;
                case 172:
//#line 1153 "CqlGrammar.y"
                    {
                        yyval = new MethodExpr(
                            (Node)val_peek(5), (DistinctKind)val_peek(3), ToNodeList<Node>(val_peek(2)),
                            ToNodeList<RelshipNavigationExpr>(val_peek(0)));
                        SetErrCtx(AstNode(yyval), AstNodePos(((DotExpr)val_peek(5)).Identifier), EntityRes.CtxMethod);
                    }
                    break;
                case 173:
//#line 1158 "CqlGrammar.y"
                    {
                        yyval = new MethodExpr(
                            (Node)val_peek(5), (DistinctKind)val_peek(3), new NodeList<Node>((Node)val_peek(2)),
                            ToNodeList<RelshipNavigationExpr>(val_peek(0)));
                        SetErrCtx(AstNode(yyval), AstNodePos(((DotExpr)val_peek(5)).Identifier), EntityRes.CtxMethod);
                    }
                    break;
                case 174:
//#line 1163 "CqlGrammar.y"
                    {
                        yyval = new MethodExpr((Identifier)val_peek(2), DistinctKind.None, null);
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(2)), EntityRes.CtxMethod);
                    }
                    break;
                case 175:
//#line 1168 "CqlGrammar.y"
                    {
                        yyval = new MethodExpr(
                            (Identifier)val_peek(5), (DistinctKind)val_peek(3), ToNodeList<Node>(val_peek(2)),
                            ToNodeList<RelshipNavigationExpr>(val_peek(0)));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(5)), EntityRes.CtxMethod);
                    }
                    break;
                case 176:
//#line 1173 "CqlGrammar.y"
                    {
                        yyval = new MethodExpr(
                            (Identifier)val_peek(5), (DistinctKind)val_peek(3), new NodeList<Node>((Node)val_peek(2)),
                            ToNodeList<RelshipNavigationExpr>(val_peek(0)));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(5)), EntityRes.CtxMethod);
                    }
                    break;
                case 177:
//#line 1183 "CqlGrammar.y"
                    {
                        yyval = new RelshipNavigationExpr((Node)val_peek(3), (Node)val_peek(1), null, null);
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(5)), EntityRes.CtxNavigate);
                    }
                    break;
                case 178:
//#line 1191 "CqlGrammar.y"
                    {
                        yyval = new RelshipNavigationExpr((Node)val_peek(5), (Node)val_peek(3), (Identifier)val_peek(1), null);
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(7)), EntityRes.CtxNavigate);
                    }
                    break;
                case 179:
//#line 1199 "CqlGrammar.y"
                    {
                        yyval = new RelshipNavigationExpr(
                            (Node)val_peek(7), (Node)val_peek(5), (Identifier)val_peek(3), (Identifier)val_peek(1));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(9)), EntityRes.CtxNavigate);
                    }
                    break;
                case 180:
//#line 1206 "CqlGrammar.y"
                    {
                        yyval = null;
                    }
                    break;
                case 181:
//#line 1210 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 182:
//#line 1216 "CqlGrammar.y"
                    {
                        yyval = new NodeList<RelshipNavigationExpr>((RelshipNavigationExpr)val_peek(0));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(0)), EntityRes.CtxRelationshipList);
                    }
                    break;
                case 183:
//#line 1221 "CqlGrammar.y"
                    {
                        yyval = ToNodeList<RelshipNavigationExpr>(val_peek(1)).Add((RelshipNavigationExpr)val_peek(0));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(1)), EntityRes.CtxRelationshipList);
                    }
                    break;
                case 184:
//#line 1231 "CqlGrammar.y"
                    {
                        yyval = new RelshipNavigationExpr((Node)val_peek(3), (Node)val_peek(1), null, null);
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(5)), EntityRes.CtxRelationship);
                    }
                    break;
                case 185:
//#line 1239 "CqlGrammar.y"
                    {
                        yyval = new RelshipNavigationExpr((Node)val_peek(5), (Node)val_peek(3), null, (Identifier)val_peek(1));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(7)), EntityRes.CtxRelationship);
                    }
                    break;
                case 186:
//#line 1247 "CqlGrammar.y"
                    {
                        yyval = new RelshipNavigationExpr(
                            (Node)val_peek(7), (Node)val_peek(5), (Identifier)val_peek(1), (Identifier)val_peek(3));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(9)), EntityRes.CtxRelationship);
                    }
                    break;
                case 187:
//#line 1254 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(0)), EntityRes.CtxTypeName);
                    }
                    break;
                case 188:
//#line 1259 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(0)), EntityRes.CtxTypeName);
                    }
                    break;
                case 189:
//#line 1264 "CqlGrammar.y"
                    {
                        var identifier = (Identifier)val_peek(1);
                        var escapedIdentifier = (Identifier)val_peek(0);
                        if (identifier.IsEscaped
                            || escapedIdentifier.Name.Length > 0)
                        {
                            var errCtx = identifier.ErrCtx;
                            var message = Strings.InvalidMetadataMemberName;
                            throw EntitySqlException.Create(errCtx, message, null);
                        }
                        yyval = new Identifier(identifier.Name + "[]", /*isEscaped*/false, _query, AstNodePos(val_peek(1)));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(1)), EntityRes.CtxTypeName);
                    }
                    break;
                case 190:
//#line 1275 "CqlGrammar.y"
                    {
                        var dotExpr = (DotExpr)val_peek(1);
                        var identifier = dotExpr.Identifier;
                        var escapedIdentifier = (Identifier)val_peek(0);
                        if (identifier.IsEscaped
                            || escapedIdentifier.Name.Length > 0)
                        {
                            var errCtx = identifier.ErrCtx;
                            var message = Strings.InvalidMetadataMemberName;
                            throw EntitySqlException.Create(errCtx, message, null);
                        }
                        yyval = new DotExpr(
                            dotExpr.Left, new Identifier(identifier.Name + "[]", /*isEscaped*/false, _query, AstNodePos(val_peek(1))));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(1)), EntityRes.CtxTypeName);
                    }
                    break;
                case 191:
//#line 1287 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(0)), EntityRes.CtxTypeName);
                    }
                    break;
                case 192:
//#line 1294 "CqlGrammar.y"
                    {
                        yyval = new DotExpr((Node)val_peek(2), (Identifier)val_peek(0));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(2)), EntityRes.CtxTypeName);
                    }
                    break;
                case 193:
//#line 1301 "CqlGrammar.y"
                    {
                        yyval = new MethodExpr((Node)val_peek(2), DistinctKind.None, null);
                        SetErrCtx(AstNode(yyval), AstNodePos(((DotExpr)val_peek(2)).Identifier), EntityRes.CtxTypeNameWithTypeSpec);
                    }
                    break;
                case 194:
//#line 1306 "CqlGrammar.y"
                    {
                        yyval = new MethodExpr((Node)val_peek(3), DistinctKind.None, ToNodeList<Node>(val_peek(1)));
                        SetErrCtx(AstNode(yyval), AstNodePos(((DotExpr)val_peek(3)).Identifier), EntityRes.CtxTypeNameWithTypeSpec);
                    }
                    break;
                case 195:
//#line 1311 "CqlGrammar.y"
                    {
                        yyval = new MethodExpr((Identifier)val_peek(2), DistinctKind.None, null);
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(2)), EntityRes.CtxTypeNameWithTypeSpec);
                    }
                    break;
                case 196:
//#line 1316 "CqlGrammar.y"
                    {
                        yyval = new MethodExpr((Identifier)val_peek(3), DistinctKind.None, ToNodeList<Node>(val_peek(1)));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(3)), EntityRes.CtxTypeNameWithTypeSpec);
                    }
                    break;
                case 197:
//#line 1323 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(0)), EntityRes.CtxEscapedIdentifier);
                    }
                    break;
                case 198:
//#line 1328 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(0)), EntityRes.CtxSimpleIdentifier);
                    }
                    break;
                case 199:
//#line 1335 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 200:
//#line 1341 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(0)), EntityRes.CtxLiteral);
                    }
                    break;
                case 201:
//#line 1346 "CqlGrammar.y"
                    {
                        yyval = new Literal(null, LiteralKind.Null, _query, TerminalPos(val_peek(0)));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(0)), EntityRes.CtxNullLiteral);
                    }
                    break;
                case 202:
//#line 1357 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 203:
//#line 1361 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 204:
//#line 1365 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 205:
//#line 1369 "CqlGrammar.y"
                    {
                        yyval = val_peek(0);
                    }
                    break;
                case 206:
//#line 1375 "CqlGrammar.y"
                    {
                        yyval = new CollectionTypeDefinition((Node)val_peek(1));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(3)), EntityRes.CtxCollectionTypeDefinition);
                    }
                    break;
                case 207:
//#line 1382 "CqlGrammar.y"
                    {
                        yyval = new RefTypeDefinition((Node)val_peek(1));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(3)), EntityRes.CtxRefTypeDefinition);
                    }
                    break;
                case 208:
//#line 1389 "CqlGrammar.y"
                    {
                        yyval = new RowTypeDefinition(ToNodeList<PropDefinition>(val_peek(1)));
                        SetErrCtx(AstNode(yyval), Terminal(val_peek(3)), EntityRes.CtxRowTypeDefinition);
                    }
                    break;
                case 209:
//#line 1396 "CqlGrammar.y"
                    {
                        yyval = new NodeList<PropDefinition>((PropDefinition)val_peek(0));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(0)), AstNode(val_peek(0)).ErrCtx.ErrorContextInfo);
                    }
                    break;
                case 210:
//#line 1401 "CqlGrammar.y"
                    {
                        yyval = ToNodeList<PropDefinition>(val_peek(2)).Add((PropDefinition)val_peek(0));
                        SetErrCtx(AstNode(yyval), AstNodePos(yyval), AstNode(val_peek(0)).ErrCtx.ErrorContextInfo);
                    }
                    break;
                case 211:
//#line 1408 "CqlGrammar.y"
                    {
                        yyval = new PropDefinition((Identifier)val_peek(1), (Node)val_peek(0));
                        SetErrCtx(AstNode(yyval), AstNodePos(val_peek(1)), EntityRes.CtxRowTypeDefinition);
                    }
                    break;

//########## END OF USER-SUPPLIED ACTIONS ##########
            }
#if YYDEBUG
    debug("reduce");
#endif
            state_drop(yym);
            yystate = state_peek(0);
            val_drop(yym);
            yym = yylhs[yyn];
            if (yystate == 0
                && yym == 0)
            {
#if YYDEBUG
        debug("After reduction, shifting from state 0 to state "+YYFINAL+"");
#endif
                yystate = YYFINAL;
                state_push(YYFINAL);
                val_push(yyval);
                if (yychar < 0)
                {
                    yychar = yylex();
                    if (yychar < 0)
                    {
                        yychar = 0;
                    }
#if YYDEBUG
            if (yydebug)
            yylexdebug(yystate,yychar);
#endif
                }
                if (yychar == 0)
                {
                    goto yyaccept;
                }
                goto yyloop;
            }
            yyn = yygindex[yym];
            if ((yyn != 0) && (yyn += yystate) >= 0 &&
                yyn <= YYTABLESIZE
                && yycheck[yyn] == yystate)
            {
                yystate = yytable[yyn];
            }
            else
            {
                yystate = yydgoto[yym];
            }
            if (stateptr < 0)
            {
                goto yyoverflow;
            }
#if YYDEBUG
    debug("after reduction, shifting from state "+state_peek(0)+" to state "+yystate+"");
#endif
            state_push(yystate);
            val_push(yyval);
            goto yyloop;
            yyoverflow:
            yyerror("yacc stack overflow");
            yyabort:
            return (1);
            yyaccept:
            return (0);
        }
Esempio n. 17
0
 /// <summary>
 /// Initializes relationship navigation expression.
 /// </summary>
 internal RelshipNavigationExpr(Node refExpr, Node relshipTypeName, Identifier toEndIdentifier, Identifier fromEndIdentifier)
 {
     _refExpr           = refExpr;
     _relshipTypeName   = relshipTypeName;
     _toEndIdentifier   = toEndIdentifier;
     _fromEndIdentifier = fromEndIdentifier;
 }