diff options
Diffstat (limited to 'src/jq/execute.zig')
| -rw-r--r-- | src/jq/execute.zig | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/jq/execute.zig b/src/jq/execute.zig index 3096be2..9fa410f 100644 --- a/src/jq/execute.zig +++ b/src/jq/execute.zig @@ -273,6 +273,30 @@ pub const Runtime = struct { key.deinit(self.allocator); try self.values.push(result); }, + .slice => { + std.debug.assert(self.values.ensureSize(3)); + + const base = self.values.pop(); + const to = self.values.pop(); + const from = self.values.pop(); + const result = try jv.ops.slice(self.allocator, base, from, to); + base.deinit(self.allocator); + to.deinit(self.allocator); + from.deinit(self.allocator); + try self.values.push(result); + }, + .slice_opt => { + std.debug.assert(self.values.ensureSize(3)); + + const base = self.values.pop(); + const to = self.values.pop(); + const from = self.values.pop(); + const result = jv.ops.slice(self.allocator, base, from, to) catch jv.Value.null; + base.deinit(self.allocator); + to.deinit(self.allocator); + from.deinit(self.allocator); + try self.values.push(result); + }, .add => { std.debug.assert(self.values.ensureSize(3)); |
