diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-01-17 18:40:47 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-01-17 18:40:47 +0900 |
| commit | 22a5d1617e79f176ecfca22d6c72be215f0da8b6 (patch) | |
| tree | 4424a15f2e069aa27312a9e1885d8446ad12bea1 /src/jq/compile.zig | |
| parent | d4bacf19b56c21afc7f2f0b5efb244b072873119 (diff) | |
| download | zgjq-22a5d1617e79f176ecfca22d6c72be215f0da8b6.tar.gz zgjq-22a5d1617e79f176ecfca22d6c72be215f0da8b6.tar.zst zgjq-22a5d1617e79f176ecfca22d6c72be215f0da8b6.zip | |
implement object key access
Diffstat (limited to 'src/jq/compile.zig')
| -rw-r--r-- | src/jq/compile.zig | 3 |
1 files changed, 3 insertions, 0 deletions
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 }), } |
