Matcha.Rewrite (Matcha v0.1.3) View Source

About rewrites.

Link to this section Summary

Link to this section Types

Specs

t() :: %Matcha.Rewrite{
  bindings: %{
    vars: %{required(var_ref()) => var_binding()},
    count: non_neg_integer()
  },
  context: Matcha.Context.t() | nil,
  env: Macro.Env.t(),
  source: Macro.t()
}

Specs

var_ast() :: {atom(), list(), atom() | nil}

Specs

var_binding() :: atom() | var_ast()

Specs

var_ref() :: atom()

Link to this section Functions

Link to this function

ast_to_pattern_source(rewrite, pattern)

View Source
Link to this function

ast_to_spec_source(rewrite, spec)

View Source

Specs

binding(t(), var_ref()) :: var_binding()

Specs

bound?(t(), var_ref()) :: boolean()
Link to this macro

is_invocation(invocation)

View Source (macro)
Link to this macro

is_literal(ast)

View Source (macro)
Link to this macro

is_named_var(var)

View Source (macro)
Link to this macro

is_non_literal(ast)

View Source (macro)
Link to this macro

is_remote_call(call)

View Source (macro)
Link to this function

outer_var?(rewrite, arg2)

View Source

Specs

outer_var?(t(), var_ast()) :: boolean()
Link to this function

pattern_to_spec(context, pattern)

View Source

Specs

pattern_to_spec(Matcha.Context.t(), Matcha.Pattern.t()) ::
  {:ok, Matcha.Spec.t()} | {:error, Matcha.Error.problems()}
Link to this function

perform_expansion(ast, env)

View Source

Specs

problem({type, description}) :: Matcha.Error.problem()
when type: :error | :warning, description: charlist() | String.t()

Specs

problems(problems) :: Matcha.Error.problems()
when problems: [{type, description}],
     type: :error | :warning,
     description: charlist() | String.t()
Link to this function

resolve_context(context)

View Source

Specs

resolve_context(atom() | Matcha.Context.t()) :: Matcha.Context.t() | no_return()
Link to this function

rewrite_bindings(spec, ast)

View Source

Specs

rewrite_bindings(t(), Macro.t()) :: Macro.t()
Link to this function

rewrite_body(rewrite, ast)

View Source

Specs

rewrite_body(t(), Macro.t()) :: Macro.t()
Link to this function

rewrite_conditions(rewrite, conditions)

View Source

Specs

rewrite_conditions(t(), Macro.t()) :: Macro.t()
Link to this function

rewrite_match(rewrite, match)

View Source

Specs

rewrite_match(t(), Macro.t()) :: Macro.t()

Specs

spec_to_pattern(Matcha.Spec.t()) ::
  {:ok, Matcha.Pattern.t()} | {:error, Matcha.Error.problems()}

Specs

spec_to_pattern!(Matcha.Spec.t()) :: Matcha.Pattern.t() | no_return()