private <O> ConfigExpression.Match<I, O> parseMatch(Object match, boolean allowElse, Class<O> output) {
    List<MultiExpression.Entry<ConfigExpression<I, O>>> conditions = new ArrayList<>();
    ConfigExpression<I, O> fallback = constOf(null);
    if (match instanceof Collection<?> items) {
      for (var item : items) {
        if (item instanceof Map<?, ?> map) {
          if (map.keySet().equals(Set.of("if", "value"))) {
            conditions.add(MultiExpression.entry(parse(map.get("value"), output),
              BooleanExpressionParser.parse(map.get("if"), tagValueProducer, input)));
          } else if (allowElse && map.keySet().equals(Set.of("else"))) {
            fallback = parse(map.get("else"), output);
            break;
          } else {
            throw new ParseException(
              "Invalid match case. Expected if/then" + (allowElse ? " or else" : "") + ", got: " + match);
          }
        }
      }
    } else if (match instanceof Map<?, ?> map) {
      for (var entry : map.entrySet()) {
        String value = Objects.toString(entry.getValue());
        if (value.matches("^_*(default_value|otherwise|default)_*$")) {
          fallback = parse(entry.getKey(), output);
        } else {
          conditions.add(MultiExpression.entry(parse(entry.getKey(), output),
            BooleanExpressionParser.parse(entry.getValue(), tagValueProducer, input)));
        }
      }
    } else {
      throw new ParseException("Invalid match block. Expected a list or map, but got: " + match);
    }
    return ConfigExpression.match(signature(output), MultiExpression.ofOrdered(List.copyOf(conditions)), fallback);
  }
Attempts to evaluate {@code expression} from a yaml config, using only globally-available environmental variables
from the {@code root} context.
planetiler-custommap/src/main/java/com/onthegomap/planetiler/custommap/ConfigExpressionParser.java