2022-06-03 16:26:48 +02:00
|
|
|
; Function heads and guards have no body at all, so `keywords` and `do_block` nodes are both optional
|
|
|
|
((call
|
|
|
|
target: (identifier) @_keyword
|
|
|
|
(arguments
|
|
|
|
[
|
|
|
|
(call
|
|
|
|
(arguments (_)? @parameter.inside))
|
|
|
|
; function has a guard
|
|
|
|
(binary_operator
|
|
|
|
left:
|
|
|
|
(call
|
|
|
|
(arguments (_)? @parameter.inside)))
|
|
|
|
]
|
|
|
|
; body is "do: body" instead of a do-block
|
|
|
|
(keywords
|
|
|
|
(pair
|
|
|
|
value: (_) @function.inside))?)?
|
|
|
|
(do_block (_)* @function.inside)?)
|
2022-06-18 23:24:01 +02:00
|
|
|
(#match? @_keyword "^(def|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp|defp)$")) @function.around
|
2022-06-03 16:26:48 +02:00
|
|
|
|
|
|
|
(anonymous_function
|
|
|
|
(stab_clause right: (body) @function.inside)) @function.around
|
|
|
|
|
|
|
|
((call
|
|
|
|
target: (identifier) @_keyword
|
|
|
|
(do_block (_)* @class.inside))
|
|
|
|
(#match? @_keyword "^(defmodule|defprotocol|defimpl)$")) @class.around
|
2022-06-18 23:24:01 +02:00
|
|
|
|
|
|
|
((call
|
|
|
|
target: (identifier) @_keyword
|
|
|
|
(arguments ((string) . (_)?))
|
|
|
|
(do_block (_)* @test.inside)?)
|
|
|
|
(#match? @_keyword "^(test|describe)$")) @test.around
|
2022-07-26 03:14:45 +02:00
|
|
|
|
|
|
|
(comment) @comment.around @comment.inside
|