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");...@@ -14,6 +14,7 @@ const root = @import("root");
14const tracer = @import("tracer");14const tracer = @import("tracer");
15const extras = @import("extras");15const extras = @import("extras");
16const builtin = @import("builtin");16const builtin = @import("builtin");
17const nio = @import("nio");
1718
18const tokenize = @import("./tokenize.zig");19const tokenize = @import("./tokenize.zig");
19const astgen = @import("./astgen.zig");20const astgen = @import("./astgen.zig");
...@@ -182,7 +183,7 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val...@@ -182,7 +183,7 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val
182 try do(alloc, writer, body, null, extras.join(.{ ctx, .{ .this = item, .that = jtem } }), opts);183 try do(alloc, writer, body, null, extras.join(.{ ctx, .{ .this = item, .that = jtem } }), opts);
183 }184 }
184 },185 },
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})),
186 }187 }
187 },188 },
188 .@"if" => {189 .@"if" => {
...@@ -213,7 +214,7 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val...@@ -213,7 +214,7 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val
213 .bool => try doif(alloc, writer, body, bottom, data, ctx, opts, x),214 .bool => try doif(alloc, writer, body, bottom, data, ctx, opts, x),
214 .optional => try doif(alloc, writer, body, bottom, data, ctx, opts, x != null),215 .optional => try doif(alloc, writer, body, bottom, data, ctx, opts, x != null),
215 .int => try doif(alloc, writer, body, bottom, data, ctx, opts, x != 0),216 .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)})),
217 }218 }
218 },219 },
219 .ifnot => {220 .ifnot => {
...@@ -244,7 +245,7 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val...@@ -244,7 +245,7 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val
244 .bool => try doif(alloc, writer, body, bottom, data, ctx, opts, !x),245 .bool => try doif(alloc, writer, body, bottom, data, ctx, opts, !x),
245 .optional => try doif(alloc, writer, body, bottom, data, ctx, opts, x == null),246 .optional => try doif(alloc, writer, body, bottom, data, ctx, opts, x == null),
246 .int => try doif(alloc, writer, body, bottom, data, ctx, opts, x == 0),247 .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)})),
248 }249 }
249 },250 },
250 .ifequal => {251 .ifequal => {
...@@ -305,7 +306,7 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val...@@ -305,7 +306,7 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val
305 args.@"0" = alloc;306 args.@"0" = alloc;
306 args.@"1" = list.writer();307 args.@"1" = list.writer();
307 inline for (v.args, 0..) |arg, i| {308 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});
309 @field(args, field_name) = try resolveArg(arg, alloc, data, ctx, opts);310 @field(args, field_name) = try resolveArg(arg, alloc, data, ctx, opts);
310 }311 }
311 try @call(.auto, func, args);312 try @call(.auto, func, args);
...@@ -318,7 +319,7 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val...@@ -318,7 +319,7 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val
318 defer list.deinit();319 defer list.deinit();
319 const AT = std.meta.ArgsTuple(@TypeOf(func));320 const AT = std.meta.ArgsTuple(@TypeOf(func));
320 const ATT = std.meta.fieldInfo(AT, .@"3").type;321 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 }));
322 var tupargs = @as(ATT, undefined);323 var tupargs = @as(ATT, undefined);
323 _ = &tupargs;324 _ = &tupargs;
324 var args = .{325 var args = .{
...@@ -328,7 +329,7 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val...@@ -328,7 +329,7 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val
328 tupargs,329 tupargs,
329 };330 };
330 inline for (v.args, 0..) |arg, i| {331 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});
332 @field(args[3], field_name) = try resolveArg(arg, alloc, data, ctx, opts);333 @field(args[3], field_name) = try resolveArg(arg, alloc, data, ctx, opts);
333 }334 }
334 try @call(.auto, func, args);335 try @call(.auto, func, args);
...@@ -505,7 +506,7 @@ fn isCodepointAnEntity(cp: u21) ?htmlentities.Entity {...@@ -505,7 +506,7 @@ fn isCodepointAnEntity(cp: u21) ?htmlentities.Entity {
505}506}
506507
507fn assertEqual(comptime a: usize, comptime b: usize) void {508fn 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 }));
509}510}
510511
511const HtmlVoidElement = enum {512const HtmlVoidElement = enum {
zig.mod+1
...@@ -7,6 +7,7 @@ dependencies:...@@ -7,6 +7,7 @@ dependencies:
7 - src: git https://github.com/kivikakk/htmlentities.zig commit-bd5d569a245c7c8e83812eadcb5761b7ba76ef047 - src: git https://github.com/kivikakk/htmlentities.zig commit-bd5d569a245c7c8e83812eadcb5761b7ba76ef04
8 - src: git https://github.com/nektro/zig-extras8 - src: git https://github.com/nektro/zig-extras
9 - src: git https://github.com/nektro/zig-tracer9 - src: git https://github.com/nektro/zig-tracer
10 - src: git https://github.com/nektro/zig-nio
1011
11root_dependencies:12root_dependencies:
12 - src: git https://github.com/nektro/zig-expect13 - src: git https://github.com/nektro/zig-expect