public void handleToken(ParseContext ctx) throws InvalidQueryException {
      Token token = ctx.getTokens()[ctx.getCurrentTokensIndex()];
      if (! validate(ctx.getPreviousTokenType())) {
        throw new InvalidQueryException("Unexpected token encountered in query string. Last Token Type=" +
            ctx.getPreviousTokenType() + ", Current Token[type=" + token.getType() +
            ", value='" + token.getValue() + "']");
      }
      ctx.setTokenType(token.getType());

      int idxIncrement = _handleToken(ctx);
      ctx.setCurrentTokensIndex(ctx.getCurrentTokensIndex() + idxIncrement);
    }
Process a token. Handles common token processing functionality then delegates to the individual
concrete handlers.

@param ctx    the current parse context
@throws InvalidQueryException if unable to process the token
ambari-server/src/main/java/org/apache/ambari/server/api/predicate/QueryParser.java