From f7daa85ab589025036d0de0b84aeca7772ae6802 Mon Sep 17 00:00:00 2001 From: Julien Vincent Date: Thu, 17 Oct 2024 16:57:11 +0100 Subject: [PATCH] Improve clojure pairwise queries --- queries/clojure/paredit/pairs.scm | 43 +++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/queries/clojure/paredit/pairs.scm b/queries/clojure/paredit/pairs.scm index 78a71a2..128f088 100644 --- a/queries/clojure/paredit/pairs.scm +++ b/queries/clojure/paredit/pairs.scm @@ -1,26 +1,47 @@ (list_lit (sym_lit) @fn-name + (#any-of? @fn-name + "let" + "loop" + "binding" + "with-open" + "with-redefs") + (vec_lit - (_) @pair) - (#any-of? @fn-name "let" "loop" "binding" "with-open" "with-redefs")) + (_) @pair)) (map_lit (_) @pair) (list_lit (sym_lit) @fn-name - (_) - (_) @pair - (#eq? @fn-name "case")) + (#eq? @fn-name "case") + + (_) . + ((_) @pair . (_) @pair)+ + (_)?) (list_lit (sym_lit) @fn-name - (_) @pair - (#eq? @fn-name "cond")) + (#eq? @fn-name "cond") -(list_lit + ((_) @pair (_) @pair)+) + +(list_lit (sym_lit) @fn-name + (#any-of? @fn-name + "cond->" + "cond->>") (_) - (_) - (_) @pair - (#eq? @fn-name "condp")) + . + ((_) @pair . (_) @pair)+) + +(list_lit + (sym_lit) @fn-name + (#eq? @fn-name "condp") + + (_) (_) + . + ((_) @pair . (_) @pair)+ + . + (_)?)