Skip to content

Commit 52ce5b1

Browse files
committed
Proposal for nesting query predicate operator
1 parent 4c517d7 commit 52ce5b1

File tree

1 file changed

+12
-74
lines changed

1 file changed

+12
-74
lines changed

queries/nix.scm

Lines changed: 12 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -255,76 +255,16 @@
255255
;;! ^^^^^^
256256
;;! xxxxxxx
257257
;;! ----------------
258-
(apply_expression
259-
[
260-
(apply_expression
261-
function: (variable_expression
262-
name: (identifier) @functionCallee
263-
)
264-
)
265-
(apply_expression
266-
[
267-
(apply_expression
268-
function: (variable_expression
269-
name: (identifier) @functionCallee
270-
)
271-
)
272-
(apply_expression
273-
[
274-
(apply_expression
275-
function: (variable_expression
276-
name: (identifier) @functionCallee
277-
)
278-
)
279-
(apply_expression
280-
(apply_expression
281-
function: (variable_expression
282-
name: (identifier) @functionCallee
283-
)
284-
)
285-
)
286-
]
287-
)
288-
]
289-
)
290-
]
291-
) @functionCall @_.domain
258+
(
259+
(apply_expression
260+
function: (_) @functionCallee
261+
) @functionCallee.domain @functionCall
262+
(#not-type? @functionCallee apply_expression)
263+
)
292264

293-
;; Similar to above, but sometimes the function calls are in select_expression
294265
(apply_expression
295-
[
296-
(select_expression
297-
expression: (variable_expression
298-
name: (identifier)
299-
)
300-
) @functionCallee
301-
(apply_expression
302-
[
303-
(select_expression
304-
expression: (variable_expression
305-
name: (identifier)
306-
)
307-
) @functionCallee
308-
(apply_expression
309-
[
310-
(select_expression
311-
expression: (variable_expression
312-
name: (identifier)
313-
)
314-
) @functionCallee
315-
(apply_expression
316-
(select_expression
317-
expression: (variable_expression
318-
name: (identifier)
319-
)
320-
) @functionCallee
321-
)
322-
]
323-
)
324-
]
325-
)
326-
]
327-
) @functionCall @_.domain
266+
function: (apply_expression) @functionCallee.domain.input @functionCall.input
267+
) @functionCallee.domain.output @functionCall.output
328268

329269
;; Args:
330270
;;!! mkHost a
@@ -337,14 +277,12 @@
337277
;;! xxxxxx
338278
;;! --------
339279
(apply_expression
340-
function: (variable_expression
341-
name: (identifier) @functionCallee
342-
)
343280
argument: (_) @argumentOrParameter
344-
) @functionCall @_.domain
281+
)
345282

346-
(apply_expression
347-
argument: (_) @argumentOrParameter
283+
(
284+
(apply_expression) @argumentOrParameter.iteration
285+
(#not-parent-type? @argumentOrParameter.iteration apply_expression)
348286
)
349287

350288
;;

0 commit comments

Comments
 (0)