示例#1
0
 protected EngineOptions(EngineOptions options)
 {
     Contract.RequiresNotNull(options, "options");
     _clrDebuggingEnabled = options._clrDebuggingEnabled;
     _exceptionDetail = options._exceptionDetail;
     _showClrExceptions = options._showClrExceptions;
 }
示例#2
0
        public override void Parse(string[] args)
        {
            if (_consoleOptions == null) _consoleOptions = GetDefaultConsoleOptions();
            if (_engineOptions == null) _engineOptions = GetDefaultEngineOptions();

            base.Parse(args);
        }
示例#3
0
        public ToyEngine(LanguageProvider provider, EngineOptions engineOptions) : base(provider, engineOptions) {
            IronPython.Runtime.Operations.Ops.Bool2Object(true); //awful initialization hack

            IronPython.Runtime.Operations.Ops.RegisterAssembly(typeof(ToyEngine).Assembly);

            _defaultContext = new ToyContext(this);
            _defaultBinder = new DefaultActionBinder(new CodeContext(null, _defaultContext));
        }
示例#4
0
 public override ScriptEngine GetEngine(EngineOptions options)
 {
     if (options == null)
     {
         options = new InfixEngineOptions();
     }
     return new InfixEngine(this, options);
 }
示例#5
0
		public static string FormatException (Exception exception, EngineOptions options)
		{
			StringBuilder builder = new StringBuilder ();
			builder.AppendLine (" Error: ");
			builder.AppendLine (exception.Message);
			if (options.ShowClrExceptions) {
				builder.AppendLine ();
				builder.AppendLine ("CLR Exception");
				builder.Append (exception.GetType().Name + " : ");
				builder.AppendLine (exception.Message);
				builder.AppendLine (exception.StackTrace);
			}
			return builder.ToString ();
		}
		public void FormatException ()
		{
			Exception ex = new Exception("test message", new Exception ("inner exception test", null));
			try {
				throw ex;
			} catch (Exception e) {
				Console.WriteLine (e.StackTrace.ToString());

				MSc.EngineOptions option = new MSc.EngineOptions();
				option.ShowClrExceptions = true;
				string result = JSErrorConvertor.FormatException (e, option);
				Assert.AreEqual (" Error: test message\r\n\r\nCLR Exception\r\nException : test message\r\n" + e.StackTrace.ToString() +"\r\n", result, "#1");
				option.ShowClrExceptions = false;
				result = JSErrorConvertor.FormatException (e, option);
				Assert.AreEqual (" Error: test message\r\n", result, "#2");
			}			
		}
示例#7
0
        public void FormatException()
        {
            Exception ex = new Exception("test message", new Exception("inner exception test", null));

            try {
                throw ex;
            } catch (Exception e) {
                Console.WriteLine(e.StackTrace.ToString());

                MSc.EngineOptions option = new MSc.EngineOptions();
                option.ShowClrExceptions = true;
                string result = JSErrorConvertor.FormatException(e, option);
                Assert.AreEqual(" Error: test message\r\n\r\nCLR Exception\r\nException : test message\r\n" + e.StackTrace.ToString() + "\r\n", result, "#1");
                option.ShowClrExceptions = false;
                result = JSErrorConvertor.FormatException(e, option);
                Assert.AreEqual(" Error: test message\r\n", result, "#2");
            }
        }
 public IronSchemeScriptEngine(LanguageProvider lp, EngineOptions eo, LanguageContext lc)
   : base(lp, eo, lc)
 {
   ((IronSchemeLanguageContext)LanguageContext).se = this;
 }
示例#9
0
 public InfixEngine(InfixLanguageProvider provider, EngineOptions options)
     : base(provider, options, new InfixLanguageContext())
 {
     ((InfixLanguageContext)LanguageContext).InfixEngine = this;
     this._binder = new InfixBinder(new CodeContext(new Scope(), LanguageContext, new ModuleContext(null)));
 }
示例#10
0
 public static PythonEngine CreateIronPythonEngine()
 {
     EngineOptions engineOptions = new EngineOptions();
     engineOptions.ShowClrExceptions = true;
     return new PythonEngine(engineOptions);
 }
        public override ScriptEngine GetEngine(EngineOptions options)
        {
            if (se == null)
              {
            LanguageContext lc = new IronSchemeLanguageContext();
            se = new IronSchemeScriptEngine(this, options ?? new IronSchemeOptionsParser.IronSchemeEngineOptions(), lc);

              }
              return se;
        }
示例#12
0
 public override ScriptEngine GetEngine(EngineOptions options)
 {
     return new ToyEngine(this, options);
 }
示例#13
0
 public InfixOptionsParser()
 {
     this._consoleOptions = this.GetDefaultConsoleOptions();
     this._engineOptions = this.GetDefaultEngineOptions();
 }