/// <summary> /// Evaluate > >= != == less less than /// </summary> /// <returns></returns> public object VisitCompare(CompareExpr expr) { var node = expr; var op = expr.Op; // TODO: This should be here ( find a better solution ) // e.g. allow expression to support comparable ?? if(expr.Right.Nodetype == NodeTypes.SysAnyOf) { var anyOf = ((AnyOfExpr) expr.Right); anyOf.CompareExpr = expr.Left; return this.VisitAnyOf(anyOf); } var left = (LObject) expr.Left.Evaluate(this); var right = (LObject) expr.Right.Evaluate(this); return EvalHelper.Compare(node, op, left, right); }
/// <summary> /// Creates a unary expression with symbol scope, context, script refernce set. /// </summary> /// <param name="name"></param> /// <param name="token"></param> /// <returns></returns> public static Expr Compare(Expr left, Operator op, Expr right, TokenData token) { var exp = new CompareExpr(); exp.Left = left; exp.Op = op; exp.Right = right; SetupContext(exp, token); return exp; }
/// <summary> /// Visits the compare expression tree /// </summary> /// <param name="exp"></param> public object VisitCompare(CompareExpr exp) { _callBackOnNodeStart(exp); _callBackOnNodeStart(exp.Left); _callBackOnNodeStart(exp.Right); return null; }