@@ 1232,13 1232,6 @@ const Template = struct {
const Tokens = std.MultiArrayList(Token);
- fn readByte(reader: anytype) !?u8 {
- return reader.readByte() catch |err| switch (err) {
- error.EndOfStream => null,
- else => |other_err| return other_err,
- };
- }
-
fn parseVariableStart(text: []const u8, start: usize) ?ParseResult(Variable) {
if (parseLiteral(text, start, "{{")) |index| {
if (index >= text.len) return null;
@@ 1340,28 1333,6 @@ const Template = struct {
}
}
- fn logTokens(tokens: Tokens, text: []const u8) void {
- const positions = tokens.items(.position);
- const values = tokens.items(.value);
- for (tokens.items(.type)) |tag, i| {
- std.debug.print("{d: >2} {d: >3} {s}", .{ i, positions[i], @tagName(tag) });
- switch (tag) {
- .variable => {
- std.debug.print(" {s}", .{@tagName(values[i].variable)});
- },
- .text => {
- const preview = content(positions, i, text);
- std.debug.print(" \x1B[37m{s}\x1B[0m", .{preview});
- },
- .conditional => {
- std.debug.print("->{d}", .{values[i].jump});
- },
- else => {},
- }
- std.debug.print("\n", .{});
- }
- }
-
fn format(
template: Tokens,
text: []const u8,