authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-14 18:36:10 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-14 18:36:10 -07:00
loga7c053bacbdfcdfce905f93fc6f6629cd618939f
treee595f8ee77dad6b8ea553c92a8b32441ebf8e347
parent409601d50a476784d3872763077c816e53505d0a
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

switch to nio fmt


2 files changed, 9 insertions(+), 7 deletions(-)

src/lib.zig+8-7
......@@ -14,6 +14,7 @@ const root = @import("root");
1414const tracer = @import("tracer");
1515const extras = @import("extras");
1616const builtin = @import("builtin");
17const nio = @import("nio");
1718
1819const tokenize = @import("./tokenize.zig");
1920const astgen = @import("./astgen.zig");
......@@ -182,7 +183,7 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val
182183 try do(alloc, writer, body, null, extras.join(.{ ctx, .{ .this = item, .that = jtem } }), opts);
183184 }
184185 },
185 else => @compileError(std.fmt.comptimePrint("#each block cannot have {d} iterators", .{v.args.len})),
186 else => @compileError(nio.fmt.comptimePrint("#each block cannot have {d} iterators", .{v.args.len})),
186187 }
187188 },
188189 .@"if" => {
......@@ -213,7 +214,7 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val
213214 .bool => try doif(alloc, writer, body, bottom, data, ctx, opts, x),
214215 .optional => try doif(alloc, writer, body, bottom, data, ctx, opts, x != null),
215216 .int => try doif(alloc, writer, body, bottom, data, ctx, opts, x != 0),
216 else => @compileError(std.fmt.comptimePrint("pek: unable to use '{s}' in an #if block", .{@typeName(T)})),
217 else => @compileError(nio.fmt.comptimePrint("pek: unable to use '{s}' in an #if block", .{@typeName(T)})),
217218 }
218219 },
219220 .ifnot => {
......@@ -244,7 +245,7 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val
244245 .bool => try doif(alloc, writer, body, bottom, data, ctx, opts, !x),
245246 .optional => try doif(alloc, writer, body, bottom, data, ctx, opts, x == null),
246247 .int => try doif(alloc, writer, body, bottom, data, ctx, opts, x == 0),
247 else => @compileError(std.fmt.comptimePrint("pek: unable to use '{s}' in an #ifnot block", .{@typeName(T)})),
248 else => @compileError(nio.fmt.comptimePrint("pek: unable to use '{s}' in an #ifnot block", .{@typeName(T)})),
248249 }
249250 },
250251 .ifequal => {
......@@ -305,7 +306,7 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val
305306 args.@"0" = alloc;
306307 args.@"1" = list.writer();
307308 inline for (v.args, 0..) |arg, i| {
308 const field_name = comptime std.fmt.comptimePrint("{d}", .{i + 2});
309 const field_name = comptime nio.fmt.comptimePrint("{d}", .{i + 2});
309310 @field(args, field_name) = try resolveArg(arg, alloc, data, ctx, opts);
310311 }
311312 try @call(.auto, func, args);
......@@ -318,7 +319,7 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val
318319 defer list.deinit();
319320 const AT = std.meta.ArgsTuple(@TypeOf(func));
320321 const ATT = std.meta.fieldInfo(AT, .@"3").type;
321 if (v.args.len != std.meta.fields(ATT).len) @compileError(std.fmt.comptimePrint("expected:{d} - actual:{d}", .{ std.meta.fields(ATT).len, v.args.len }));
322 if (v.args.len != std.meta.fields(ATT).len) @compileError(nio.fmt.comptimePrint("expected:{d} - actual:{d}", .{ std.meta.fields(ATT).len, v.args.len }));
322323 var tupargs = @as(ATT, undefined);
323324 _ = &tupargs;
324325 var args = .{
......@@ -328,7 +329,7 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val
328329 tupargs,
329330 };
330331 inline for (v.args, 0..) |arg, i| {
331 const field_name = comptime std.fmt.comptimePrint("{d}", .{i});
332 const field_name = comptime nio.fmt.comptimePrint("{d}", .{i});
332333 @field(args[3], field_name) = try resolveArg(arg, alloc, data, ctx, opts);
333334 }
334335 try @call(.auto, func, args);
......@@ -505,7 +506,7 @@ fn isCodepointAnEntity(cp: u21) ?htmlentities.Entity {
505506}
506507
507508fn assertEqual(comptime a: usize, comptime b: usize) void {
508 if (a != b) @compileError(std.fmt.comptimePrint("{d} != {d}", .{ a, b }));
509 if (a != b) @compileError(nio.fmt.comptimePrint("{d} != {d}", .{ a, b }));
509510}
510511
511512const HtmlVoidElement = enum {
zig.mod+1
......@@ -7,6 +7,7 @@ dependencies:
77 - src: git https://github.com/kivikakk/htmlentities.zig commit-bd5d569a245c7c8e83812eadcb5761b7ba76ef04
88 - src: git https://github.com/nektro/zig-extras
99 - src: git https://github.com/nektro/zig-tracer
10 - src: git https://github.com/nektro/zig-nio
1011
1112root_dependencies:
1213 - src: git https://github.com/nektro/zig-expect