示例#1
0
  /**
   * Creates the error/warning message that we need to show users/IDEs when ANTLR has found a
   * parsing error, has recovered from it and is now telling us that a parsing exception occurred.
   *
   * @param tokenNames token names as known by ANTLR (which we ignore)
   * @param e The exception that was thrown
   */
  @Override
  public void displayRecognitionError(String[] tokenNames, RecognitionException e) {

    // This is just a place holder that shows how to override this method
    //
    super.displayRecognitionError(tokenNames, e);
  }
 @Override
 public void recover(IntStream stream, RecognitionException ex) {
   if (recoveryListener != null) recoveryListener.beginErrorRecovery();
   removeUnexpectedElements();
   if (ex instanceof FailedPredicateException && ex.token.getType() == Token.EOF) {
     failedPredicateAtEOF = true;
   }
   super.recover(stream, ex);
   if (recoveryListener != null) recoveryListener.endErrorRecovery();
 }