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

            base.Parse(args);
        }
Exemple #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));
        }
 public override ScriptEngine GetEngine(EngineOptions options)
 {
     if (options == null)
     {
         options = new InfixEngineOptions();
     }
     return new InfixEngine(this, options);
 }
		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");
			}			
		}
        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;
 }
Exemple #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)));
 }
Exemple #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;
        }
Exemple #12
0
 public override ScriptEngine GetEngine(EngineOptions options)
 {
     return new ToyEngine(this, options);
 }
Exemple #13
0
 public InfixOptionsParser()
 {
     this._consoleOptions = this.GetDefaultConsoleOptions();
     this._engineOptions = this.GetDefaultEngineOptions();
 }