aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/jq/compile.zig
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-01-25 16:23:13 +0900
committernsfisis <nsfisis@gmail.com>2026-01-25 16:23:13 +0900
commit20ff09460371b07d7e9683757657a5a3ead005a8 (patch)
tree327089640d923a4bf44d340d584cf3378f654728 /src/jq/compile.zig
parent7e5382e6eac497f6be55a7d947a8c6e6c2ecb390 (diff)
downloadzgjq-20ff09460371b07d7e9683757657a5a3ead005a8.tar.gz
zgjq-20ff09460371b07d7e9683757657a5a3ead005a8.tar.zst
zgjq-20ff09460371b07d7e9683757657a5a3ead005a8.zip
implement comparison operators
Diffstat (limited to 'src/jq/compile.zig')
-rw-r--r--src/jq/compile.zig18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/jq/compile.zig b/src/jq/compile.zig
index bb3a832..ec6ef63 100644
--- a/src/jq/compile.zig
+++ b/src/jq/compile.zig
@@ -16,6 +16,12 @@ pub const Opcode = enum {
mul,
div,
mod,
+ eq,
+ ne,
+ lt,
+ gt,
+ le,
+ ge,
object_key,
literal,
};
@@ -35,6 +41,12 @@ pub const Instr = union(Opcode) {
mul,
div,
mod,
+ eq,
+ ne,
+ lt,
+ gt,
+ le,
+ ge,
object_key: []const u8,
literal: *jv.Value,
@@ -83,6 +95,12 @@ fn compileExpr(allocator: std.mem.Allocator, compile_allocator: std.mem.Allocato
.mul => .mul,
.div => .div,
.mod => .mod,
+ .eq => .eq,
+ .ne => .ne,
+ .lt => .lt,
+ .gt => .gt,
+ .le => .le,
+ .ge => .ge,
else => return error.Unimplemented,
};
try instrs.append(allocator, op_instr);