Antlr4.AntlrTool.ProcessGrammarsOnCommandLine C# (CSharp) Метод

ProcessGrammarsOnCommandLine() публичный Метод

public ProcessGrammarsOnCommandLine ( ) : void
Результат void
        public virtual void ProcessGrammarsOnCommandLine()
        {
            IList<GrammarRootAST> sortedGrammars = SortGrammarByTokenVocab(grammarFiles);

            foreach (GrammarRootAST t in sortedGrammars)
            {
                Grammar g = CreateGrammar(t);
                g.fileName = t.fileName;
                if (gen_dependencies)
                {
                    BuildDependencyGenerator dep =
                        new BuildDependencyGenerator(this, g);
                    //IList<string> outputFiles = dep.GetGeneratedFileList();
                    //IList<string> dependents = dep.GetDependenciesFileList();
                    //System.Console.WriteLine("output: " + outputFiles);
                    //System.Console.WriteLine("dependents: " + dependents);
                    System.Console.WriteLine(dep.GetDependencies().Render());
                }
                else if (errMgr.GetNumErrors() == 0)
                {
                    Process(g, true);
                }
            }
        }

Usage Example

Пример #1
0
        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);
        }
All Usage Examples Of Antlr4.AntlrTool::ProcessGrammarsOnCommandLine