expug v0.9.2 Expug.Transformer View Source
Transforms a node after compilation.
Link to this section Summary
Functions
Finds out what clauses can follow a given clause
Closes all a given next
clause in the given children
Closes all possible clauses in the given children
Get the prelude of a given node
Transforms a node
Link to this section Functions
Finds out what clauses can follow a given clause.
iex> Expug.Transformer.clause_after("if")
["else"]
iex> Expug.Transformer.clause_after("try")
["catch", "rescue", "after"]
iex> Expug.Transformer.clause_after("cond")
[] # nothing can follow cond
Closes all a given next
clause in the given children
.
Returns a tuple of {status, children}
where :status
depicts what happened
on the first node given to it. :multi
means it was matched for a multi-clause,
:single
means it was matched for a single clause, :ok
otherwise.
Closes all possible clauses in the given children
.
Get the prelude of a given node
iex> Expug.Transformer.prelude(%{value: "if foo"})
"if"
iex> Expug.Transformer.prelude(%{value: "case derp"})
"case"
iex> Expug.Transformer.prelude(%{value: "1 + 2"})
nil
Transforms a node.