BQLCompiler.java 文件源码

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

项目:linden 作者:
public String getErrorMessage(ParseCancellationException error) {
  if (error.getCause() != null) {
    String message = error.getCause().getMessage();
    if (error.getCause() instanceof SemanticException) {
      SemanticException semanticException = (SemanticException) error.getCause();
      if (semanticException.getNode() != null) {
        TerminalNode startNode = getStartNode(semanticException.getNode());
        if (startNode != null) {
          String prefix = String.format("[line:%d, col:%d] ", startNode.getSymbol().getLine(),
              startNode.getSymbol().getCharPositionInLine());
          message = prefix + message;
        }
      }
      return message;
    } else if (error.getCause() instanceof RecognitionException) {
      return getErrorMessage((RecognitionException) error.getCause());
    } else {
      return error.getCause().getMessage();
    }
  }

  return error.getMessage();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号