aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/jq/codegen.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/jq/codegen.zig')
-rw-r--r--src/jq/codegen.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/jq/codegen.zig b/src/jq/codegen.zig
index 62535c1..23383bf 100644
--- a/src/jq/codegen.zig
+++ b/src/jq/codegen.zig
@@ -37,6 +37,7 @@ pub const Opcode = enum {
load,
store,
append,
+ each,
};
pub const Instr = union(Opcode) {
@@ -72,6 +73,7 @@ pub const Instr = union(Opcode) {
load: VariableIndex,
store: VariableIndex,
append: VariableIndex,
+ each,
pub fn op(self: Self) Opcode {
return self;
@@ -264,6 +266,12 @@ const Codegen = struct {
try self.emit(.backtrack);
try self.emit(.{ .load = v });
},
+ .each => |each| {
+ // <base>
+ // EACH
+ try self.generate(each.base);
+ try self.emit(.each);
+ },
}
}