Пример #1
0
        public static int Main(string[] args)
        {
            Location.InEmacs = Environment.GetEnvironmentVariable("EMACS") == "t";

            CommandLineParser cmd = new CommandLineParser(Console.Out);
            var settings          = cmd.ParseArguments(args);

            if (settings == null)
            {
                return(1);
            }

            if (cmd.HasBeenStopped)
            {
                return(0);
            }

            Driver d = new Driver(new CompilerContext(settings, new ConsoleReportPrinter()));

            if (d.Compile() && d.Report.Errors == 0)
            {
                if (d.Report.Warnings > 0)
                {
                    Console.WriteLine("Compilation succeeded - {0} warning(s)", d.Report.Warnings);
                }
                Environment.Exit(0);
                return(0);
            }


            Console.WriteLine("Compilation failed: {0} error(s), {1} warnings",
                              d.Report.Errors, d.Report.Warnings);
            Environment.Exit(1);
            return(1);
        }
Пример #2
0
        public static bool InvokeCompiler(string [] args, TextWriter error)
        {
            try {
                CommandLineParser cmd = new CommandLineParser(error);
                var setting           = cmd.ParseArguments(args);
                if (setting == null)
                {
                    return(false);
                }

                var d = new Driver(new CompilerContext(setting, new StreamReportPrinter(error)));
                return(d.Compile());
            } finally {
                Reset();
            }
        }
Пример #3
0
		public static bool InvokeCompiler (string [] args, TextWriter error)
		{
			try {
				CommandLineParser cmd = new CommandLineParser (error);
				var setting = cmd.ParseArguments (args);
				if (setting == null)
					return false;

				var d = new Driver (new CompilerContext (setting, new StreamReportPrinter (error)));
				return d.Compile ();
			} finally {
				Reset ();
			}
		}
Пример #4
0
		public static int Main (string[] args)
		{
			Location.InEmacs = Environment.GetEnvironmentVariable ("EMACS") == "t";

			CommandLineParser cmd = new CommandLineParser (Console.Out);
			var settings = cmd.ParseArguments (args);
			if (settings == null)
				return 1;

			if (cmd.HasBeenStopped)
				return 0;

			Driver d = new Driver (new CompilerContext (settings, new ConsoleReportPrinter ()));

			if (d.Compile () && d.Report.Errors == 0) {
				if (d.Report.Warnings > 0) {
					Console.WriteLine ("Compilation succeeded - {0} warning(s)", d.Report.Warnings);
				}
				Environment.Exit (0);
				return 0;
			}
			
			
			Console.WriteLine("Compilation failed: {0} error(s), {1} warnings",
				d.Report.Errors, d.Report.Warnings);
			Environment.Exit (1);
			return 1;
		}