View Source Matcha.Rewrite (Matcha v0.1.10)

About rewrites.

Link to this section Summary

Link to this section Types

@type ast() :: Macro.t()
@type 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()
}
@type var_ast() :: {atom(), list(), atom() | nil}
@type var_binding() :: atom() | var_ast()
@type 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
@spec binding(t(), var_ref()) :: var_binding()
@spec 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
@spec outer_var?(t(), var_ast()) :: boolean()
Link to this function

pattern_to_spec(context, pattern)

View Source
@spec 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
@spec problem({type, description}) :: Matcha.Error.problem()
when type: :error | :warning, description: charlist() | binary()
@spec problems(problems) :: Matcha.Error.problems()
when problems: [{type, description}],
     type: :error | :warning,
     description: charlist() | binary()
Link to this function

rewrite_bindings(spec, ast)

View Source
@spec rewrite_bindings(t(), Macro.t()) :: Macro.t()
Link to this function

rewrite_body(rewrite, ast)

View Source
@spec rewrite_body(t(), Macro.t()) :: Macro.t()
Link to this function

rewrite_calls(ast, rewrite)

View Source
@spec rewrite_calls(Macro.t(), t()) :: Macro.t()
Link to this function

rewrite_conditions(rewrite, conditions)

View Source
@spec rewrite_conditions(t(), Macro.t()) :: Macro.t()
Link to this function

rewrite_match(rewrite, match)

View Source
@spec rewrite_match(t(), Macro.t()) :: Macro.t()
@spec source(t()) :: Matcha.Source.uncompiled()
@spec spec_to_pattern(Matcha.Spec.t()) ::
  {:ok, Matcha.Pattern.t()} | {:error, Matcha.Error.problems()}
@spec spec_to_pattern!(Matcha.Spec.t()) :: Matcha.Pattern.t() | no_return()