public static SyntaxError getErrorUnderCursor(java.util.List<SyntaxError> errors, int offset) {
for (SyntaxError e : errors) {
int a, b;
RecognitionException cause = e.getException();
if ( cause instanceof LexerNoViableAltException) {
a = ((LexerNoViableAltException) cause).getStartIndex();
b = ((LexerNoViableAltException) cause).getStartIndex()+1;
}
else {
Token offendingToken = (Token)e.getOffendingSymbol();
a = offendingToken.getStartIndex();
b = offendingToken.getStopIndex()+1;
}
if ( offset >= a && offset < b ) { // cursor is over some kind of error
return e;
}
}
return null;
}
ParsingUtils.java 文件源码
java
阅读 26
收藏 0
点赞 0
评论 0
项目:intellij-plugin-v4
作者:
评论列表
文章目录