Macro.validate

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

Specs

validate(term()) :: :ok | {:error, term()}

Validates the given expressions are valid quoted expressions.

Checks the Macro.t/0 for the specification of a valid quoted expression.

It returns :ok if the expression is valid. Otherwise it returns a tuple in the form of {:error, remainder} where remainder is the invalid part of the quoted expression.

Examples

iex> Macro.validate({:two_element, :tuple})
:ok
iex> Macro.validate({:three, :element, :tuple})
{:error, {:three, :element, :tuple}}

iex> Macro.validate([1, 2, 3])
:ok
iex> Macro.validate([1, 2, 3, {4}])
{:error, {4}}