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

    if (e instanceof NoViableAltException) {
      //NoViableAltException nvae = (NoViableAltException) e;
      // for development, can add
      // "decision=<<"+nvae.grammarDecisionDescription+">>"
      // and "(decision="+nvae.decisionNumber+") and
      // "state "+nvae.stateNumber
      msg = "character " + getCharErrorDisplay(e.c) + " not supported here";
    } else {
      msg = super.getErrorMessage(e, tokenNames);
    }

    return msg;
  }
Common class of Legacy and SQL Standard Hive Lexer.
parser/src/java/org/apache/hadoop/hive/ql/parse/GenericHiveLexer.java