public static bool MaybeShowHelp(ICollection <KeyValuePair <string, string> > options, ICollection <KeyValuePair <string, Pair <string, string> > > knownOptions, TextWriter @out = null) { if (options.Contains(Pair.Create("help", (string)null)) || options.Contains(Pair.Create("?", (string)null))) { ShowHelp(KnownOptions.OrderBy(p => p.Key), @out); return(true); } return(false); }
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(); } }