public override void Evaluate(IContext context) { if (_assigntype != TokenEnum.NOTHING) { Val v = _scope.GetVar(this, _varName); switch (_assigntype) { case TokenEnum.ASSIGN: v = _value?.Evaluate(context) ?? Val.NULL; break; case TokenEnum.PLUSASSIGN: v = Ops.Do(BOp.ADD, v, _value?.Evaluate(context) ?? Val.NULL);; break; case TokenEnum.MINUSASSIGN: v = Ops.Do(BOp.SUBTRACT, v, _value?.Evaluate(context) ?? Val.NULL);; break; case TokenEnum.ASTERISKASSIGN: v = Ops.Do(BOp.MULTIPLY, v, _value?.Evaluate(context) ?? Val.NULL);; break; case TokenEnum.SLASHASSIGN: v = Ops.Do(BOp.DIVIDE, v, _value?.Evaluate(context) ?? Val.NULL);; break; case TokenEnum.PERCENTASSIGN: v = Ops.Do(BOp.MODULUS, v, _value?.Evaluate(context) ?? Val.NULL);; break; case TokenEnum.AMPASSIGN: v = Ops.Do(BOp.LOGICAL_AND, v, _value?.Evaluate(context) ?? Val.NULL);; break; case TokenEnum.PIPEASSIGN: v = Ops.Do(BOp.LOGICAL_OR, v, _value?.Evaluate(context) ?? Val.NULL);; break; } if (_varExpr is IndexedExpression indexexpr) { indexexpr.Evaluate(context); _scope.SetVar(this, _varName, v, indexexpr._indices); } else { _scope.SetVar(this, _varName, v); } } else { _value?.Evaluate(context); } }
public override void Evaluate(IContext context) { while (_condition.Evaluate(context).IsTrue) { foreach (CStatement s in _actions) { s.Evaluate(context); } } }
public override void Evaluate(IContext context) { if (_condition == null || _condition.Evaluate(context).IsTrue) { foreach (CStatement s in _actionIfTrue) { s.Evaluate(context); } } else { foreach (CStatement s in _actionIfFalse) { s.Evaluate(context); } } }
public override void Evaluate(IContext context) { if (_enumerable != null) { Val array = _enumerable.Evaluate(context); Array a = array.Cast <Array>(); foreach (object o in a) { _scope.SetVar(this, _var.varName, new Val(o)); foreach (CStatement s in _actions) { s.Evaluate(context); } } } }
public override void Evaluate(IContext context) { if (_condition != null) { _begin.Evaluate(context); while (_condition.Evaluate(context).IsTrue) { foreach (CStatement s in _actions) { s.Evaluate(context); } _next.Evaluate(context); } return; } foreach (CStatement s in _actions) { s.Evaluate(context); } }