aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/jq/execute.zig
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-01-17 12:30:34 +0900
committernsfisis <nsfisis@gmail.com>2026-01-17 12:55:26 +0900
commit22811834abe3603e28128a17ac004b1aeea3d651 (patch)
tree071fb87406565a5950f9936dab4d94bb68b14eb6 /src/jq/execute.zig
parent11b20173316188f511f24dc4121412097da7848d (diff)
downloadzgjq-22811834abe3603e28128a17ac004b1aeea3d651.tar.gz
zgjq-22811834abe3603e28128a17ac004b1aeea3d651.tar.zst
zgjq-22811834abe3603e28128a17ac004b1aeea3d651.zip
implement identity filter
Diffstat (limited to 'src/jq/execute.zig')
-rw-r--r--src/jq/execute.zig22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/jq/execute.zig b/src/jq/execute.zig
new file mode 100644
index 0000000..9857d46
--- /dev/null
+++ b/src/jq/execute.zig
@@ -0,0 +1,22 @@
+const std = @import("std");
+const jv = @import("../jv.zig");
+const Instr = @import("./compile.zig").Instr;
+
+pub const ExecuteError = error{
+ Unimplemented,
+};
+
+pub fn execute(allocator: std.mem.Allocator, instrs: []const Instr, input: jv.Value) !jv.Value {
+ _ = allocator;
+ const len = instrs.len;
+ var pc: usize = 0;
+ while (pc < len) {
+ const cur = instrs[pc];
+ _ = switch (cur.op) {
+ .nop => void,
+ .identity => return input,
+ };
+ pc += 1;
+ }
+ return ExecuteError.Unimplemented;
+}