Sourceror.get_range

You're seeing just the function get_range, go back to Sourceror module for more information.

Specs

get_range(Macro.t()) :: range()

Gets the range used by the given quoted expression in the source code.

The quoted expression must have at least line and column metadata, otherwise it is not possible to calculate an accurate range, or to calculate it at all. This function is most useful when used after Sourceror.parse_string/1, before any kind of modification to the AST.

The range is a map with :start and :end positions.

iex> quoted = ~S"""
...> def foo do
...>   :ok
...> end
...> """ |> Sourceror.parse_string!()
iex> Sourceror.get_range(quoted)
%{start: [line: 1, column: 1], end: [line: 3, column: 4]}

iex> quoted = ~S"""
...> Foo.{
...>   Bar
...> }
...> """ |> Sourceror.parse_string!()
iex> Sourceror.get_range(quoted)
%{start: [line: 1, column: 1], end: [line: 3, column: 2]}