Sourceror.parse_expression

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

parse_expression(string, opts \\ [])

View Source

Specs

parse_expression(String.t(), keyword()) ::
  {:ok, Macro.t(), String.t()} | {:error, String.t()}

Parses a single expression from the given string. It tries to parse on a per-line basis.

Returns {:ok, quoted, rest} on success or {:error, source} on error.

Examples

iex> ~S"""
...> 42
...>
...> :ok
...> """ |> Sourceror.parse_expression()
{:ok, {:__block__, [trailing_comments: [], leading_comments: [],
                    token: "42", line: 2, column: 1], [42]}, "\n:ok"}

Options

  • :from_line - The line at where the parsing should start. Defaults to 1.