loopReplacer method

dynamic loopReplacer(
  1. dynamic match,
  2. dynamic start,
  3. dynamic end,
  4. dynamic snippet,
)

Implementation

loopReplacer(match, start, end, snippet) {
  var string = '';

  int _start = int.parse(start);
  int _end = int.parse(end);

  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;
}