Antlr4.AntlrTool.Main C# (CSharp) Method

Main() public static method

public static Main ( string args ) : int
args string
return int
        public static int Main(string[] args)
        {
            AntlrTool antlr = new AntlrTool(args);
            if (args.Length == 0)
            {
                antlr.Help();
                return 0;
            }

            try
            {
                antlr.ProcessGrammarsOnCommandLine();
            }
            finally
            {
                if (antlr.log)
                {
                    try
                    {
                        string logname = antlr.logMgr.Save();
                        System.Console.WriteLine("wrote " + logname);
                    }
                    catch (IOException ioe)
                    {
                        antlr.errMgr.ToolError(ErrorType.INTERNAL_ERROR, ioe);
                    }
                }
            }

            if (antlr.errMgr.GetNumErrors() > 0)
            {
                return 1;
            }

            return 0;
        }

Usage Example

Example #1
0
 private static void Main(string[] args)
 {
     Environment.ExitCode = AntlrTool.Main(args);
 }