public override IEnumerable <Position> Execute(UnreadableEnv env) { // Evaluate the condition foreach (var pos in _argCond.Execute(env)) { yield return(pos); } yield return(Position); var value = env.Pop(); if (value == null) { throw new Exception("If condition cannot be void."); } var codeToExecute = value.Value.IsZero ? _argNCode : _argYCode; // Execute the code foreach (var pos in codeToExecute.Execute(env)) { yield return(pos); } // Last result is now on the stack yield return(Position); }
public IEnumerable<Position> Execute(UnreadableEnv env) { foreach (var node in _nodes) { foreach (var pos in node.Execute(env)) yield return pos; } yield return _posEnd; }
public IEnumerable <Position> Execute(UnreadableEnv env) { foreach (var node in _nodes) { foreach (var pos in node.Execute(env)) { yield return(pos); } } yield return(_posEnd); }
public override IEnumerable <Position> Execute(UnreadableEnv env) { foreach (var arg in _args) { foreach (var pos in arg.Execute(env)) { yield return(pos); } } yield return(Position); _executor(env); }
public override IEnumerable <Position> Execute(UnreadableEnv env) { env.Push(null); again: // Evaluate the condition foreach (var pos in _argCond.Execute(env)) { yield return(pos); } yield return(Position); var value = env.Pop(); if (value == null) { throw new Exception("While condition cannot be void."); } if (!value.Value.IsZero) { // Discard result from previous iteration env.Pop(); // Execute the code foreach (var pos in _argCode.Execute(env)) { yield return(pos); } yield return(Position); goto again; } // Last result is now on the stack yield return(Position); }
public abstract IEnumerable <Position> Execute(UnreadableEnv env);
public override IEnumerable<Position> Execute(UnreadableEnv env) { env.Push(null); again: // Evaluate the condition foreach (var pos in _argCond.Execute(env)) yield return pos; yield return Position; var value = env.Pop(); if (value == null) throw new Exception("While condition cannot be void."); if (!value.Value.IsZero) { // Discard result from previous iteration env.Pop(); // Execute the code foreach (var pos in _argCode.Execute(env)) yield return pos; yield return Position; goto again; } // Last result is now on the stack yield return Position; }
public override IEnumerable<Position> Execute(UnreadableEnv env) { foreach (var arg in _args) foreach (var pos in arg.Execute(env)) yield return pos; yield return Position; _executor(env); }
public abstract IEnumerable<Position> Execute(UnreadableEnv env);
public override IEnumerable<Position> Execute(UnreadableEnv env) { // Evaluate the condition foreach (var pos in _argCond.Execute(env)) yield return pos; yield return Position; var value = env.Pop(); if (value == null) throw new Exception("If condition cannot be void."); var codeToExecute = value.Value.IsZero ? _argNCode : _argYCode; // Execute the code foreach (var pos in codeToExecute.Execute(env)) yield return pos; // Last result is now on the stack yield return Position; }