diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-02-08 15:52:26 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-02-08 15:52:26 +0900 |
| commit | c9db46235ed5b8c51935ac105874909400e9ec93 (patch) | |
| tree | 30cad69a359a8f9a58550e0b73065218242b57cd /src/jq/execute.zig | |
| parent | beff4b6048cc3783d538769a307f8e679a33894c (diff) | |
| download | zgjq-c9db46235ed5b8c51935ac105874909400e9ec93.tar.gz zgjq-c9db46235ed5b8c51935ac105874909400e9ec93.tar.zst zgjq-c9db46235ed5b8c51935ac105874909400e9ec93.zip | |
support --debug-dump-disasm
Diffstat (limited to 'src/jq/execute.zig')
| -rw-r--r-- | src/jq/execute.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/jq/execute.zig b/src/jq/execute.zig index d8081e6..cee7845 100644 --- a/src/jq/execute.zig +++ b/src/jq/execute.zig @@ -4,6 +4,7 @@ const tokenize = @import("./tokenize.zig").tokenize; const parse = @import("./parse.zig").parse; const Instr = @import("./codegen.zig").Instr; const codegen = @import("./codegen.zig").codegen; +const disasm = @import("./codegen.zig").disasm; pub const ExecuteError = error{ Unimplemented, @@ -189,11 +190,6 @@ pub const Runtime = struct { const ast = try parse(self.allocator, compile_allocator.allocator(), tokens, &self.constants); const instrs = try codegen(self.allocator, ast); self.instrs = instrs; - // std.debug.print("BEGIN\n", .{}); - // for (self.instrs) |instr| { - // std.debug.print("{}\n", .{instr}); - // } - // std.debug.print("END\n", .{}); } pub fn compileFromSlice(self: *Self, query: []const u8) !void { @@ -201,6 +197,10 @@ pub const Runtime = struct { return self.compileFromReader(&reader); } + pub fn dumpDisasm(self: *const Self, writer: *std.Io.Writer) !void { + try disasm(self.allocator, self.instrs, self.constants.items, writer); + } + pub fn start(self: *Self, input: jv.Value) !void { try self.values.push(input.clone()); } |
