public override EVariable Exec(EScope scope) { EVBoolean solved = (EVBoolean)check.Solve(scope).Convert(EType.Boolean); if (solved.Get()) { EScope subScope = scope.GetChild(); return(Interpreter.Run(program, subScope)); } if (elseProgram != null) { EScope subScope = scope.GetChild(); return(Interpreter.Run(elseProgram, subScope)); } return(new EVVoid()); }
public override EVariable Exec(EScope scope) { Func <bool> checkVar = () => ( (EVBoolean) check.Solve(scope) .Convert(EType.Boolean) ).Get(); EVariable output = new EVVoid(); while (checkVar()) { EScope subScope = scope.GetChild(); output = Interpreter.Run(program, subScope); } return(output); }
public override EVariable Exec(EScope scope, ESolvable[] args) { // TODO: output type casting if (args.Length != arguments.Length) { throw new ELangException("Wrong amount of args for function " + name); } EScope lowerScope = scope.GetChild(); for (int i = 0; i < arguments.Length; i++) { string argname = arguments[i].GetVariable().ToString(); ETypeWord argtype = arguments[i].GetEType(); EVariable solved = EVariable.New(argtype).Assign(args[i].Solve(lowerScope)); lowerScope.Set(argname, solved); } return(Interpreter.Run(program, lowerScope)); }
public override EVariable Exec(EScope scope, ESolvable[] args) { EScope lowerScope = scope.GetChild(); return(func(lowerScope, args)); }