async Task <string> ProcessRepl(string repl, string filename = "") { ReplMode = true; Dictionary <int, int> char2Line; string script = Utils.ConvertToScript(repl, out char2Line); ParsingScript tempScript = new ParsingScript(script, 0, char2Line); tempScript.OriginalScript = repl; tempScript.Debugger = this; if (!string.IsNullOrWhiteSpace(filename)) { tempScript.Filename = filename; } Variable result = null; bool excThrown = false; string stringRes = ""; try { while (tempScript.Pointer < script.Length) { result = await DebuggerUtils.Execute(tempScript); tempScript.GoToNextStatement(); while (tempScript.TryCurrent() == Constants.END_STATEMENT) { tempScript.Forward(); } } if (TrySendFile(result, tempScript, ref excThrown) || excThrown) { return(""); } stringRes = string.IsNullOrEmpty(Output) ? "" : Output + (Output.EndsWith("\n") ? "" : "\n"); stringRes += result == null ? "" : result.AsString(); stringRes += (stringRes.EndsWith("\n") ? "" : "\n"); } catch (Exception exc) { Console.WriteLine("ProcessRepl Exception: " + exc); return(""); // The exception was already thrown and sent back. } finally { ReplMode = false; } return(stringRes); }
public async Task <bool> ExecuteNextStatement() { int endGroupRead = 0; if (m_debugging.Pointer >= m_script.Length - 1) { LastResult = null; End = true; return(true); } //int startPointer = m_debugging.Pointer; if (ProcessingBlock) { endGroupRead = m_debugging.GoToNextStatement(); if (ProcessingBlock && endGroupRead > 0) { return(true); } } Executing = true; try { LastResult = await DebuggerUtils.Execute(m_debugging); } catch (ParsingException exc) { if (m_debugging.InTryBlock) { throw exc; } ProcessException(m_debugging, exc); return(true); } finally { Executing = false; } endGroupRead = m_debugging.GoToNextStatement(); // Check if after this statement the Step In is completed and we can unwind the stack: bool completedSteppingIn = Completed(m_debugging) || (ProcessingBlock && endGroupRead > 0) || LastResult.Type == Variable.VarType.CONTINUE || LastResult.Type == Variable.VarType.BREAK || LastResult.IsReturn; return(completedSteppingIn); }
public bool ExecuteNextStatement() { int endGroupRead = 0; if (m_debugging.Pointer >= m_script.Length - 1) { LastResult = null; #if UNITY_EDITOR == false && UNITY_STANDALONE == false && __ANDROID__ == false && __IOS__ == false End = true; Trace("END!"); #endif return(true); } //int startPointer = m_debugging.Pointer; if (ProcessingBlock) { endGroupRead = m_debugging.GoToNextStatement(); if (ProcessingBlock && endGroupRead > 0) { return(true); } } Executing = true; try { LastResult = DebuggerUtils.Execute(m_debugging); } catch (ParsingException exc) { ProcessException(m_debugging, exc); return(true); } finally { Executing = false; } endGroupRead = m_debugging.GoToNextStatement(); //int endPointer = m_debugging.Pointer; //processed = m_debugging.Substr(startPointer, endPointer - startPointer); return(Completed(m_debugging) || (ProcessingBlock && endGroupRead > 0)); }
public async Task <bool> ExecuteNextStatement() { int endGroupRead = 0; if (m_debugging.Pointer >= m_script.Length - 1) { LastResult = null; End = true; Trace("END of parsing"); return(true); } //int startPointer = m_debugging.Pointer; if (ProcessingBlock) { endGroupRead = m_debugging.GoToNextStatement(); if (ProcessingBlock && endGroupRead > 0) { return(true); } } Executing = true; try { LastResult = await DebuggerUtils.Execute(m_debugging); } catch (ParsingException exc) { ProcessException(m_debugging, exc); return(true); } finally { Executing = false; } endGroupRead = m_debugging.GoToNextStatement(); //int endPointer = m_debugging.Pointer; //processed = m_debugging.Substr(startPointer, endPointer - startPointer); return(Completed(m_debugging) || (ProcessingBlock && endGroupRead > 0)); }
string ProcessRepl(string repl) { ReplMode = true; Dictionary <int, int> char2Line; string script = Utils.ConvertToScript(repl, out char2Line); ParsingScript tempScript = new ParsingScript(script, 0, char2Line); tempScript.OriginalScript = repl; tempScript.Debugger = this; Variable result = null; try { while (tempScript.Pointer < script.Length) { result = DebuggerUtils.Execute(tempScript); tempScript.GoToNextStatement(); } } catch (Exception exc) { return("Exception thrown: " + exc.Message); } finally { ReplMode = false; } string stringRes = Output + "\n"; stringRes += result == null ? "" : result.AsString(); return(stringRes); }