void _parse()

in packages/code_excerpt_updater/lib/src/diff/diff.dart [62:81]


  void _parse() {
    if (_parsed || _rawText.isEmpty) return;
    _parsed = true;
    final lines = _rawText.split(eol);

    fileInfo[0] = lines[0];
    fileInfo[1] = lines[1];

    var i = 2;
    hunks.clear();
    while (i < lines.length) {
      if (!lines[i].startsWith('@@')) throw _invalidHunk(i);
      final start = i++;
      // Look for the start of the next hunk or the end of the diff
      while (i < lines.length && !lines[i].startsWith('@@')) {
        i++;
      }
      hunks.add(Hunk(lines.skip(start).take(i - start).join(eol)));
    }
  }