/**
* 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;
}
Bibitem.java 文件源码
java
阅读 16
收藏 0
点赞 0
评论 0
项目:bibrarian
作者:
评论列表
文章目录