Archeometer.Util.Code (Archeometer v0.5.0)

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 AST and finds all the definitions matching the given atoms, except if they are inside a macro definition, as quoted definitions are not yet instantiated.

Walks the given AST and stores all the ocurrences of the given atom as an operator.

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.

Determine the scope of the ast inside the full_ast.

Given a module name, it will return the underscored version of the last part of the module name.

Link to this section Functions

Link to this function

atom_concat(atom0, atom1)

Create a new atom by concatenaing two other existing ones.

Link to this function

collect_defs(full_ast, defatom)

Walks the AST and finds all the definitions matching the given atoms, except if they are inside a macro definition, as quoted definitions are not yet instantiated.

Link to this function

collect_nodes(ast, atoms)

Walks the given AST and stores all the ocurrences of the given atom as an operator.

Link to this function

get_decl(struct)

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, defstruct.

Link to this function

get_meta(arg1, atom)

Get the metadata of the given AST.

Get the maximum line number present in the metadata of an AST.

Link to this function

resolve_mod_name(full_ast, ast)

Determine the name of the module of some subset of the AST.

Link to this function

resolve_scope(full_ast, ast)

Determine the scope of the ast inside the full_ast.

Link to this function

snakefy(module)

Given a module name, it will return the underscored version of the last part of the module name.