@NotNull CharSequence applyTemplateDataModifications(@NotNull CharSequence sourceCode, @NotNull TemplateDataModifications modifications) {
    assert myOuterAndRemoveRanges.isEmpty();
    List<TextRange> ranges = modifications.myOuterAndRemoveRanges;
    if (ranges.isEmpty()) return sourceCode;
    for (TextRange range : ranges) {
      if (range instanceof RangeToRemove) {
        if (range.isEmpty()) continue;
        assertRangeOrder(range);
        CharSequence textToRemove = ((RangeToRemove)range).myTextToRemove;
        assert textToRemove != null;
        myOuterAndRemoveRanges.add(new RangeToRemove(range.getStartOffset(), textToRemove));
      }
      else {
        addOuterRange(range, range instanceof InsertionRange);
      }
    }

    return applyOuterAndRemoveRanges(sourceCode);
  }
@NotNull CharSequence applyTemplateDataModifications(@NotNull CharSequence sourceCode, @NotNull TemplateDataModifications modifications)