code: public Token expect(@Nonnull String expected, @Nonnull TokenValidator validator) throws IOException {
          if (!hasNext()) {
              throw eof("Expected %s, got end of file", expected);
          } else if (validator.validate(unreadToken)) {
              lastToken = unreadToken;
              unreadToken = null;
              return lastToken;
          }
          throw failure(unreadToken, "Expected %s, but got '%s'", expected, Strings.escape(unreadToken.asString()));
      }
docs: Expect at a valid token containing anything.
  
  @param expected The expectation description.
  @param validator Validator callback.
  @return The token.
  @throws IOException If failed to read a token.