authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-05-21 12:50:31 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-05-21 12:50:31 -07:00
log23c09f46f04e29d79569b4c8308ed3b0a1b466ec
treea5deb1ae91e1b9d71bbbe8d8e1d0dd93c383ebbf
parent50157b547862127f73d54bdd6e9eb1e471ab07ca

update to Zig 0.14


2 files changed, 16 insertions(+), 16 deletions(-)

src/lib.zig+15-15
......@@ -114,7 +114,7 @@ fn do(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Value, d
114114 if (!opts.escaped) try writer.writeAll(s);
115115 return;
116116 }
117 if (TI == .Int or TI == .Float or TI == .ComptimeInt or TI == .ComptimeFloat) {
117 if (TI == .int or TI == .float or TI == .comptime_int or TI == .comptime_float) {
118118 try writer.print("{d}", .{x});
119119 return;
120120 }
......@@ -135,7 +135,7 @@ fn do(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Value, d
135135 if (!opts.escaped) try writer.writeAll(s);
136136 return;
137137 }
138 if (TI == .Enum) {
138 if (TI == .@"enum") {
139139 const s = @tagName(x);
140140 if (opts.escaped) try writeEscaped(s, writer);
141141 if (!opts.escaped) try writer.writeAll(s);
......@@ -157,7 +157,7 @@ fn do(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Value, d
157157 .@"if" => {
158158 if (v.func) |n| {
159159 const f = @field(opts.Ctx, "pek_" ++ n);
160 const x2 = try switch (@typeInfo(@TypeOf(f)).Fn.params.len) {
160 const x2 = try switch (@typeInfo(@TypeOf(f)).@"fn".params.len) {
161161 2 => f(alloc, x),
162162 3 => blk: {
163163 const y = try resolveArg(v.args[1], alloc, data, ctx, opts);
......@@ -179,16 +179,16 @@ fn do(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Value, d
179179 return;
180180 }
181181 switch (comptime TI) {
182 .Bool => try doif(alloc, writer, body, bottom, data, ctx, opts, x),
183 .Optional => try docap(alloc, writer, body, bottom, data, ctx, opts, x),
184 .Int => try doif(alloc, writer, body, bottom, data, ctx, opts, x != 0),
182 .bool => try doif(alloc, writer, body, bottom, data, ctx, opts, x),
183 .optional => try docap(alloc, writer, body, bottom, data, ctx, opts, x),
184 .int => try doif(alloc, writer, body, bottom, data, ctx, opts, x != 0),
185185 else => @compileError(std.fmt.comptimePrint("pek: unable to use '{s}' in an #if block", .{@typeName(T)})),
186186 }
187187 },
188188 .ifnot => {
189189 if (v.func) |n| {
190190 const f = @field(opts.Ctx, "pek_" ++ n);
191 const x2 = try switch (@typeInfo(@TypeOf(f)).Fn.params.len) {
191 const x2 = try switch (@typeInfo(@TypeOf(f)).@"fn".params.len) {
192192 2 => f(alloc, x),
193193 3 => blk: {
194194 const y = try resolveArg(v.args[1], alloc, data, ctx, opts);
......@@ -210,16 +210,16 @@ fn do(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Value, d
210210 return;
211211 }
212212 switch (comptime TI) {
213 .Bool => try doif(alloc, writer, body, bottom, data, ctx, opts, !x),
214 .Optional => try docap(alloc, writer, body, bottom, data, ctx, opts, !x),
215 .Int => try doif(alloc, writer, body, bottom, data, ctx, opts, x == 0),
213 .bool => try doif(alloc, writer, body, bottom, data, ctx, opts, !x),
214 .optional => try docap(alloc, writer, body, bottom, data, ctx, opts, !x),
215 .int => try doif(alloc, writer, body, bottom, data, ctx, opts, x == 0),
216216 else => @compileError(std.fmt.comptimePrint("pek: unable to use '{s}' in an #ifnot block", .{@typeName(T)})),
217217 }
218218 },
219219 .ifequal => {
220220 comptime assertEqual(v.args.len, 2);
221221 const y = try resolveArg(v.args[1], alloc, data, ctx, opts);
222 if (@typeInfo(@TypeOf(x)) == .Enum and comptime extras.isZigString(@TypeOf(y))) {
222 if (@typeInfo(@TypeOf(x)) == .@"enum" and comptime extras.isZigString(@TypeOf(y))) {
223223 return try doif(alloc, writer, body, bottom, data, ctx, opts, std.mem.eql(u8, @tagName(x), y));
224224 }
225225 if (comptime extras.isSlice(@TypeOf(x, y))) {
......@@ -230,7 +230,7 @@ fn do(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Value, d
230230 .ifnotequal => {
231231 comptime assertEqual(v.args.len, 2);
232232 const y = try resolveArg(v.args[1], alloc, data, ctx, opts);
233 if (@typeInfo(@TypeOf(x)) == .Enum and comptime extras.isZigString(@TypeOf(y))) {
233 if (@typeInfo(@TypeOf(x)) == .@"enum" and comptime extras.isZigString(@TypeOf(y))) {
234234 return try doif(alloc, writer, body, bottom, data, ctx, opts, !std.mem.eql(u8, @tagName(x), y));
235235 }
236236 if (comptime extras.isSlice(@TypeOf(x, y))) {
......@@ -338,7 +338,7 @@ fn search(comptime args: []const string, ctx: anytype) FieldSearch(@TypeOf(ctx),
338338 if (args[0][0] == '"') return std.mem.trim(u8, args[0], "\"");
339339 if (comptime std.mem.eql(u8, args[0], "true")) return true;
340340 if (comptime std.mem.eql(u8, args[0], "false")) return false;
341 if (@typeInfo(@TypeOf(ctx)) == .Optional) return search(args, ctx.?);
341 if (@typeInfo(@TypeOf(ctx)) == .optional) return search(args, ctx.?);
342342 const f = @field(ctx, args[0]);
343343 if (args.len == 1) return f;
344344 return search(args[1..], f);
......@@ -356,7 +356,7 @@ fn Field(comptime T: type, comptime field_name: string) type {
356356 return usize;
357357 }
358358 switch (@typeInfo(T)) {
359 .Optional => |info| return Field(info.child, field_name),
359 .optional => |info| return Field(info.child, field_name),
360360 else => {},
361361 }
362362 for (std.meta.fields(T)) |fld| {
......@@ -480,7 +480,7 @@ fn isArrayOf(comptime T: type) fn (type) bool {
480480 const Closure = struct {
481481 pub fn trait(comptime C: type) bool {
482482 return switch (@typeInfo(C)) {
483 .Array => |ti| ti.child == T,
483 .array => |ti| ti.child == T,
484484 else => false,
485485 };
486486 }
src/tokenize.zig+1-1
......@@ -31,7 +31,7 @@ pub fn do(comptime input: string, comptime symbols: []const u8) []const Token {
3131 var end = 0;
3232 var mode = 0;
3333
34 @setEvalBranchQuota(100000);
34 @setEvalBranchQuota(1000000);
3535
3636 inline for (input, 0..) |c, i| {
3737 const s = &[_]u8{c};