Esempio n. 1
0
        public void Run()
        {
            var terminated = false;

            while (true)
            {
                ioHandler.Write("> ");
                var          inputLines       = new StringBuilder();
                var          cancelSubmission = false;
                ScriptResult scriptResult     = null;

                while (true)
                {
                    var line = ioHandler.ReadLine();

                    if (IsDirective(line))
                    {
                        ProcessDirective(line, ref terminated);
                        break;
                    }

                    inputLines.AppendLine(line);
                    scriptResult = scriptEngine.Execute(inputLines.ToString());

                    if (ScriptResult.Empty.Equals(scriptResult))
                    {
                        cancelSubmission = true;
                        break;
                    }

                    if (scriptResult.IsCompleteSubmission)
                    {
                        break;
                    }

                    ioHandler.Write(". ");
                }

                if (terminated)
                {
                    break;
                }

                if (cancelSubmission || scriptResult == null)
                {
                    continue;
                }

                ProcessExecutionResult(scriptResult);
            }
        }
Esempio n. 2
0
 internal void ProcessExecutionResult(ScriptResult scriptResult)
 {
     if (scriptResult.CompileExceptionInfo != null)
     {
         ioHandler.WriteException(scriptResult.CompileExceptionInfo.SourceException);
     }
     else if (scriptResult.ExecuteExceptionInfo != null)
     {
         ioHandler.WriteException(scriptResult.ExecuteExceptionInfo.SourceException);
     }
     else if (scriptResult.ReturnValue != null)
     {
         ioHandler.WriteLine(scriptResult.ReturnValue);
     }
 }
Esempio n. 3
0
 internal void ProcessExecutionResult(ScriptResult scriptResult)
 {
     if (scriptResult.CompileExceptionInfo != null)
     {
         ioHandler.WriteException(scriptResult.CompileExceptionInfo.SourceException);
     }
     else if (scriptResult.ExecuteExceptionInfo != null)
     {
         ioHandler.WriteException(scriptResult.ExecuteExceptionInfo.SourceException);
     }
     else if (scriptResult.ReturnValue != null)
     {
         ioHandler.WriteLine(scriptResult.ReturnValue);
     }
 }