protected override void WriteOutput(InputOutput io) { VList<LNode> results = io.Output; if (!NoOutHeader) Output.AppendFormat( "// Generated from {1} by LeMP custom tool. LeMP version: {2}{0}" + "// Note: you can give command-line arguments to the tool via 'Custom Tool Namespace':{0}" + "// --no-out-header Suppress this message{0}" + "// --verbose Allow verbose messages (shown by VS as 'warnings'){0}" + "// --timeout=X Abort processing thread after X seconds (default: 10){0}" + "// --macros=FileName.dll Load macros from FileName.dll, path relative to this file {0}" + "// Use #importMacros to use macros in a given namespace, e.g. #importMacros(Loyc.LLPG);{0}", NewlineString, Path.GetFileName(io.FileName), typeof(MacroProcessor).Assembly.GetName().Version.ToString()); var options = new LNodePrinterOptions { IndentString = IndentString, NewlineString = NewlineString }; LNode.Printer.Print(results, Output, Sink, ParsingMode.File, options); }
protected override void WriteOutput(InputOutput io) { Results = io.Output; Output = new StringBuilder(); var opts = new LNodePrinterOptions { IndentString = IndentString, NewlineString = NewlineString }; LNode.Printer.Print(Results, Output, Sink, null, opts); }
protected virtual void WriteOutput(InputOutput io) { Debug.Assert(io.FileName != io.OutFileName); Sink.Write(Severity.Verbose, io, "Writing output file: {0}", io.OutFileName); using (var stream = File.Open(io.OutFileName, FileMode.Create, FileAccess.Write, FileShare.Read)) using (var writer = new StreamWriter(stream, Encoding.UTF8)) { var options = new LNodePrinterOptions { IndentString = IndentString, NewlineString = NewlineString }; var str = io.OutPrinter.Print(io.Output, Sink, null, options); writer.Write(str); } }