Bibitem.java 文件源码

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

项目:bibrarian 作者:
/**
 * Parse.
 * @param text Text to parse
 * @return Map of tags
 * @throws BibSyntaxException If fails
 */
private static Map<String, String> parse(final String text)
    throws BibSyntaxException {
    final BibLexer lexer = new BibLexer(new ANTLRInputStream(text));
    final TokenStream tokens = new CommonTokenStream(lexer);
    final BibParser parser = new BibParser(tokens);
    final Errors errors = new Errors();
    lexer.addErrorListener(errors);
    parser.addErrorListener(errors);
    final Map<String, String> map;
    try {
        map = parser.tags().map;
    } catch (final RecognitionException ex) {
        throw new BibSyntaxException(ex);
    }
    if (!Iterables.isEmpty(errors)) {
        throw new BibSyntaxException(
            Joiner.on("; ").join(errors)
        );
    }
    return map;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号