Ejemplo n.º 1
0
        internal void OldRun(PsudoProgram psudoProgram)
        {
            for (int i = 0; i < this.Instructions.Count; i++)
            {
                psudoProgram.OnBeforeInstruction(this.Instructions[i]);

                if (this.Instructions[i] == null)
                {
                    psudoProgram.OnError("Null Instruction on Line " + i + "\n");
                    continue;
                }
                PsudoInstruction jump = this.Instructions[i].Run();

                psudoProgram.OnAfterInstruction(this.Instructions[i]);

                if (jump != null)
                {
                    int jumpLine = this.Instructions.FindIndex(item => item != null && item.Line >= jump.Line) - 1;
                    // if (jumpLine >= 0)
                    i = jumpLine;
                }

                // if returning break out of the loop
                if (this.Instructions[i] is ReturnInstruction)
                {
                    break;
                }
            }
        }