private static void InitializeLogs() { rawLog = Pixie.Terminal.TerminalLog.Acquire(); ioLog = new TransformLog( rawLog, entry => DiagnosticExtractor.Transform(entry, new Text("unit-tests"))); testLog = new TestLog( ImmutableHashSet <Pixie.Severity> .Empty.Add(Pixie.Severity.Error), ioLog); }
/// <summary> /// Takes a raw log and turns it into a log that /// always prints diagnostics. /// </summary> /// <param name="rawLog">The raw log to accept.</param> /// <returns>A log that always prints diagnostics.</returns> private static ILog CreateDiagnosticLog(ILog rawLog) { // Turn all entries into diagnostics and word-wrap the output. return(new TransformLog( rawLog, entry => { var transformed = DiagnosticExtractor.Transform(entry, "collaboration-server"); return new Pixie.LogEntry( transformed.Severity, WrapBox.WordWrap(transformed.Contents)); })); }
public static void Main(string[] args) { // Acquire a log for, well, logging purposes. var rawLog = TerminalLog.Acquire(); Log = new TransformLog( rawLog, entry => DiagnosticExtractor.Transform(entry, new Text("LeMP-repl"))); // Wrap the log in a Loyc message sink. Sink = new SeverityMessageFilter( new PixieMessageSink(Log), Loyc.Severity.NoteDetail); // Create an option parser. var optParser = new GnuOptionSetParser( Options.All, Options.Files, Options.Files.Forms[0]); // Parse command-line arguments. var parsedOptions = optParser.Parse(args, Log); // Optionally display help message. if (parsedOptions.GetValue <bool>(Options.Help)) { rawLog.Log( new HelpMessage( "LeMP-repl is a simple interactive program that " + "reads unprocessed EC#, LES v2 or LES v3 code as " + "input and produces processed or unprocessed EC#, " + "LES v2 or LES v3 code as output.", "LeMP-repl [options]", Options.All)); return; } // Create a macro processor. if (!parsedOptions.GetValue <bool>(Options.DoNotProcessMacros)) { Processor = new MacroProcessor(Sink); Processor.AddMacros(typeof(StandardMacros).Assembly, false); Processor.PreOpenedNamespaces.Add(GSymbol.Get("LeMP")); } Parser = GetParser(parsedOptions); Printer = GetPrinter(parsedOptions); // Start the REPL. RunRepl(); }
private static LogEntry MakeDiagnostic(LogEntry entry) { return(DiagnosticExtractor .Transform(entry, "il2llvm") .Map(WrapBox.WordWrap)); }