The functions in this module are used to generate aesthetically attractive representations of abstract forms, which are suitable for printing. All functions return (possibly deep) lists of characters and generate an error if the form is wrong.
All functions can have an optional argument which specifies a hook that is called if an attempt is made to print an unknown form.
Pretty prints a Form which is an abstract form of a type which is returned by erl_parse:parse_form.
The same as form, but only for the attribute Attribute.
The same as form, but only for the function Function.
The same as form, but only for the guard test Guard.
The same as form, but only for the sequence of expressions in Expressions.
expr(Expression) -> DeepCharList
expr(Expression, HookFunction) -> DeepCharList
expr(Expression, Indent, HookFunction) -> DeepCharList
expr(Expression, Indent, Precedence, HookFunction) ->-> DeepCharList
This function prints one expression. It is useful for implementing hooks (see below).
The optional argument HookFunction, shown in the functions described above, defines a function which is called when an unknown form occurs where there should be a valid expression. It can have the following formats:
The hook function is called by:
Function(Expr, CurrentIndentation, CurrentPrecedence, HookFunction)
There is no hook function
The called hook function should return a (possibly deep) list of characters. expr/4 is useful in a hook.
If CurrentIndentation is negative, there will be no line breaks and only a space is used as a separator.
It should be possible to have hook functions for unknown forms at places other than expressions.