diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-01-18 00:49:33 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-01-18 00:53:35 +0900 |
| commit | 8e8fcf1dd73c785f6901cf53ce17380099d15bd1 (patch) | |
| tree | e0bab2aaf525ad874ce013a3ace046ff224fc86a /src/jq/compile.zig | |
| parent | 6739144edaf34d10e0c0901231b196f377007934 (diff) | |
| download | zgjq-8e8fcf1dd73c785f6901cf53ce17380099d15bd1.tar.gz zgjq-8e8fcf1dd73c785f6901cf53ce17380099d15bd1.tar.zst zgjq-8e8fcf1dd73c785f6901cf53ce17380099d15bd1.zip | |
implement pipe operator
Diffstat (limited to 'src/jq/compile.zig')
| -rw-r--r-- | src/jq/compile.zig | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/jq/compile.zig b/src/jq/compile.zig index e3937c6..f4044c9 100644 --- a/src/jq/compile.zig +++ b/src/jq/compile.zig @@ -54,6 +54,14 @@ pub fn compile(allocator: std.mem.Allocator, compile_allocator: std.mem.Allocato try instrs.append(allocator, .subexp_end); try instrs.append(allocator, .add); }, + .pipe => |pipe_expr| { + const lhs_instrs = try compile(allocator, compile_allocator, pipe_expr.lhs); + defer allocator.free(lhs_instrs); + const rhs_instrs = try compile(allocator, compile_allocator, pipe_expr.rhs); + defer allocator.free(rhs_instrs); + try instrs.appendSlice(allocator, lhs_instrs); + try instrs.appendSlice(allocator, rhs_instrs); + }, } return instrs.toOwnedSlice(allocator); |
