static void Execute(ForeachFunctionValue main, FunctionArgument args, EvalContext cal) { var children = args.Contents; try { IEnumerableValue l = cal.GetValue <IEnumerableValue>(cal.Evaluate(main.Collection)); foreach (var t in l) { cal.Variables.Set(main.Vid, t); try { foreach (var v in children) { cal.Evaluate(v); } } catch (BContinue) { continue; } } } catch (BBreak) { return; } }
static void Execute(ForFunctionValue main, FunctionArgument args, EvalContext cal) { var children = args.Contents; try { for (cal.Evaluate(main.Begin); cal.GetValue <bool>(cal.Evaluate(main.Condition)); cal.Evaluate(main.Step)) { try { foreach (var v in children) { cal.Evaluate(v); } } catch (BContinue) { continue; } } } catch (BBreak) { return; } }
static void Execute(DoWhileFunctionValue main, FunctionArgument args, EvalContext cal) { var children = args.Contents; try { do { try { foreach (var v in children) { cal.Evaluate(v); } } catch (BContinue) { continue; } }while (cal.GetValue <bool>(cal.Evaluate(main.Condition))); } catch (BBreak) { return; } }
static IExpr Execute(IfFunctionValue main, FunctionArgument args, EvalContext cal) { var children = args.Contents; if (cal.GetValue <bool>(cal.Evaluate(main.Condition))) { foreach (var v in children) { cal.Evaluate(v); } return(BuiltinValues.Null); } else { return(new ElseFunctionValue(true, main)); } }
static void Execute(ElseFunctionValue main, FunctionArgument args, EvalContext cal) { if (main.IsHappen == false) { return; } var children = args.Contents; foreach (var v in children) { cal.Evaluate(v); } }
public object Execute(string code) { var e = eb.GetExpr(code); return(context.Evaluate(e)); }