From 22a5d1617e79f176ecfca22d6c72be215f0da8b6 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 17 Jan 2026 18:40:47 +0900 Subject: implement object key access --- src/jq/compile.zig | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/jq/compile.zig') diff --git a/src/jq/compile.zig b/src/jq/compile.zig index ddb4be5..0c30a3d 100644 --- a/src/jq/compile.zig +++ b/src/jq/compile.zig @@ -5,12 +5,14 @@ const Ast = @import("./parse.zig").Ast; pub const Opcode = enum { nop, array_index, + object_key, literal, }; pub const Instr = union(Opcode) { nop, array_index, + object_key: []const u8, literal: *jv.Value, pub fn op(self: @This()) Opcode { @@ -29,6 +31,7 @@ pub fn compile(allocator: std.mem.Allocator, compile_allocator: std.mem.Allocato try instrs.appendSlice(allocator, index_instrs); try instrs.append(allocator, .array_index); }, + .object_key => |key| try instrs.append(allocator, .{ .object_key = key }), .literal => |value| try instrs.append(allocator, .{ .literal = value }), } -- cgit v1.3-1-g0d28