Corner.Ast (corner v0.1.2)

Helpers for operating AST.

The first parameter suggested to be an ast for all of functions exception of make_map/2 in this module.

Link to this section Summary

Functions

Check if the clauses have the same arity.

Get the real arguments after return from Macro.decompose_call/1.

Check if the ast is compsed type.

Check if the ast is a map.

Check if the ast is a pin expression.

Check if the ast is a Regex.

Check if the ast is a struct.

Check if the ast is a tuple.

Check if the ast is the ast of a variable.

Convert list to tuple.

Make a map for the give keys and values.

Get the keys in the ast of the map.

If the ast is a tuple, return the size of the tuple.

Convert tuple to list.

Link to this section Functions

Link to this function

clauses_arity_check(list)

Check if the clauses have the same arity.

If all caluses have some arity, return {:ok, arity}, else return :error.

Get the real arguments after return from Macro.decompose_call/1.

Link to this function

is_composed_type?(ast)

Check if the ast is compsed type.

Map, tuple, and struct and list are reconized as compsed type.

Check if the ast is a map.

An ast of a struct is also reconized as a map, but a variable which binding a value of map or struct is not.

Check if the ast is a pin expression.

Link to this function

is_regex?(arg1)

Check if the ast is a Regex.

sigil_r/1 and sigile_R/1 are reconized as regex.

But a variable whicn biding a Regex strcut not regconized as a regex.

Link to this function

is_struct?(arg1)

Check if the ast is a struct.

A variable which bidnding a value of one struct is recongized as variable not a struct.

Link to this function

is_tuple?(arg1)

Check if the ast is a tuple.

Link to this function

is_variable?(ast)

Check if the ast is the ast of a variable.

Link to this function

list_to_tuple(ast)

Convert list to tuple.

Link to this function

make_map(keys, values)

Make a map for the give keys and values.

Get the keys in the ast of the map.

Link to this function

map_values(arg)

Link to this function

tuple_size(ast)

If the ast is a tuple, return the size of the tuple.

Link to this function

tuple_to_list(ast)

Convert tuple to list.