code: @Override
      public void syntaxError(BaseRecognizer recognizer, String[] tokenNames, RecognitionException e)
      {
          String hdr = recognizer.getErrorHeader(e);
          String msg = recognizer.getErrorMessage(e, tokenNames);
  
          StringBuilder builder = new StringBuilder().append(hdr)
                  .append(' ')
                  .append(msg);
  
          if (recognizer instanceof Parser)
              appendQuerySnippet((Parser) recognizer, builder);
  
          errorMsgs.add(builder.toString());
      }
docs: {@inheritDoc}