use of org.freud.analysed.javasource.parser.JavaParser in project freud by LMAX-Exchange.
the class JavaSourceJdomParser method parseJavaSourceToDocument.
private static Document parseJavaSourceToDocument(final Reader javaSourceReader) throws RecognitionException, IOException {
JavaParser parser = new JavaParser(new CommonTokenStream(new JavaLexer(new ANTLRReaderStream(javaSourceReader))));
final JdomTreeAdaptor treeAdaptor = new JdomTreeAdaptor(JAVA_SOURCE_ROOT_ELEMENT_NAME, JAVA_SOURCE_TOKEN_TYPES);
parser.setTreeAdaptor(treeAdaptor);
parser.compilationUnit();
return treeAdaptor.getDocument();
}
Aggregations