public OutputModelObject buildLexerOutputModel(SourceType sourceType) {
		CodeGenerator gen = delegate.getGenerator();
		LexerFile file = lexerFile(gen.getRecognizerFileName(sourceType));
		setRoot(file);
		file.lexer = lexer(file);

		Grammar g = delegate.getGrammar();
		for (Rule r : g.rules.values()) {
			buildLexerRuleActions(file.lexer, r);
		}

		return file;
	}
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.
tool/src/org/antlr/v4/codegen/OutputModelController.java