code: public static <T> Parser<T> tokenType(final Class<? extends T> type, final String name) {
      return token(new TokenMap<T>() {
        @Override public T map(Token token) {
          if (type.isInstance(token.value())) {
            return type.cast(token.value());
          }
          return null;
        }
        @Override public String toString() {
          return name;
        }
      });
    }
docs: Checks whether the current token value is of {@code type}, in which case, the token value is
  returned and parse succeeds.
  
  @param type the expected token value type.
  @param name the name of what's logically expected.
  @return the new Parser object.