/* * public override Object VisitCommand(CodeQuery.CommandContext context) * { * var expression = context.expression().Accept(this); * * if (expression is CommandCallElement) * { * var methodCallElement = (CommandCallElement)expression; * var operators = context.COMMAND_OPERATOR().ToArray(); * * if (!operators.Any()) * { * return TreeFactory.CreateControlFlow(methodCallElement); * } * * for (var i = 0; i < operators.Length; i++) * { * var op = operators[i]; * var command = context.command().ToArray()[i]; * * var pipelineOperator = op.GetText(); * var rightExpression = command.Accept(this) as ControlFlowElementBase; * * if (methodCallElement != null) * { * return TreeFactory.CreateControlFlow(pipelineOperator, methodCallElement, rightExpression); * } * } * } * else if (expression is BaseSelectorElement) * { * var selectorElement = ((BaseSelectorElement)expression); * return TreeFactory.CreateControlFlow(selectorElement); * } * * return null; * } */ public override Object VisitCommandOperand(CodeQueryParser.CommandOperandContext context) { var left = context.Left.Accept(this) as ControlFlowElementBase; var right = context.Right.Accept(this) as ControlFlowElementBase; var pipelineOperator = context.Operator.Text; return(TreeFactory.CreateControlFlow(left, right, pipelineOperator)); }
/// <summary> /// Visit a parse tree produced by <see cref="CodeQueryParser.CommandOperand"/>. /// <para> /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/> /// on <paramref name="context"/>. /// </para> /// </summary> /// <param name="context">The parse tree.</param> /// <return>The visitor result.</return> public virtual Result VisitCommandOperand([NotNull] CodeQueryParser.CommandOperandContext context) { return(VisitChildren(context)); }
/// <summary> /// Exit a parse tree produced by <see cref="CodeQueryParser.CommandOperand"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitCommandOperand([NotNull] CodeQueryParser.CommandOperandContext context) { }