Archeometer.Util.Code (Archeometer v0.1.1)
This module provides several helpers functions to deal with Elixir ASTs.
The functions have specific uses in other modules, but are general enough to be useful in other contexts.
Link to this section Summary
Functions
Create a new atom by concatenaing two other existing ones.
Walks the given AST and stores all the ocurrences of the given atom as an operator.
Apply collect_node2
to every atom and combine the result into a sigle list.
Get declaration information from the AST of a def
-like macro. That is
usually the name and arguments, but it dependes on the exact construct.
Get the metadata of the given AST.
Get the maximum line number present in the metadata of an AST.
Determine the name of the module of some subset of the AST.
Given a module name, it will return the underscored version of the last part of the module name.
Link to this section Functions
atom_concat(atom0, atom1)
Create a new atom by concatenaing two other existing ones.
collect_node(ast, atom)
Walks the given AST and stores all the ocurrences of the given atom as an operator.
collect_nodes(ast, atoms)
Apply collect_node2
to every atom and combine the result into a sigle list.
get_decl(arg1)
Get declaration information from the AST of a def
-like macro. That is
usually the name and arguments, but it dependes on the exact construct.
Current ones are def, defp, defmacro, defmacrop, defmodule
.
get_meta(arg1, atom)
Get the metadata of the given AST.
num_lines(ast)
Get the maximum line number present in the metadata of an AST.
resolve_mod_name(full_ast, ast)
Determine the name of the module of some subset of the AST.
snakefy(module)
Given a module name, it will return the underscored version of the last part of the module name.