public static void DumpException(AphidLoadScriptException exception, AphidInterpreter interpreter) { WriteErrorMessage( StyleEscape( ErrorFormatter.Format( exception, AphidScript.Read(exception.ScriptFile)))); DumpStackTrace(interpreter, exception); DumpScope(exception, interpreter); }
private byte[] CreateResponse(HttpListenerContext context) { var session = GetSession(context); var result = TryInterpretHandler(context, session); if (result == null) { var localPath = GetLocalPath(context.Request.Url); var code = AphidScript.Read(localPath); result = InterpretAphid(localPath, code, context, session); } return(result); }
private static void RunScript(string[] args) { if (!File.Exists(args[0])) { Console.WriteLine("Could not find {0}", args[0]); Environment.Exit(1); } var ext = Path.GetExtension(args[0]).ToLower(); var isTextDocument = ext == ".alxt"; var file = Path.GetFullPath(args[0]); var interpreter = new AphidInterpreter(); interpreter.SetScriptFilename(file); EnvironmentLibrary.SetEnvArgs(true); var result = true; #if !APHID_DEBUGGING_ENABLED if (AphidConfig.Current.ScriptCaching) { var cache = new AphidByteCodeCache(interpreter.Loader.SearchPaths.ToArray()) { DisableConstantFolding = false, InlineScripts = true, }; if (AphidErrorHandling.HandleErrors) { result = AphidCli.TryAction( interpreter, () => AphidScript.Read(file), () => interpreter.Interpret(cache.Read(file)), allowErrorReporting: true); } else { interpreter.Interpret(cache.Read(file)); } } else { #endif var code = AphidScript.Read(file); if (AphidErrorHandling.HandleErrors) { result = AphidCli.TryAction( interpreter, code, () => interpreter.Interpret(code, file, isTextDocument), allowErrorReporting: true); } else { interpreter.Interpret(code, file, isTextDocument); } if (interpreter.CurrentScope.ResolveBool(AphidName.OpenRepl)) { new AphidRepl { Interpreter = interpreter }.Run(); } #if !APHID_DEBUGGING_ENABLED } #endif if (!result) { Environment.Exit(0xbad5230); } }