.TH erl_pp 3erl "stdlib 1.18.1" "Ericsson AB" "Erlang Module Definition" .SH NAME erl_pp \- The Erlang Pretty Printer .SH DESCRIPTION .LP 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\&. .LP All functions can have an optional argument which specifies a hook that is called if an attempt is made to print an unknown form\&. .SH DATA TYPES .nf \fBhook_function()\fR\& = none .br | fun((Expr :: \fBerl_parse:abstract_expr()\fR\&, .br CurrentIndentation :: integer(), .br CurrentPrecedence :: integer() >= 0, .br HookFunction :: \fBhook_function()\fR\&) -> .br \fBio_lib:chars()\fR\&) .br .fi .RS .LP The optional argument \fB\fIHookFunction\fR\&\fR\&, shown in the functions described below, defines a function which is called when an unknown form occurs where there should be a valid expression\&. .LP If \fIHookFunction\fR\& is equal to \fInone\fR\& there is no hook function\&. .LP The called hook function should return a (possibly deep) list of characters\&. \fB\fIexpr/4\fR\&\fR\& is useful in a hook\&. .LP If \fICurrentIndentation\fR\& is negative, there will be no line breaks and only a space is used as a separator\&. .RE .SH EXPORTS .LP .nf .B form(Form) -> io_lib:chars() .br .fi .br .nf .B form(Form, HookFunction) -> io_lib:chars() .br .fi .br .RS .LP Types: .RS 3 Form = \fBerl_parse:abstract_form()\fR\& .br HookFunction = \fBhook_function()\fR\& .br .RE .RE .RS .LP Pretty prints a \fIForm\fR\& which is an abstract form of a type which is returned by \fB\fIerl_parse:parse_form/1\fR\&\fR\&\&. .RE .LP .nf .B attribute(Attribute) -> io_lib:chars() .br .fi .br .nf .B attribute(Attribute, HookFunction) -> io_lib:chars() .br .fi .br .RS .LP Types: .RS 3 Attribute = \fBerl_parse:abstract_form()\fR\& .br HookFunction = \fBhook_function()\fR\& .br .RE .RE .RS .LP The same as \fIform\fR\&, but only for the attribute \fIAttribute\fR\&\&. .RE .LP .nf .B function(Function) -> io_lib:chars() .br .fi .br .nf .B function(Function, HookFunction) -> io_lib:chars() .br .fi .br .RS .LP Types: .RS 3 Function = \fBerl_parse:abstract_form()\fR\& .br HookFunction = \fBhook_function()\fR\& .br .RE .RE .RS .LP The same as \fIform\fR\&, but only for the function \fIFunction\fR\&\&. .RE .LP .nf .B guard(Guard) -> io_lib:chars() .br .fi .br .nf .B guard(Guard, HookFunction) -> io_lib:chars() .br .fi .br .RS .LP Types: .RS 3 Guard = [\fBerl_parse:abstract_expr()\fR\&] .br HookFunction = \fBhook_function()\fR\& .br .RE .RE .RS .LP The same as \fIform\fR\&, but only for the guard test \fIGuard\fR\&\&. .RE .LP .nf .B exprs(Expressions) -> io_lib:chars() .br .fi .br .nf .B exprs(Expressions, HookFunction) -> io_lib:chars() .br .fi .br .nf .B exprs(Expressions, Indent, HookFunction) -> io_lib:chars() .br .fi .br .RS .LP Types: .RS 3 Expressions = [\fBerl_parse:abstract_expr()\fR\&] .br Indent = integer() .br HookFunction = \fBhook_function()\fR\& .br .RE .RE .RS .LP The same as \fIform\fR\&, but only for the sequence of expressions in \fIExpressions\fR\&\&. .RE .LP .nf .B expr(Expression) -> io_lib:chars() .br .fi .br .nf .B expr(Expression, HookFunction) -> io_lib:chars() .br .fi .br .nf .B expr(Expression, Indent, HookFunction) -> io_lib:chars() .br .fi .br .nf .B expr(Expression, Indent, Precedence, HookFunction) -> .B io_lib:chars() .br .fi .br .RS .LP Types: .RS 3 Expression = \fBerl_parse:abstract_expr()\fR\& .br Indent = integer() .br Precedence = integer() >= 0 .br HookFunction = \fBhook_function()\fR\& .br .RE .RE .RS .LP This function prints one expression\&. It is useful for implementing hooks (see below)\&. .RE .SH "BUGS" .LP It should be possible to have hook functions for unknown forms at places other than expressions\&. .SH "SEE ALSO" .LP \fBio(3erl)\fR\&, \fBerl_parse(3erl)\fR\&, \fBerl_eval(3erl)\fR\&