public static EngineState EvalLines(EngineState s, List<string> rawCodes, CodeType type, ErrorCheck check, out List<CodeCommand> cmds) { // Create CodeCommand SectionAddress addr = EngineTests.DummySectionAddress(); cmds = CodeParser.ParseStatements(rawCodes, addr, out List<LogInfo> errorLogs); if (0 < errorLogs.Where(x => x.State == LogState.Error).Count()) { Assert.IsTrue(check == ErrorCheck.ParserError); return s; } Assert.IsTrue(cmds[0].Type == type); // Run CodeCommand List<LogInfo> logs = Engine.ExecuteCommand(s, cmds[0]); // Assert EngineTests.CheckErrorLogs(logs, check); // Return EngineState return s; }
public static EngineState Eval(EngineState s, string rawCode, CodeType type, ErrorCheck check, out CodeCommand cmd) { // Create CodeCommand SectionAddress addr = EngineTests.DummySectionAddress(); cmd = CodeParser.ParseStatement(rawCode, addr); if (cmd.Type == CodeType.Error) { Console.WriteLine((cmd.Info as CodeInfo_Error).ErrorMessage); Assert.IsTrue(check == ErrorCheck.ParserError); return s; } Assert.IsTrue(cmd.Type == type); // Run CodeCommand List<LogInfo> logs = Engine.ExecuteCommand(s, cmd); // Assert EngineTests.CheckErrorLogs(logs, check); // Return EngineState return s; }