code: public Token getMatchedToken(final int tokenType) throws RecognitionException {
          Token result = parser.getCurrentToken();
          boolean isIdentifierCompatible = false;
          if (identifierTokenIndex == tokenType && identifierTokenIndex > result.getType()) {
              isIdentifierCompatible = true;
          }
          if (result.getType() == tokenType || isIdentifierCompatible) {
              if (Token.EOF != tokenType && isIdentifierCompatible && result instanceof CommonToken) {
                  ((CommonToken) result).setType(identifierTokenIndex);
              }
              parser.getErrorHandler().reportMatch(parser);
              parser.consume();
          } else {
              result = parser.getErrorHandler().recoverInline(parser);
              if (parser.getBuildParseTree() && -1 == result.getTokenIndex()) {
                  parser.getContext().addErrorNode(parser.createErrorNode(parser.getContext(), result));
              }
          }
          return result;
      }
docs: Get matched token by token type.
  
  @param tokenType token type
  @return matched token
  @throws RecognitionException mismatch throw exception