public static ProgramContext parseProgram(String program, ANTLRErrorListener errorListener) throws IOException
{
CharStream inputCharStream = new ANTLRInputStream(new StringReader(program));
TokenSource tokenSource = new ArithmeticLexer(inputCharStream);
TokenStream inputTokenStream = new CommonTokenStream(tokenSource);
ArithmeticParser parser = new ArithmeticParser(inputTokenStream);
parser.addErrorListener(errorListener);
ProgramContext context = parser.program();
return context;
}
TestArithmeticParser.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:arithmetic
作者:
评论列表
文章目录