Ejemplo n.º 1
0
        [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());
            }

            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 (!MaybeShowHelp(options, KnownOptions))
            {
                WarnAboutUnknownOptions(options, filter, KnownOptions);

                if (c.Files.Count == 0)
                {
                    Console.WriteLine();
                    filter.Error(null, "No input files provided, stopping. Add --help for usage info.".Localized());
                    if (!options.ContainsKey("nologo"))
                    {
                        // Give users a simple way to find out which copy they're using:
                        // Windows doesn't have `which` and the dotnet tools version of
                        // LeMP.exe is not the real one anyway (it's not a .NET module)
                        Console.WriteLine("You're using {0}".Localized(typeof(MacroProcessor).Assembly.Location));
                        Console.WriteLine("  ({0})".Localized(typeof(MacroProcessor).Assembly.FullName));
                    }
                    return;
                }
                else
                {
                    using (LNode.SetPrinter(EcsLanguageService.WithPlainCSharpPrinter))
                        c.Run();
                }
            }
        }
Ejemplo n.º 2
0
        [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();
            }
        }
Ejemplo n.º 3
0
		[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 (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();
			}
		}