Instruction AnalyseDoWhile(Tokenizer.Token[] tokens, int index, out int tokenCount) { InstructionDoWhile instructionDoWhile = new InstructionDoWhile(); int tc; tokenCount = 1; Tokenizer.Token[] tokensBloc = GetTokensInsideBloc(tokens, index + 1); int indexBloc = 0; while (indexBloc < tokensBloc.Length) { Instruction instruction = AnalyseInstruction(tokensBloc, indexBloc, out tc); instructionDoWhile.BlocInstruction.Add(instruction); indexBloc += tc; } tokenCount += 3 + tokensBloc.Length; Tokenizer.Token[] tokensTest = GetTokensBetweenParentheses(tokens, index + tokenCount); instructionDoWhile.TestInstruction = AnalyseInstruction(tokensTest, 0, out tc); tokenCount += tc + 3; return(instructionDoWhile); }
InstructionResult ExecuteInstructionDoWhile(Instruction instruction) { InstructionDoWhile instructionDoWhile = instruction as InstructionDoWhile; do { foreach (Instruction blocInstruction in instructionDoWhile.BlocInstruction) { var result = ExecuteInstruction(blocInstruction); if (result != null) { if (result.Return) { return(result); } else if (result.Break) { return(new InstructionResult() { Return = false }); } } } } while (ExecuteInstruction(instructionDoWhile.TestInstruction).Value.BoolValue); return(new InstructionResult() { Return = false }); }