diff --git a/src/lib.zig b/src/lib.zig index 1f42cdbe87049d9298132b7ff3ad375e9dbc4522..6745d48ec33f9cc399f0674e863b11a06ebed92c 100644 --- a/src/lib.zig +++ b/src/lib.zig @@ -58,6 +58,7 @@ fn do(writer: anytype, comptime value: astgen.Value, data: anytype, ctx: anytype .replacement => |v| { const x = if (comptime std.mem.eql(u8, v[0], "this")) search(v[1..], data) else search(v, ctx); const TO = @TypeOf(x); + const TI = @typeInfo(TO); if (comptime std.meta.trait.isZigString(TO)) { const s: []const u8 = x; @@ -70,6 +71,10 @@ fn do(writer: anytype, comptime value: astgen.Value, data: anytype, ctx: anytype } return; } + if (TI == .Int or TI == .Float or TI == .ComptimeInt or TI == .ComptimeFloat) { + try writer.print("{d}", .{x}); + return; + } @compileError("pek: print: unsupported type: " ++ @typeName(TO)); }, .block => |v| {