private static void expandMacro(Macro macro, @NotNull MacroExpander expander, StringBuilder builder) throws ExecutionCancelledException {
    int offset = 0;
    TextRange range;
    while (offset >= 0 && offset < builder.length() && (range = macro.findOccurence(builder, offset)) != null ) {
      String occurence = builder.substring(range.getStartOffset(), range.getEndOffset());
      String value = StringUtil.notNullize(expander.expand(macro, occurence));
      builder.replace(range.getStartOffset(), range.getEndOffset(), value);
      offset += value.length();
    }
  }
private static void expandMacro(Macro macro, @NotNull MacroExpander expander, StringBuilder builder)