1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
|
.TH erl_pp 3 "stdlib 1.15.3" "Ericsson AB" "ERLANG MODULE DEFINITION"
.SH MODULE
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 EXPORTS
.LP
.B
form(Form) -> DeepCharList
.br
.B
form(Form, HookFunction) -> DeepCharList
.br
.RS
.TP
Types
Form = term()
.br
HookFunction = see separate description below\&.
.br
DeepCharList = [char()|DeepCharList]
.br
.RE
.RS
.LP
Pretty prints a \fIForm\fR which is an abstract form of a type which is returned by \fIerl_parse:parse_form\fR\&.
.RE
.LP
.B
attribute(Attribute) -> DeepCharList
.br
.B
attribute(Attribute, HookFunction) -> DeepCharList
.br
.RS
.TP
Types
Attribute = term()
.br
HookFunction = see separate description below\&.
.br
DeepCharList = [char()|DeepCharList]
.br
.RE
.RS
.LP
The same as \fIform\fR, but only for the attribute \fIAttribute\fR\&.
.RE
.LP
.B
function(Function) -> DeepCharList
.br
.B
function(Function, HookFunction) -> DeepCharList
.br
.RS
.TP
Types
Function = term()
.br
HookFunction = see separate description below\&.
.br
DeepCharList = [char()|DeepCharList]
.br
.RE
.RS
.LP
The same as \fIform\fR, but only for the function \fIFunction\fR\&.
.RE
.LP
.B
guard(Guard) -> DeepCharList
.br
.B
guard(Guard, HookFunction) -> DeepCharList
.br
.RS
.TP
Types
Form = term()
.br
HookFunction = see separate description below\&.
.br
DeepCharList = [char()|DeepCharList]
.br
.RE
.RS
.LP
The same as \fIform\fR, but only for the guard test \fIGuard\fR\&.
.RE
.LP
.B
exprs(Expressions) -> DeepCharList
.br
.B
exprs(Expressions, HookFunction) -> DeepCharList
.br
.B
exprs(Expressions, Indent, HookFunction) -> DeepCharList
.br
.RS
.TP
Types
Expressions = term()
.br
HookFunction = see separate description below\&.
.br
Indent = integer()
.br
DeepCharList = [char()|DeepCharList]
.br
.RE
.RS
.LP
The same as \fIform\fR, but only for the sequence of expressions in \fIExpressions\fR\&.
.RE
.LP
.B
expr(Expression) -> DeepCharList
.br
.B
expr(Expression, HookFunction) -> DeepCharList
.br
.B
expr(Expression, Indent, HookFunction) -> DeepCharList
.br
.B
expr(Expression, Indent, Precedence, HookFunction) ->-> DeepCharList
.br
.RS
.TP
Types
Expression = term()
.br
HookFunction = see separate description below\&.
.br
Indent = integer()
.br
Precedence =
.br
DeepCharList = [char()|DeepCharList]
.br
.RE
.RS
.LP
This function prints one expression\&. It is useful for implementing hooks (see below)\&.
.RE
.SH UNKNOWN EXPRESSION HOOKS
.LP
The optional argument \fIHookFunction\fR, 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:
.RS 2
.TP 4
.B
\fIFunction\fR:
The hook function is called by:
.RS 4
.LP
.nf
Function(Expr,
CurrentIndentation,
CurrentPrecedence,
HookFunction)
.fi
.RE
.TP 4
.B
\fInone\fR:
There is no hook function
.RE
.LP
The called hook function should return a (possibly deep) list of characters\&. \fIexpr/4\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\&.
.SH BUGS
.LP
It should be possible to have hook functions for unknown forms at places other than expressions\&.
.SH SEE ALSO
.LP
io(3), erl_parse(3), erl_eval(3)
|