Search in sources :

Example 1 with ParserFile

use of org.antlr.v4.codegen.model.ParserFile in project antlr4 by antlr.

the class OutputModelController method buildParserOutputModel.

/** Build a file with a parser containing rule functions. Use the
	 *  controller as factory in SourceGenTriggers so it triggers codegen
	 *  extensions too, not just the factory functions in this factory.
	 */
public OutputModelObject buildParserOutputModel(boolean header) {
    CodeGenerator gen = delegate.getGenerator();
    ParserFile file = parserFile(gen.getRecognizerFileName(header));
    setRoot(file);
    file.parser = parser(file);
    Grammar g = delegate.getGrammar();
    for (Rule r : g.rules.values()) {
        buildRuleFunction(file.parser, r);
    }
    return file;
}
Also used : Grammar(org.antlr.v4.tool.Grammar) Rule(org.antlr.v4.tool.Rule) LeftRecursiveRule(org.antlr.v4.tool.LeftRecursiveRule) ParserFile(org.antlr.v4.codegen.model.ParserFile)

Aggregations

ParserFile (org.antlr.v4.codegen.model.ParserFile)1 Grammar (org.antlr.v4.tool.Grammar)1 LeftRecursiveRule (org.antlr.v4.tool.LeftRecursiveRule)1 Rule (org.antlr.v4.tool.Rule)1