@Override
	  public String getErrorMessage(RecognitionException e, String[] tokenNames) {
	    String msg = null;

	    // Translate the token names to something that the user can understand
	    String[] xlateNames = new String[tokenNames.length];
	    for (int i = 0; i < tokenNames.length; ++i) {
	      xlateNames[i] = HiveParser.xlate(tokenNames[i]);
	    }

	    if (e instanceof NoViableAltException) {
	      @SuppressWarnings("unused")
	      NoViableAltException nvae = (NoViableAltException) e;
	      // for development, can add
	      // "decision=<<"+nvae.grammarDecisionDescription+">>"
	      // and "(decision="+nvae.decisionNumber+") and
	      // "state "+nvae.stateNumber
	      msg = "cannot recognize input near"
	              + (input.LT(1) != null ? " " + getTokenErrorDisplay(input.LT(1)) : "")
	              + (input.LT(2) != null ? " " + getTokenErrorDisplay(input.LT(2)) : "")
	              + (input.LT(3) != null ? " " + getTokenErrorDisplay(input.LT(3)) : "");
	    } else if (e instanceof MismatchedTokenException) {
	      MismatchedTokenException mte = (MismatchedTokenException) e;
	      msg = super.getErrorMessage(e, xlateNames) + (input.LT(-1) == null ? "":" near '" + input.LT(-1).getText()) + "'";
	    } else if (e instanceof FailedPredicateException) {
	      FailedPredicateException fpe = (FailedPredicateException) e;
	      msg = "Failed to recognize predicate '" + fpe.token.getText() + "'. Failed rule: '" + fpe.ruleName + "'";
	    } else {
	      msg = super.getErrorMessage(e, xlateNames);
	    }

	    if (msgs.size() > 0) {
	      msg = msg + " in " + msgs.peek();
	    }
	    return msg;
	  }