From 57d3a4bbf4c9a0ab73f2cb90c4a9c93fef4c420f Mon Sep 17 00:00:00 2001 From: Patrick Haun Date: Fri, 18 Oct 2024 04:22:10 +0200 Subject: [PATCH] feat: add zig queries (#371) --- after/queries/zig/matchup.scm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 after/queries/zig/matchup.scm diff --git a/after/queries/zig/matchup.scm b/after/queries/zig/matchup.scm new file mode 100644 index 0000000..5ec4bfb --- /dev/null +++ b/after/queries/zig/matchup.scm @@ -0,0 +1,21 @@ +; inherits: quote + +(function_declaration + "fn" @open.function) @scope.function +(return_expression + "return" @mid.function.1) + +; 'else' and 'else if' +(else_clause + "else" @_start (if_statement "if" @_end)? + (#make-range! "mid.if.1" @_start @_end)) + +; if +((if_statement + "if" @open.if) @scope.if + (#not-has-parent? @scope.if else_clause)) + +; Loops +(while_statement "while" @open.loop) @scope.loop +(break_expression "break" @mid.loop.1) +(continue_expression "continue" @mid.loop.2)