erl_pp
The Erlang Pretty Printer
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.
The optional argument HookFunction
If HookFunction
is equal to none
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
is negative, there will be no line
breaks and only a space is used as a separator.
Functions
form/1
form/2
Pretty prints a
which is an abstract form of a type which is
returned by
erl_parse:parse_form/1
.
attribute/1
attribute/2
The same as form
, but only for the attribute
.
function/1
function/2
The same as form
, but only for the function
.
guard/1
guard/2
The same as form
, but only for the guard test
.
exprs/1
exprs/2
exprs/3
The same as form
, but only for the sequence of
expressions in
.
expr/1
expr/2
expr/3
expr/4
This function prints one expression. It is useful for implementing hooks (see below).
Bugs
It should be possible to have hook functions for unknown forms at places other than expressions.