private boolean tokenTypesMatch(Token token1, Token token2, Class<? extends Token> tokenType) {
        return tokenType.isAssignableFrom(token1.getClass()) && tokenType.isAssignableFrom(token2.getClass());
    }
private boolean tokenTypesMatch ( Token token1 , Token token2 , Class < ? extends Token > tokenType ) { return tokenType . isAssignableFrom ( token1 . getClass ( ) ) && tokenType . isAssignableFrom ( token2 . getClass ( ) ) ; }
Checks whether both tokens have the specified type.

@param token1    The first token to check.
@param token2    The second token to check.
@param tokenType The type that both tokens must have.
@return {@literal true} if both tokens have the specified type, and {@literal false} otherwise.