private Expression parse(Object object, Function<List<Expression>, Expression> collector) {
    if (object == null) {
      return Expression.FALSE;
    } else if (object instanceof String s && s.trim().equalsIgnoreCase("__any__")) {
      return Expression.TRUE;
    } else if (ConfigExpressionScript.isScript(object)) {
      return BooleanExpressionScript.script(ConfigExpressionScript.extractScript(object), context);
    } else if (object instanceof Map<?, ?> map) {
      return parseMapMatch(map, collector);
    } else if (object instanceof Collection<?> list) {
      return collector.apply(list.stream().map(this::parse).toList());
    } else {
      throw new ParseException("Unsupported object for matcher input: " + object);
    }
  }
Returns a boolean expression that determines whether a source feature matches a criteria defined in yaml config.

@param <T>              Type of input the expression takes
@param object           a map or list of tag criteria
@param tagValueProducer a TagValueProducer
@return a predicate which returns true if this criteria matches
planetiler-custommap/src/main/java/com/onthegomap/planetiler/custommap/BooleanExpressionParser.java