protected override RunControlType ExecuteInternal(ScriptExecutionEnvironment env, out ScriptVariable returnValue) { returnValue = null; if (!this.Do) { ScriptVariable condition = this.Condition.Calculate(env); if (condition == null || !condition.ToBoolean()) { return(RunControlType.None); } } while (true) { RunControlType ctrl = this.Statement.Execute(env, out returnValue); if (ctrl == RunControlType.Break) { return(RunControlType.None); } if (ctrl == RunControlType.Return) { return(RunControlType.Return); } ScriptVariable condition = this.Condition.Calculate(env); if (condition == null || !condition.ToBoolean()) { return(RunControlType.None); } } }
protected override RunControlType ExecuteInternal(ScriptExecutionEnvironment env, out ScriptVariable returnValue) { returnValue = null; env.Variables.EnterScope(); try { foreach (var statement in this.Statements) { RunControlType ctrl = statement.Execute(env, out returnValue); if (ctrl != RunControlType.None) { return(ctrl); } } } finally { env.Variables.ExitScope(); } return(RunControlType.None); }
protected override RunControlType ExecuteInternal(ScriptExecutionEnvironment env, out ScriptVariable returnValue) { returnValue = null; env.Variables.EnterScope(); try { if (this.Initialize != null) { this.Initialize.Calculate(env); } while (true) { if (this.Condition != null) { ScriptVariable condition = this.Condition.Calculate(env); if (condition == null || !condition.ToBoolean()) { return(RunControlType.None); } } if (this.Statement != null) { RunControlType ctrl = this.Statement.Execute(env, out returnValue); if (ctrl == RunControlType.Break) { return(RunControlType.None); } if (ctrl == RunControlType.Return) { return(RunControlType.Return); } } if (this.Continue != null) { this.Continue.Calculate(env); } } } finally { env.Variables.ExitScope(); } }
protected override RunControlType ExecuteInternal(ScriptExecutionEnvironment env, out ScriptVariable returnValue) { returnValue = null; env.Variables.EnterScope(); try { env.Variables.Declare(this.Identifier, null, VariableStorage.FieldProperty.Default); ScriptVariable list = this.Enumerator.Calculate(env) ?? new ListVariable(); foreach (var tmp in list.ToList()) { env.Variables.Set(this.Identifier, tmp); RunControlType ctrl = this.Statement.Execute(env, out returnValue); if (ctrl == RunControlType.Break) { return(RunControlType.None); } if (ctrl == RunControlType.Return) { return(RunControlType.Return); } } } finally { env.Variables.ExitScope(); } return(RunControlType.None); }
protected override RunControlType ExecuteInternal(ScriptExecutionEnvironment env, out ScriptVariable returnValue) { returnValue = null; ScriptVariable condition = this.Condition.Calculate(env); if (condition != null && condition.ToBoolean()) { if (this.Then == null) { return(RunControlType.None); } RunControlType ctrl = this.Then.Execute(env, out returnValue); return(ctrl); } else { if (this.Else == null) { return(RunControlType.None); } RunControlType ctrl = this.Else.Execute(env, out returnValue); return(ctrl); } }
public ControlSyntaxElement(LexicalElement lexAtStart, RunControlType type) : base(lexAtStart) { this.Type = type; }
public ControlSyntaxElement(LexicalElement lexAtStart, SyntaxElement returnValue) : base(lexAtStart) { this.Type = RunControlType.Return; this.ReturnValue = returnValue; }