private static void appendBufferedSectionRules(@NotNull List<? super ArrangementSectionRule> result,
                                                 @NotNull List<? extends StdArrangementMatchRule> buffer,
                                                 @Nullable String currentSectionStart) {
    if (currentSectionStart == null) {
      return;
    }

    if (buffer.isEmpty()) {
      result.add(ArrangementSectionRule.create(currentSectionStart, null));
    }
    else {
      result.add(ArrangementSectionRule.create(currentSectionStart, null, buffer.get(0)));
      for (int j = 1; j < buffer.size(); j++) {
        result.add(ArrangementSectionRule.create(buffer.get(j)));
      }
      buffer.clear();
    }
  }
private static void appendBufferedSectionRules(@NotNull List<? super ArrangementSectionRule> result,
                                                 @NotNull List<? extends StdArrangementMatchRule> buffer,
                                                 @Nullable String currentSectionStart)