TestParse.java 文件源码

java
阅读 31 收藏 0 点赞 0 评论 0

项目:Ultrastructure 作者:
@Test
public void testParse() throws Exception {
    WorkspaceLexer l = new WorkspaceLexer(CharStreams.fromStream(getClass().getResourceAsStream("/thing.wsp")));
    WorkspaceParser p = new WorkspaceParser(new CommonTokenStream(l));
    p.addErrorListener(new BaseErrorListener() {
        @Override
        public void syntaxError(Recognizer<?, ?> recognizer,
                                Object offendingSymbol, int line,
                                int charPositionInLine, String msg,
                                RecognitionException e) {
            throw new IllegalStateException("failed to parse at line "
                                            + line + " due to " + msg, e);
        }
    });
    p.workspace();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号