Esempio n. 1
0
        public override object Walk(ConditionalExpression node)
        {
            var cond = node.Condition.Accept(this);

            return(InterpreterHelper.IsTrue(cond)
                ? node.TrueExpression.Accept(this)
                : node.FalseExpression.Accept(this));
        }
Esempio n. 2
0
        public override object Walk(IfStatement node)
        {
            var cond = node.Condition.Accept(this);

            if (InterpreterHelper.IsTrue(cond))
            {
                return(node.Body.Accept(this));
            }
            return(node.Else != null?node.Else.Accept(this) : null);
        }
Esempio n. 3
0
        public override object Walk(WhileStatement node)
        {
            object result = null;

            while (InterpreterHelper.IsTrue(node.Condition.Accept(this)))
            {
                try
                {
                    result = node.Body.Accept(this);
                }
                catch (Break)
                {
                    break;
                }
                catch (Next)
                {
                    continue;
                }
            }
            return(result);
        }
 public BikeBoolean OpNot(object value)
 {
     return(new BikeBoolean(!InterpreterHelper.IsTrue(value)));
 }
 public object OpOr(object lv, Func <object> rvThunk)
 {
     return(InterpreterHelper.IsTrue(lv) ? lv : rvThunk());
 }
 public object OpAnd(object lv, Func <object> rvThunk)
 {
     return(InterpreterHelper.IsTrue(lv) ? rvThunk() : lv);
 }