| ... | @@ -58,6 +58,7 @@ fn do(writer: anytype, comptime value: astgen.Value, data: anytype, ctx: anytype | ... | @@ -58,6 +58,7 @@ fn do(writer: anytype, comptime value: astgen.Value, data: anytype, ctx: anytype |
| 58 | .replacement => |v| { | 58 | .replacement => |v| { |
| 59 | const x = if (comptime std.mem.eql(u8, v[0], "this")) search(v[1..], data) else search(v, ctx); | 59 | const x = if (comptime std.mem.eql(u8, v[0], "this")) search(v[1..], data) else search(v, ctx); |
| 60 | const TO = @TypeOf(x); | 60 | const TO = @TypeOf(x); |
| | 61 | const TI = @typeInfo(TO); |
| 61 | | 62 | |
| 62 | if (comptime std.meta.trait.isZigString(TO)) { | 63 | if (comptime std.meta.trait.isZigString(TO)) { |
| 63 | const s: []const u8 = x; | 64 | const s: []const u8 = x; |
| ... | @@ -70,6 +71,10 @@ fn do(writer: anytype, comptime value: astgen.Value, data: anytype, ctx: anytype | ... | @@ -70,6 +71,10 @@ fn do(writer: anytype, comptime value: astgen.Value, data: anytype, ctx: anytype |
| 70 | } | 71 | } |
| 71 | return; | 72 | return; |
| 72 | } | 73 | } |
| | 74 | if (TI == .Int or TI == .Float or TI == .ComptimeInt or TI == .ComptimeFloat) { |
| | 75 | try writer.print("{d}", .{x}); |
| | 76 | return; |
| | 77 | } |
| 73 | @compileError("pek: print: unsupported type: " ++ @typeName(TO)); | 78 | @compileError("pek: print: unsupported type: " ++ @typeName(TO)); |
| 74 | }, | 79 | }, |
| 75 | .block => |v| { | 80 | .block => |v| { |