[STAThread] // Required by ICSharpCode.TextEditor public static void Main(string[] args) { if (!args.Contains("--nologo")) { Console.WriteLine("LeMP macro compiler ({0})", typeof(Compiler).Assembly.GetName().Version.ToString()); } if (args.Contains("--editor")) { Console.WriteLine("Starting editor..."); System.Windows.Forms.Application.EnableVisualStyles(); System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false); System.Windows.Forms.Application.Run(new TextEditor.LempDemoForm()); return; } KnownOptions["editor"] = Pair.Create("", "Show built-in text editor"); Severity minSeverity = Severity.NoteDetail; #if DEBUG minSeverity = Severity.DebugDetail; #endif var filter = new SeverityMessageFilter(ConsoleMessageSink.Value, minSeverity); Compiler c = new Compiler(filter, typeof(BuiltinMacros)); var argList = args.ToList(); var options = c.ProcessArguments(argList, false, true); if (options == null) { return; // error occurred, message should have printed already } if (argList.Count == 0) { filter.Error(null, "No input files provided, stopping."); return; } if (!MaybeShowHelp(options, KnownOptions)) { WarnAboutUnknownOptions(options, filter, KnownOptions.With("nologo", Pair.Create("", ""))); using (LNode.SetPrinter(EcsLanguageService.WithPlainCSharpPrinter)) c.Run(); } }
public static void Main(params string[] args) { MMap <string, Pair <string, string> > KnownOptions = LeMP.Compiler.KnownOptions; if (args.Length != 0) { Severity minSeverity = Severity.NoteDetail; #if DEBUG minSeverity = Severity.DebugDetail; #endif var filter = new SeverityMessageFilter(ConsoleMessageSink.Value, minSeverity - 1); LeMP.Compiler c = new LeMP.Compiler(filter, typeof(LeMP.Prelude.BuiltinMacros)); var argList = args.ToList(); var options = c.ProcessArguments(argList, false, true); if (!LeMP.Compiler.MaybeShowHelp(options, KnownOptions)) { LeMP.Compiler.WarnAboutUnknownOptions(options, ConsoleMessageSink.Value, KnownOptions.With("nologo", Pair.Create("", ""))); if (c.Files.Count == 0) { ConsoleMessageSink.Value.Warning(null, "No files specified, stopping."); } else { c.MacroProcessor.PreOpenedNamespaces.Add(GSymbol.Get("LeMP.Prelude.Les")); c.MacroProcessor.PreOpenedNamespaces.Add(GSymbol.Get("LeMP.Prelude")); c.MacroProcessor.PreOpenedNamespaces.Add(Loyc.LLPG.Macros.MacroNamespace); c.AddMacros(typeof(LeMP.StandardMacros).Assembly); c.AddMacros(Assembly.GetExecutingAssembly()); c.Run(); } } } else { LeMP.Compiler.ShowHelp(KnownOptions.OrderBy(p => p.Key)); Test_LLLPG(); } }