@Test
public void testParseWorkingExamples() throws IOException {
FileVisitor<Path> workingFilesVisitior = new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
System.out.println("Testing parser input from file \""+file.toString()+"\"");
ANTLRFileStream antlrStream = new ANTLRFileStream(file.toString());
MiniJLexer lexer = new MiniJLexer(antlrStream);
TokenStream tokens = new CommonTokenStream(lexer);
MiniJParser parser = new MiniJParser(tokens);
parser.setErrorHandler(new BailErrorStrategy());
parser.prog();
return super.visitFile(file, attrs);
}
};
Files.walkFileTree(EXAMPLE_PROGRAM_PATH_WORKING, workingFilesVisitior);
}
MiniJParserTest.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:MiniJCompiler
作者:
评论列表
文章目录