loopReplacer method

dynamic loopReplacer(
  1. dynamic match,
  2. dynamic s,
  3. dynamic e,
  4. dynamic snippet,
)

Implementation

loopReplacer(match, s, e, snippet) {
  var string = '';

  int start = int.parse(s);
  int end = int.parse(e);

  for (var i = start; i < end; i++) {
    snippet = snippet
      ..replaceAll(RegExp(r"\[\s*i\s*\]"), '[ $i ]')
      ..replaceAll(RegExp(r"UNROLLED_LOOP_INDEX"), i);

    string += snippet;
  }

  return string;
}