Search in sources :

Example 1 with GroovydocVisitor

use of org.apache.groovy.antlr.GroovydocVisitor in project groovy by apache.

the class GroovyDocParser method parseGroovy.

private Map<String, GroovyClassDoc> parseGroovy(String packagePath, String file, String src) throws RuntimeException {
    CompilerConfiguration config = new CompilerConfiguration();
    config.getOptimizationOptions().put(CompilerConfiguration.GROOVYDOC, true);
    CompilationUnit compUnit = new CompilationUnit(config);
    SourceUnit unit = new SourceUnit(file, src, config, null, new ErrorCollector(config));
    compUnit.addSource(unit);
    compUnit.compile(Phases.CONVERSION);
    ModuleNode root = unit.getAST();
    GroovydocVisitor visitor = new GroovydocVisitor(unit, packagePath, links);
    visitor.visitClass(root.getClasses().get(0));
    return visitor.getGroovyClassDocs();
}
Also used : CompilationUnit(org.codehaus.groovy.control.CompilationUnit) CompilerConfiguration(org.codehaus.groovy.control.CompilerConfiguration) ErrorCollector(org.codehaus.groovy.control.ErrorCollector) SourceUnit(org.codehaus.groovy.control.SourceUnit) GroovydocVisitor(org.apache.groovy.antlr.GroovydocVisitor) ModuleNode(org.codehaus.groovy.ast.ModuleNode)

Aggregations

GroovydocVisitor (org.apache.groovy.antlr.GroovydocVisitor)1 ModuleNode (org.codehaus.groovy.ast.ModuleNode)1 CompilationUnit (org.codehaus.groovy.control.CompilationUnit)1 CompilerConfiguration (org.codehaus.groovy.control.CompilerConfiguration)1 ErrorCollector (org.codehaus.groovy.control.ErrorCollector)1 SourceUnit (org.codehaus.groovy.control.SourceUnit)1