.TH erl_pp 3erl "stdlib 3.2" "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\& = .br none | .br fun((Expr :: \fBerl_parse:abstract_expr()\fR\&, .br CurrentIndentation :: integer(), .br CurrentPrecedence :: integer() >= 0, .br Options :: \fBoptions()\fR\&) -> .br \fBio_lib:chars()\fR\&) .br .fi .RS .LP Optional argument \fIHookFunction\fR\&, shown in the functions described in this module, defines a function that is called when an unknown form occurs where there is to be a valid expression\&. If \fIHookFunction\fR\& is equal to \fInone\fR\&, there is no hook function\&. .LP The called hook function is to return a (possibly deep) list of characters\&. Function \fB\fIexpr/4\fR\&\fR\& is useful in a hook\&. .LP If \fICurrentIndentation\fR\& is negative, there are no line breaks and only a space is used as a separator\&. .RE .nf \fBoption()\fR\& = .br {hook, \fBhook_function()\fR\&} | {encoding, latin1 | unicode | utf8} .br .fi .nf \fBoptions()\fR\& = \fBhook_function()\fR\& | [\fBoption()\fR\&] .br .fi .SH EXPORTS .LP .nf .B attribute(Attribute) -> io_lib:chars() .br .fi .br .nf .B attribute(Attribute, Options) -> io_lib:chars() .br .fi .br .RS .LP Types: .RS 3 Attribute = \fBerl_parse:abstract_form()\fR\& .br Options = \fBoptions()\fR\& .br .RE .RE .RS .LP Same as \fB\fIform/1,2\fR\&\fR\&, but only for attribute \fIAttribute\fR\&\&. .RE .LP .nf .B expr(Expression) -> io_lib:chars() .br .fi .br .nf .B expr(Expression, Options) -> io_lib:chars() .br .fi .br .nf .B expr(Expression, Indent, Options) -> io_lib:chars() .br .fi .br .nf .B expr(Expression, Indent, Precedence, Options) -> 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 Options = \fBoptions()\fR\& .br .RE .RE .RS .LP Prints one expression\&. It is useful for implementing hooks (see section \fBKnown Limitations\fR\&)\&. .RE .LP .nf .B exprs(Expressions) -> io_lib:chars() .br .fi .br .nf .B exprs(Expressions, Options) -> io_lib:chars() .br .fi .br .nf .B exprs(Expressions, Indent, Options) -> io_lib:chars() .br .fi .br .RS .LP Types: .RS 3 Expressions = [\fBerl_parse:abstract_expr()\fR\&] .br Indent = integer() .br Options = \fBoptions()\fR\& .br .RE .RE .RS .LP Same as \fB\fIform/1,2\fR\&\fR\&, but only for the sequence of expressions in \fIExpressions\fR\&\&. .RE .LP .nf .B form(Form) -> io_lib:chars() .br .fi .br .nf .B form(Form, Options) -> io_lib:chars() .br .fi .br .RS .LP Types: .RS 3 Form = \fBerl_parse:abstract_form()\fR\& | \fBerl_parse:form_info()\fR\& .br Options = \fBoptions()\fR\& .br .RE .RE .RS .LP Pretty prints a \fIForm\fR\&, which is an abstract form of a type that is returned by \fB\fIerl_parse:parse_form/1\fR\&\fR\&\&. .RE .LP .nf .B function(Function) -> io_lib:chars() .br .fi .br .nf .B function(Function, Options) -> io_lib:chars() .br .fi .br .RS .LP Types: .RS 3 Function = \fBerl_parse:abstract_form()\fR\& .br Options = \fBoptions()\fR\& .br .RE .RE .RS .LP Same as \fB\fIform/1,2\fR\&\fR\&, but only for function \fIFunction\fR\&\&. .RE .LP .nf .B guard(Guard) -> io_lib:chars() .br .fi .br .nf .B guard(Guard, Options) -> io_lib:chars() .br .fi .br .RS .LP Types: .RS 3 Guard = [\fBerl_parse:abstract_expr()\fR\&] .br Options = \fBoptions()\fR\& .br .RE .RE .RS .LP Same as \fB\fIform/1,2\fR\&\fR\&, but only for the guard test \fIGuard\fR\&\&. .RE .SH "KNOWN LIMITATIONS" .LP It is not possible to have hook functions for unknown forms at other places than expressions\&. .SH "SEE ALSO" .LP \fB\fIerl_eval(3erl)\fR\&\fR\&, \fB\fIerl_parse(3erl)\fR\&\fR\&, \fB\fIio(3erl)\fR\&\fR\&