diff options
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main.zig b/src/main.zig index 7a90f95..097252f 100644 --- a/src/main.zig +++ b/src/main.zig @@ -736,16 +736,17 @@ const Builder = struct { var offset: usize = 0; parseLn: while (true) { if (std.mem.findPos(u8, line, offset, DELIM_START)) |start| { - if (std.mem.findPos(u8, line, offset + start + 1, DELIM_END)) |end| { + if (std.mem.findPos(u8, line, start + 1, DELIM_END)) |end| { + // write out beginning of chunk try w.writeAll(line[offset..start]); // do templating - const ref_name = line[(offset + start + DELIM_START.len)..end]; + const ref_name = line[(start + DELIM_START.len)..end]; try self.template(io, gpa, ref_name, w, self.source.fd.handle == source.fd.handle); // advance offset - offset += end + DELIM_END.len; + offset = end + DELIM_END.len; } else break :parseLn; } else break :parseLn; } |