protected List <PsudoInstruction> CompileBlock(PsudoMethod method, int startLine, int endLine) { List <PsudoInstruction> list = new List <PsudoInstruction>(); for (int i = startLine; i <= endLine; i++) { try { switch (this.scanner.lineTypes[i]) { case PsudoLineType.Variable: PsudoVariableInfo vInfo = this.scanner.variableInfo.Find( item => item.Line == i); vInfo.Processed = true; list.Add(new CreateLocalVariable(i, method, vInfo.Type, vInfo.Name, vInfo.Default)); break; case PsudoLineType.StartDecision: case PsudoLineType.StartStartDecision: int end; list.Add(CompileDecision(method, i, out end)); i = end; break; case PsudoLineType.StartLoop: int end2; list.Add(CompileLoop(method, i, out end2)); i = end2; break; case PsudoLineType.Instruction: list.Add(InstructionFactory.CompileInstruction( this.codeLines[i], i, method)); break; // Nothing to do for the following case PsudoLineType.StartMain: case PsudoLineType.StartMethod: case PsudoLineType.Whitespace: case PsudoLineType.Comment: case PsudoLineType.EndMethod: break; case PsudoLineType.EndDecision: throw new Exception("Unexpected End Decision"); case PsudoLineType.EndLoop: throw new Exception("Unexpected End Loop"); case PsudoLineType.EndClass: case PsudoLineType.StartClass: throw new Exception("Classes Not Supported Currently"); default: throw new Exception(string.Format( "Error Compiling Method \"{0}\" on Line #{1}", method.Name, i + 1)); } } catch (Exception e) { this.Errors.Add(new CompileError(e.Message, i + 1)); } } return(list); }