private void verifyCloseBraceStyle(ParseTree closeBrace, ParseTree closeBraceLeftSibling, String constructName) {
Token closeBraceToken = ((TerminalNodeImpl)closeBrace).getSymbol();
Location closeBraceLocation = ListenerUtil.getTokenLocation(closeBraceToken);
if (commentLeftOfCloseBrace(closeBraceToken)) {
this.printer.warn(Rules.BRACE_STYLE, constructName + Messages.CLOSE_BRACE_STYLE, closeBraceLocation);
return;
}
Location closeBraceLeftSiblingLocation = ListenerUtil.getParseTreeStopLocation(closeBraceLeftSibling);
if (closeBraceLocation.line == closeBraceLeftSiblingLocation.line) {
if (!closeBraceLeftSibling.getText().equals("{")) {
this.printer.warn(Rules.BRACE_STYLE, constructName + Messages.CLOSE_BRACE_STYLE, closeBraceLocation);
} else if (closeBraceLocation.column - closeBraceLeftSiblingLocation.column != 1) {
this.printer.warn(Rules.BRACE_STYLE, Messages.EMPTY_BODY, closeBraceLeftSiblingLocation);
}
}
}
BraceStyleListener.java 文件源码
java
阅读 20
收藏 0
点赞 0
评论 0
项目:tailor
作者:
评论列表
文章目录