tree-sitter-elixir/test/corpus/integration/module_definition.txt

139 lines
2.4 KiB
Plaintext

=====================================
empty module definition
=====================================
defmodule Mod do
end
defmodule Mod.Child do
end
---
(source
(call
(identifier)
(arguments
(alias))
(do_block))
(call
(identifier)
(arguments
(alias))
(do_block)))
=====================================
module definition with atom literal
=====================================
defmodule :mod do
end
---
(source
(call
(identifier)
(arguments
(atom))
(do_block)))
=====================================
full module definition
=====================================
defmodule Mod do
@moduledoc """
Example module
"""
use UseMod
@attribute 1
@doc """
Example function
"""
@spec func(integer) :: integer
def func(x) when is_integer(x) do
priv(x) + priv(x)
end
defp priv(x), do: x * x
end
---
(source
(call
(identifier)
(arguments
(alias))
(do_block
(unary_operator
(call
(identifier)
(arguments
(string
(quoted_content)))))
(call
(identifier)
(arguments
(alias)))
(unary_operator
(call
(identifier)
(arguments
(integer))))
(unary_operator
(call
(identifier)
(arguments
(string
(quoted_content)))))
(unary_operator
(call
(identifier)
(arguments
(binary_operator
(call
(identifier)
(arguments
(identifier)))
(identifier)))))
(call
(identifier)
(arguments
(binary_operator
(call
(identifier)
(arguments
(identifier)))
(call
(identifier)
(arguments
(identifier)))))
(do_block
(binary_operator
(call
(identifier)
(arguments
(identifier)))
(call
(identifier)
(arguments
(identifier))))))
(call
(identifier)
(arguments
(call
(identifier)
(arguments
(identifier)))
(keywords
(pair
(keyword)
(binary_operator
(identifier)
(identifier)))))))))