feat(elixir): add queries

This commit is contained in:
Mitchell Hanberg 2023-03-10 18:23:09 -05:00 committed by Lewis Russell
parent e00d0545bf
commit 6183524ec0
2 changed files with 127 additions and 0 deletions

View file

@ -0,0 +1,18 @@
(binary_operator
left: (_)
right: (_) @context)
(pair
key: (_)
value: (_) @context)
((unary_operator
operand: (call
target: (identifier)
(arguments (_)))) @_op (#lua-match? @_op "@[%w_]+")) @context
(stab_clause right: (body (_) @context.end)) @context
(call
target: (identifier)
(do_block (_) @context.end)) @context

109
test/text.ex Normal file
View file

@ -0,0 +1,109 @@
defmodule Foo do
@moduledoc """
Some really long
documentation.
"""
@some_const ~w[
hi
i'm
a
big
list
sigil
]
def run(%{
multi: multi,
line: line,
function_clause: function_clause
}) do
case line do
{:ok, foos}->
Enum.map(foos, fn
{f, f2} ->
String.downcase(f2)
f ->
String.upcase(f)
end)
_ ->
with some_num <- Enum.random(1..100),
another_num <- Enum.random(1..100) do
# TODO: all of it
end
:ok
end
end
def stop(params) do
%{
foo: %{
"alice" => "alice",
"bob" => "bob",
"carol" => "carol",
"dave" => "dave",
"bar" => [
:bing,
%{
"very deeply nested" => %{
"jk, even deeper" => %{
"one more" => %{
}
}
}
}
:bong,
:bang
]
}
}
end
end