public override object VisitExprAnd([NotNull] MiniSQLParser.ExprAndContext context) { Expression left = (Expression)Visit(context.expr(0)); Expression right = (Expression)Visit(context.expr(1)); Expression obj = new Expression(); obj.LeftOperand = left; obj.RightOperand = right; obj.Operator = Operator.And; // optimize expression if (left.Operator == Operator.AtomConcreteValue && right.Operator == Operator.AtomConcreteValue) { left.ConcreteValue = obj.Calculate(null); return(left); } return(obj); }
/// <summary> /// Exit a parse tree produced by the <c>exprAnd</c> /// labeled alternative in <see cref="MiniSQLParser.expr"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitExprAnd([NotNull] MiniSQLParser.ExprAndContext context) { }
/// <summary> /// Visit a parse tree produced by the <c>exprAnd</c> /// labeled alternative in <see cref="MiniSQLParser.expr"/>. /// <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 VisitExprAnd([NotNull] MiniSQLParser.ExprAndContext context) { return(VisitChildren(context)); }