コード例 #1
0
        public static QsiExpressionNode VisitTupleExpr(TupleExprContext context)
        {
            QsiExpressionNode node;

            var leftNode = VisitTupleOfIdentifiers(context.l);

            if (context.tupleInMarker != null || context.literals != null || context.markers != null)
            {
                var invokeNode = new QsiInvokeExpressionNode();

                invokeNode.Member.SetValue(TreeHelper.CreateFunction(CqlKnownFunction.In));
                invokeNode.Parameters.Add(leftNode);

                if (context.tupleInMarker != null)
                {
                    invokeNode.Parameters.Add(VisitBindParameter(context.tupleInMarker));
                }

                if (context.literals != null)
                {
                    invokeNode.Parameters.Add(VisitTupleOfTupleLiterals(context.literals));
                }

                if (context.markers != null)
                {
                    invokeNode.Parameters.Add(VisitTupleOfMarkersForTuples(context.markers));
                }

                node = invokeNode;
            }
            else if (context.literal != null || context.tupleMarker != null)
            {
                var binaryNode = new QsiBinaryExpressionNode
                {
                    Operator = context.op.GetText()
                };

                binaryNode.Left.SetValue(leftNode);

                if (context.literal != null)
                {
                    binaryNode.Right.SetValue(VisitTupleLiteral(context.literal));
                }

                if (context.tupleMarker != null)
                {
                    binaryNode.Right.SetValue(VisitBindParameter(context.tupleMarker));
                }

                node = binaryNode;
            }
            else
            {
                node = new CqlTupleExpressionNode();
            }

            CqlTree.PutContextSpan(node, context);

            return(node);
        }
コード例 #2
0
        public static QsiExpressionNode VisitTupleOfIdentifiers(TupleOfIdentifiersContext context)
        {
            var node = new CqlTupleExpressionNode();

            node.Elements.AddRange(context.cidentList().cident().Select(VisitCident));
            CqlTree.PutContextSpan(node, context);

            return(node);
        }
コード例 #3
0
        public static QsiExpressionNode VisitTupleOfMarkersForTuples(TupleOfMarkersForTuplesContext context)
        {
            var node = new CqlTupleExpressionNode();

            node.Elements.AddRange(context._list.Select(VisitBindParameter));
            CqlTree.PutContextSpan(node, context);

            return(node);
        }
コード例 #4
0
        public static QsiExpressionNode VisitTupleOfTupleLiterals(TupleOfTupleLiteralsContext context)
        {
            var node = new CqlTupleExpressionNode();

            node.Elements.AddRange(context._list.Select(VisitTupleLiteral));
            CqlTree.PutContextSpan(node, context);

            return(node);
        }
コード例 #5
0
        public static QsiExpressionNode VisitSelectionTupleOrNestedSelector(SelectionTupleOrNestedSelectorContext context)
        {
            QsiExpressionNode[] children = context._list
                                           .Select(VisitUnaliasedSelector)
                                           .ToArray();

            if (children.Length > 1)
            {
                var node = new CqlTupleExpressionNode();

                node.Elements.AddRange(children);
                CqlTree.PutContextSpan(node, context);

                return(node);
            }

            return(children[0]);
        }