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); }
public static QsiExpressionNode VisitGroupExpr(GroupExprContext context) { var node = VisitRelation(context.relation()); CqlTree.PutContextSpan(node, context); return(node); }
public static QsiExpressionNode VisitFieldSelectorModifier(FieldSelectorModifierContext context) { return(TreeHelper.Create <QsiFieldExpressionNode>(n => { n.Identifier = new QsiQualifiedIdentifier(context.fident().id); CqlTree.PutContextSpan(n, context); })); }
public static QsiExpressionNode VisitSelectionList(SelectionListContext context) { return(TreeHelper.Create <CqlListExpressionNode>(n => { n.Elements.AddRange(context.unaliasedSelector().Select(VisitUnaliasedSelector)); CqlTree.PutContextSpan(n, context); })); }
public static QsiExpressionNode VisitUsertypeLiteral(UsertypeLiteralContext context) { var node = TreeHelper.CreateLiteral(context.GetText()); CqlTree.PutContextSpan(node, context); return(node); }
public static QsiExpressionNode VisitTupleOfTupleLiterals(TupleOfTupleLiteralsContext context) { var node = new CqlTupleExpressionNode(); node.Elements.AddRange(context._list.Select(VisitTupleLiteral)); CqlTree.PutContextSpan(node, context); return(node); }
public static QsiExpressionNode VisitSingleColumnInValues(SingleColumnInValuesContext context) { var node = new QsiMultipleExpressionNode(); node.Elements.AddRange(context._list.Select(VisitTerm)); CqlTree.PutContextSpan(node, context); return(node); }
public static QsiExpressionNode VisitSelectionGroup(IToken unary, SelectionGroupContext context) { var node = new QsiUnaryExpressionNode(); node.Expression.SetValue(VisitSelectionGroup(context)); CqlTree.PutContextSpan(node, unary, context.Stop); return(node); }
public static QsiExpressionNode VisitTupleOfIdentifiers(TupleOfIdentifiersContext context) { var node = new CqlTupleExpressionNode(); node.Elements.AddRange(context.cidentList().cident().Select(VisitCident)); CqlTree.PutContextSpan(node, context); return(node); }
public static QsiMultipleOrderExpressionNode CreateOrder(ParserRuleContextWrapper <OrderByClauseContext[]> context) { var node = new QsiMultipleOrderExpressionNode(); node.Orders.AddRange(context.Value.Select(VisitOrderByClause)); CqlTree.PutContextSpan(node, context); return(node); }
public static QsiLimitExpressionNode CreateLimit(ParserRuleContextWrapper <IntValueContext> context) { var node = new QsiLimitExpressionNode(); node.Limit.SetValue(VisitIntValue(context.Value)); CqlTree.PutContextSpan(node, context); return(node); }
public static QsiExpressionNode VisitSelectionGroupWithField(SelectionGroupWithFieldContext context) { var target = VisitSelectionGroupWithoutField(context.selectionGroupWithoutField()); var node = VisitSelectorModifier(target, context.selectorModifier()); CqlTree.PutContextSpan(node, context); return(node); }
public static CqlMultipleUsingExpressionNode VisitUsingClause(UsingClauseContext context) { var node = new CqlMultipleUsingExpressionNode(); node.Elements.AddRange(context.usingClauseObjective().Select(VisitUsingClauseObjective)); CqlTree.PutContextSpan(node, context); return(node); }
public static QsiExpressionNode VisitTupleOfMarkersForTuples(TupleOfMarkersForTuplesContext context) { var node = new CqlTupleExpressionNode(); node.Elements.AddRange(context._list.Select(VisitBindParameter)); CqlTree.PutContextSpan(node, context); return(node); }
public static QsiGroupingExpressionNode CreateGrouping(ParserRuleContextWrapper <GroupByClauseContext[]> context) { var node = new QsiGroupingExpressionNode(); node.Items.AddRange(context.Value.Select(VisitGroupByClause)); CqlTree.PutContextSpan(node, context); return(node); }
public static QsiExpressionNode VisitColumnCondition(ColumnConditionContext context) { QsiExpressionNode node; var leftNode = VisitCident(context.l); if (context.element != null || context.field != null) { var memberAccessNode = new QsiMemberAccessExpressionNode(); memberAccessNode.Target.SetValue(leftNode); if (context.element != null) { var indexerNode = new CqlIndexerExpressionNode(); indexerNode.Indexer.SetValue(VisitTerm(context.element)); memberAccessNode.Member.SetValue(indexerNode); } else { memberAccessNode.Member.SetValue(new QsiFieldExpressionNode { Identifier = new QsiQualifiedIdentifier(context.field.id) }); } leftNode = memberAccessNode; } if (context.op != null) { var binaryNode = new QsiBinaryExpressionNode { Operator = context.op.GetText() }; binaryNode.Left.SetValue(leftNode); binaryNode.Right.SetValue(VisitTerm(context.r1)); node = binaryNode; } else { var invokeNode = new QsiInvokeExpressionNode(); invokeNode.Member.SetValue(TreeHelper.CreateFunction(CqlKnownFunction.In)); invokeNode.Parameters.Add(leftNode); invokeNode.Parameters.Add(VisitSingleColumnInValues(context.r2)); node = invokeNode; } CqlTree.PutContextSpan(node, context); return(node); }
public static QsiExpressionNode VisitCident(CidentContext context) { var node = new QsiColumnExpressionNode(); node.Column.SetValue(TableVisitor.VisitCident(context)); CqlTree.PutContextSpan(node, context); return(node); }
public static QsiExpressionNode VisitSelectionTypeHint(SelectionTypeHintContext context) { var typeNode = VisitComparatorType(context.comparatorType()); var valueNode = VisitSelectionGroupWithoutField(context.selectionGroupWithoutField()); var node = CreateInlineCast(typeNode, valueNode); CqlTree.PutContextSpan(node, context); return(node); }
public static QsiExpressionNode VisitTtlFunction(TtlFunctionContext context) { return(TreeHelper.Create <QsiInvokeExpressionNode>(n => { n.Member.SetValue(TreeHelper.CreateFunction(CqlKnownFunction.TTL)); n.Parameters.Add(VisitSident(context.c)); CqlTree.PutContextSpan(n, context); })); }
public static QsiOrderExpressionNode VisitOrderByClause(OrderByClauseContext context) { var node = new QsiOrderExpressionNode(); node.Expression.SetValue(VisitCident(context.cident())); node.Order = context.isDescending ? QsiSortOrder.Descending : QsiSortOrder.Ascending; CqlTree.PutContextSpan(node, context); return(node); }
public static QsiExpressionNode VisitCastFunction(CastFunctionContext context) { return(TreeHelper.Create <QsiInvokeExpressionNode>(n => { n.Member.SetValue(TreeHelper.CreateFunction(CqlKnownFunction.Cast)); n.Parameters.Add(VisitUnaliasedSelector(context.sn)); n.Parameters.Add(VisitNativeType(context.t)); CqlTree.PutContextSpan(n, context); })); }
public static CqlTypeExpressionNode VisitComparatorType(ComparatorTypeContext context) { var node = new CqlTypeExpressionNode { Type = context.type }; CqlTree.PutContextSpan(node, context); return(node); }
public static QsiExpressionNode VisitIntValue(IntValueContext context) { if (context.t != null) { var node = TreeHelper.CreateLiteral(long.Parse(context.t.Text)); CqlTree.PutContextSpan(node, context); return(node); } return(VisitBindParameter(context.bindParameter())); }
public static QsiExpressionNode VisitIsNotNulExpr(IsNotNulExprContext context) { var node = new QsiInvokeExpressionNode(); node.Member.SetValue(TreeHelper.CreateFunction(CqlKnownFunction.IsNotNull)); node.Parameters.Add(VisitCident(context.l)); CqlTree.PutContextSpan(node, context); return(node); }
public static QsiExpressionNode VisitIdxName(IdxNameContext context) { var node = new CqlIndexExpressionNode { Identifier = new QsiQualifiedIdentifier(context.id) }; CqlTree.PutContextSpan(node, context); return(node); }
public static QsiExpressionNode VisitCustomIndexExpression(CustomIndexExpressionContext context) { var node = new QsiInvokeExpressionNode(); node.Member.SetValue(TreeHelper.CreateFunction(CqlKnownFunction.Expr)); node.Parameters.Add(VisitIdxName(context.idxName())); node.Parameters.Add(VisitTerm(context.term())); CqlTree.PutContextSpan(node, context); return(node); }
public static CqlUsingExpressionNode VisitUsingClauseObjective(UsingClauseObjectiveContext context) { var node = new CqlUsingExpressionNode { Type = context.type, Value = context.time }; CqlTree.PutContextSpan(node, context); return(node); }
public static CqlUsingExpressionNode VisitUsingClauseDelete(UsingClauseDeleteContext context) { var node = new CqlUsingExpressionNode { Type = CqlUsingType.Timestamp, Value = int.Parse(context.ts.GetText()) }; CqlTree.PutContextSpan(node, context); return(node); }
public static QsiExpressionNode VisitNormalColumnOperation2(NormalColumnOperation2Context context) { var node = new QsiBinaryExpressionNode(); node.Left.SetValue(VisitCident(context.l)); node.Operator = context.sig.Text; node.Right.SetValue(VisitTerm(context.r)); CqlTree.PutContextSpan(node, context); return(node); }
public static QsiExpressionNode VisitInExpr2(InExpr2Context context) { var node = new QsiInvokeExpressionNode(); node.Member.SetValue(TreeHelper.CreateFunction(CqlKnownFunction.In)); node.Parameters.Add(VisitCident(context.l)); node.Parameters.Add(VisitSingleColumnInValues(context.r)); CqlTree.PutContextSpan(node, context); return(node); }