public override Value VisitEqualityExpr(AbstractIfStmtParser.EqualityExprContext ctx) { Value left = this.Visit(ctx.expr(0)); Value right = this.Visit(ctx.expr(1)); switch (ctx.op.Type) { case AbstractIfStmtParser.EQ: return(left.isDouble() && right.isDouble() ? new Value(Math.Abs(left.asDouble() - right.asDouble()) < SMALL_VALUE) : new Value(left.Equals(right))); case AbstractIfStmtParser.NEQ: return(left.isDouble() && right.isDouble() ? new Value(Math.Abs(left.asDouble() - right.asDouble()) >= SMALL_VALUE) : new Value(!left.Equals(right))); } return(new Value(false)); }
/// <summary> /// Visit a parse tree produced by <see cref="AbstractIfStmtParser.equalityExpr"/>. /// <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 VisitEqualityExpr([NotNull] AbstractIfStmtParser.EqualityExprContext context) { return(VisitChildren(context)); }
/// <summary> /// Exit a parse tree produced by <see cref="AbstractIfStmtParser.equalityExpr"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitEqualityExpr([NotNull] AbstractIfStmtParser.EqualityExprContext context) { }