docs: private TreeMap<Integer, TreeRule> fetchRuleLevel() {
      TreeMap<Integer, TreeRule> current_level = null;
      
      // iterate until we find some rules on a level or we run out
      while (current_level == null && rule_idx <= max_rule_level) {
        current_level = tree.getRules().get(rule_idx);
        if (current_level != null) {
          return current_level;
        } else {
          rule_idx++;
        }
      }
      
      // no more levels
      return null;
    }