internal override object Evaluate(NameEnvironment environment)
 {
     object e1 = sliceStart.Evaluate(environment);
     object e2 = sliceStop.Evaluate(environment);
     object e3 = sliceStep.Evaluate(environment);
     return Ops.MakeSlice(e1, e2, e3);
 }
        public override object Execute(NameEnvironment environment)
        {
            object ret = Statement.NextStatement;

            IEnumerator i = Ops.GetEnumerator(list.Evaluate(environment));

            while (i.MoveNext()) {
                lhs.Assign(i.Current, environment);
                ret = body.Execute(environment);
                if (ret != NextStatement) return ret;
            }

            return ret;
            //			if (else_ != null) {
            //				else_.exec(env);
            //			}
        }
 public override object Execute(NameEnvironment environment)
 {
     return NextStatement;
 }
 public virtual object Execute(NameEnvironment environment)
 {
     throw new NotImplementedException("execute: " + this);
 }
 public override object Execute(NameEnvironment environment)
 {
     object ret = NextStatement;
     while (Ops.IsTrue(test.Evaluate(environment))) {
         ret = body.Execute(environment);
         if (ret != NextStatement) break;
     }
     return ret;
     //			if (else_ != null) {
     //				else_.exec(env);
     //			}
 }
 public object MakeFunction(NameEnvironment environment)
 {
     string[] names = SymbolTable.IdsToStrings(makeNames(parameters));
     object[] defaults = Expression.Evaluate(this.defaults, environment);
     return new InterpFunction(names, defaults, Body, environment.Globals);
 }
 public override object Execute(NameEnvironment environment)
 {
     return expr.Evaluate(environment);
 }
 internal override object Evaluate(NameEnvironment environment)
 {
     return value;
 }
 internal override object Evaluate(NameEnvironment environment)
 {
     IDictionary<object, object> dict = Ops.MakeDict(items.Length);
     foreach (SliceExpression s in items) {
         dict[s.SliceStart.Evaluate(environment)] = s.SliceStop.Evaluate(environment);
     }
     return dict;
 }
        internal override object Evaluate(NameEnvironment environment)
        {
            object callee = target.Evaluate(environment);

            object[] cargs = new object[args.Length];
            int index = 0;
            foreach (Arg arg in args) {
                if (arg.Name != SymbolTable.Empty) throw new NotImplementedException("keywords");
                cargs[index++] = arg.Expression.Evaluate(environment);
            }

            switch (cargs.Length) {
                case 0: return Ops.Call(callee);
                default: return Ops.Call(callee, cargs);
            }
        }
 internal override object Evaluate(NameEnvironment environment)
 {
     object ret = testExpr.Evaluate(environment);
     if (Ops.IsTrue(ret))
         return trueExpr.Evaluate(environment);
     else
         return falseExpr.Evaluate(environment);
 }
        internal override object Evaluate(NameEnvironment environment)
        {
            object l = left.Evaluate(environment);
            object r = right.Evaluate(environment);

            return op.Evaluate(l, r);
        }
 internal override object Evaluate(NameEnvironment environment)
 {
     return Ops.Repr(expr.Evaluate(environment));
 }
 internal override object Evaluate(NameEnvironment environment)
 {
     return Ops.MakeTuple(Evaluate(Items, environment));
 }
 internal override object Evaluate(NameEnvironment environment)
 {
     object t = target.Evaluate(environment);
     object i = index.Evaluate(environment);
     return Ops.GetIndex(t, i);
 }
 internal static object[] Evaluate(IList<Expression> items, NameEnvironment environment)
 {
     object[] ret = new object[items.Count];
     for (int i = 0; i < items.Count; i++) {
         ret[i] = items[i].Evaluate(environment);
     }
     return ret;
 }
 public override object Execute(NameEnvironment environment)
 {
     environment.Set(name.GetString(), MakeFunction(environment));
     return NextStatement;
 }
 internal virtual void Assign(object val, NameEnvironment environment)
 {
     throw new NotImplementedException("Assign: " + this);
 }
        public override object Execute(NameEnvironment environment)
        {
            Console.Out.Write("print> ");
            foreach (Expression e in exprs) {
                object val = e.Evaluate(environment);
                Ops.PrintComma(environment.Globals.SystemState, val);
            }
            if (!trailingComma) Ops.PrintNewline(environment.Globals.SystemState);

            return NextStatement;
        }
 internal virtual object Evaluate(NameEnvironment environment)
 {
     throw new NotImplementedException("Evaluate: " + this);
 }
 public override object Execute(NameEnvironment environment)
 {
     object v = rhs.Evaluate(environment);
     foreach (Expression e in lhs) {
         e.Assign(v, environment);
     }
     return NextStatement;
 }
 internal override void Assign(object val, NameEnvironment environment)
 {
     object t = target.Evaluate(environment);
     Ops.SetAttr(environment.Globals, t, SymbolTable.StringToId(name.GetString()), val);
 }
 public override object Execute(NameEnvironment environment)
 {
     object ret = Statement.NextStatement;
     foreach (Statement stmt in stmts) {
         ret = stmt.Execute(environment);
         if (ret != Statement.NextStatement) break;
     }
     return ret;
 }
 internal override object Evaluate(NameEnvironment environment)
 {
     object t = target.Evaluate(environment);
     return Ops.GetAttr(environment.Globals, t, SymbolTable.StringToId(name.GetString()));
 }
 public override object Execute(NameEnvironment environment)
 {
     expr.Evaluate(environment);
     return NextStatement;
 }
 internal override void Assign(object val, NameEnvironment environment)
 {
     object t = target.Evaluate(environment);
     object i = index.Evaluate(environment);
     Ops.SetIndex(t, i, val);
 }
        public override object Execute(NameEnvironment environment)
        {
            Ops.ImportFrom(environment.Globals, root.MakeString(), SymbolTable.IdsToStrings(names));

            return NextStatement;
        }
 internal override object Evaluate(NameEnvironment environment)
 {
     object ret = left.Evaluate(environment);
     if (Ops.IsTrue(ret)) return right.Evaluate(environment);
     else return ret;
 }
 public override object Execute(NameEnvironment environment)
 {
     foreach (IfStatementTest t in tests) {
         object val = t.Test.Evaluate(environment);
         if (Ops.IsTrue(val)) {
             return t.Body.Execute(environment);
         }
     }
     if (elseStmt != null) {
         return elseStmt.Execute(environment);
     }
     return NextStatement;
 }
        internal override void Assign(object val, NameEnvironment environment)
        {
            // Disallow "[] = l", "[], a = l, l", "[[]] = [l]", etc
            if (items.Length == 0) {
                throw Ops.SyntaxError("can't assign to " + EmptySequenceString, "<unknown>",
                    Start.Line, Start.Column, null, 0, IronPython.Hosting.Severity.Error);
            }

            IEnumerator ie = Ops.GetEnumerator(val);

            int leftCount = items.Length;
            object[] values = new object[leftCount];

            int rightCount = Ops.GetEnumeratorValues(ie, ref values);
            if (leftCount != rightCount)
                throw Ops.ValueErrorForUnpackMismatch(leftCount, rightCount);

            for (int i = 0; i < leftCount; i++)
                items[i].Assign(values[i], environment);
        }