| ... | ... | @@ -19,13 +19,13 @@ pub fn parse(comptime input: []const u8) astgen.Value { |
| 19 | 19 | return astgen.Value{ .element = astgen.do(tokenize.do(input, &.{ '[', '=', ']', '(', ')', '{', '}', '#', '/', '.', '<', '>' })) }; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | | pub fn compile(alloc: *std.mem.Allocator, writer: anytype, comptime value: astgen.Value, data: anytype) !void { |
| 22 | pub fn compile(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Value, data: anytype) !void { |
| 23 | 23 | try writer.writeAll("<!DOCTYPE html>\n"); |
| 24 | 24 | try do(alloc, writer, value, data, data, 0, false); |
| 25 | 25 | try writer.writeAll("\n"); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | | fn do(alloc: *std.mem.Allocator, writer: anytype, comptime value: astgen.Value, data: anytype, ctx: anytype, indent: usize, flag1: bool) anyerror!void { |
| 28 | fn do(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Value, data: anytype, ctx: anytype, indent: usize, flag1: bool) anyerror!void { |
| 29 | 29 | switch (comptime value) { |
| 30 | 30 | .element => |v| { |
| 31 | 31 | const hastext = for (v.children) |x| { |
| ... | ... | @@ -249,7 +249,7 @@ fn contains(haystack: []const []const u8, needle: []const u8) bool { |
| 249 | 249 | return false; |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | | fn doif(alloc: *std.mem.Allocator, writer: anytype, comptime top: astgen.Value, comptime bottom: astgen.Value, data: anytype, ctx: anytype, indent: usize, flag1: bool, flag2: bool) anyerror!void { |
| 252 | fn doif(alloc: std.mem.Allocator, writer: anytype, comptime top: astgen.Value, comptime bottom: astgen.Value, data: anytype, ctx: anytype, indent: usize, flag1: bool, flag2: bool) anyerror!void { |
| 253 | 253 | if (flag2) { |
| 254 | 254 | try do(alloc, writer, top, data, ctx, indent, flag1); |
| 255 | 255 | } else { |
| ... | ... | @@ -257,7 +257,7 @@ fn doif(alloc: *std.mem.Allocator, writer: anytype, comptime top: astgen.Value, |
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | | fn docap(alloc: *std.mem.Allocator, writer: anytype, comptime top: astgen.Value, comptime bottom: astgen.Value, data: anytype, ctx: anytype, indent: usize, flag1: bool, flag2: anytype) anyerror!void { |
| 260 | fn docap(alloc: std.mem.Allocator, writer: anytype, comptime top: astgen.Value, comptime bottom: astgen.Value, data: anytype, ctx: anytype, indent: usize, flag1: bool, flag2: anytype) anyerror!void { |
| 261 | 261 | if (flag2) |_| { |
| 262 | 262 | try do(alloc, writer, top, data, ctx, indent, flag1); |
| 263 | 263 | } else { |