| ... | ... | @@ -660,21 +660,28 @@ const Case = struct { |
| 660 | 660 | if (root_source_file == null) |
| 661 | 661 | root_source_file = val; |
| 662 | 662 | |
| 663 | | const start_index = it.index.?; |
| 664 | | const src = while (true) : (line_n += 1) { |
| 663 | // Because Windows is so excellent, we need to convert CRLF to LF, so |
| 664 | // can't just slice into the input here. How delightful! |
| 665 | var src: std.ArrayListUnmanaged(u8) = .empty; |
| 666 | |
| 667 | while (true) { |
| 665 | 668 | const old = it; |
| 666 | | const next_line = it.next() orelse fatal("line {d}: unexpected EOF", .{line_n}); |
| 669 | const next_line_raw = it.next() orelse fatal("line {d}: unexpected EOF", .{line_n}); |
| 670 | const next_line = std.mem.trimRight(u8, next_line_raw, "\r"); |
| 667 | 671 | if (std.mem.startsWith(u8, next_line, "#")) { |
| 668 | | const end_index = old.index.?; |
| 669 | | const src = bytes[start_index..end_index]; |
| 670 | 672 | it = old; |
| 671 | | break src; |
| 673 | break; |
| 672 | 674 | } |
| 673 | | }; |
| 675 | line_n += 1; |
| 676 | |
| 677 | try src.ensureUnusedCapacity(arena, next_line.len + 1); |
| 678 | src.appendSliceAssumeCapacity(next_line); |
| 679 | src.appendAssumeCapacity('\n'); |
| 680 | } |
| 674 | 681 | |
| 675 | 682 | try changes.append(arena, .{ |
| 676 | 683 | .name = val, |
| 677 | | .bytes = src, |
| 684 | .bytes = src.items, |
| 678 | 685 | }); |
| 679 | 686 | } else if (std.mem.eql(u8, key, "rm_file")) { |
| 680 | 687 | if (updates.items.len == 0) fatal("line {d}: rm_file directive before update", .{line_n}); |