예제 #1
0
파일: Program.cs 프로젝트: jonathanvdc/Loyc
		public static void Main(params string[] args)
		{
			MMap<string, Pair<string, string>> KnownOptions = LeMP.Compiler.KnownOptions;
			if (args.Length != 0) {
				Severity minSeverity = Severity.Note;
				#if DEBUG
				minSeverity = Severity.Debug;
				#endif
				var filter = new SeverityMessageFilter(MessageSink.Console, minSeverity);

				LeMP.Compiler c = new LeMP.Compiler(filter, typeof(LeMP.Prelude.BuiltinMacros));
				var argList = args.ToList();
				var options = c.ProcessArguments(argList, false, true);
				if (options != null) {
					LeMP.Compiler.WarnAboutUnknownOptions(options, MessageSink.Console, 
						KnownOptions.With("nologo", Pair.Create("","")));
					if (c != null) {
						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();
			}
		}
예제 #2
0
        public static void Main(params string[] args)
        {
            IDictionary <string, Pair <string, string> > KnownOptions = LeMP.Compiler.KnownOptions;

            if (args.Length != 0)
            {
                BMultiMap <string, string> options = new BMultiMap <string, string>();

                var argList = args.ToList();
                UG.ProcessCommandLineArguments(argList, options, "", LeMP.Compiler.ShortOptions, LeMP.Compiler.TwoArgOptions);
                if (!options.ContainsKey("nologo"))
                {
                    Console.WriteLine("LLLPG/LeMP macro compiler");
                }

                string _;
                if (options.TryGetValue("help", out _) || options.TryGetValue("?", out _) || args.Length == 0)
                {
                    LeMP.Compiler.ShowHelp(KnownOptions.OrderBy(p => p.Key));
                    return;
                }

                Severity minSeverity = Severity.Note;
                                #if DEBUG
                minSeverity = Severity.Debug;
                                #endif
                var filter = new SeverityMessageFilter(MessageSink.Console, minSeverity);

                LeMP.Compiler c = LeMP.Compiler.ProcessArguments(options, filter, typeof(LeMP.Prelude.Les.Macros), argList);
                LeMP.Compiler.WarnAboutUnknownOptions(options, MessageSink.Console, KnownOptions);
                if (c != null)
                {
                    c.MacroProcessor.PreOpenedNamespaces.Add(GSymbol.Get("LeMP.Prelude"));
                    c.MacroProcessor.PreOpenedNamespaces.Add(Loyc.LLPG.Macros.MacroNamespace);
                    c.AddMacros(Assembly.GetExecutingAssembly());
                    c.AddMacros(typeof(LeMP.Prelude.Macros).Assembly);
                    c.Run();
                }
            }
            else
            {
                LeMP.Compiler.ShowHelp(KnownOptions.OrderBy(p => p.Key));
                Tests();
                Ecs.Program.Main(args);                 // do EC# tests
            }
        }
예제 #3
0
        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();
            }
        }