/**
* Sets up the Java parser.
* @param javaFile the Java contents to parse.
* @return the {@link JavaParser} instance.
* @throws RecognitionException if the format is invalid.
* @throws IOException if the source cannot be read.
*/
@SuppressWarnings("unchecked")
@NotNull
protected JavaParser setUpParser(@NotNull final File javaFile)
throws RecognitionException,
IOException
{
@NotNull final JavaParser result;
@NotNull final JavaLexer t_Lexer =
new JavaLexer(new ANTLRFileStream(javaFile.getAbsolutePath()));
@NotNull final ANTLRErrorListener errorListener = new PropagatingErrorListener(javaFile);
t_Lexer.addErrorListener(errorListener);
@NotNull final CommonTokenStream t_Tokens = new CommonTokenStream(t_Lexer);
result = new JavaParser(t_Tokens);
result.addErrorListener(errorListener);
return result;
}
AbstractTemplatesTest.java 文件源码
java
阅读 20
收藏 0
点赞 0
评论 0
项目:queryj
作者:
评论列表
文章目录