code: public static <T> Parser<T> token(final TokenMap<? extends T> fromToken) {
      return new Parser<T>() {
        @Override boolean apply(final ParseContext ctxt) {
          if (ctxt.isEof()) {
            ctxt.missing(fromToken);
            return false;
          }
          Token token = ctxt.getToken();
          Object v = fromToken.map(token);
          if (v == null) {
            ctxt.missing(fromToken);
            return false;
          }
          ctxt.result = v;
          ctxt.next();
          return true;
        }
        
        @Override public String toString() {
          return fromToken.toString();
        }
      };
    }
docs: Checks the current token with the {@code fromToken} object. If the
  {@link TokenMap#map(Token)} method returns null, an unexpected token error occurs;
  if the method returns a non-null value, the value is returned and the parser succeeds.
  
  @param fromToken the {@code FromToken} object.
  @return the new Parser object.