1996 2016 Ericsson AB, All Rights Reserved Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. The Initial Developer of the Original Code is Ericsson AB. erl_pp Robert Virding Bjarne Däcker 1 Bjarne Däcker 1997-01-24 B erl_pp.xml
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.

Optional argument HookFunction, 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 HookFunction is equal to none, there is no hook function.

The called hook function is to return a (possibly deep) list of characters. Function expr/4 is useful in a hook.

If CurrentIndentation is negative, there are no line breaks and only a space is used as a separator.

Pretty print an attribute.

Same as form/1,2, but only for attribute Attribute.

Pretty print one Expression.

Prints one expression. It is useful for implementing hooks (see section Known Limitations).

Pretty print Expressions.

Same as form/1,2, but only for the sequence of expressions in Expressions.

Pretty print a form.

Pretty prints a Form, which is an abstract form of a type that is returned by erl_parse:parse_form/1.

Pretty print a function.

Same as form/1,2, but only for function Function.

Pretty print a guard.

Same as form/1,2, but only for the guard test Guard.

Known Limitations

It is not possible to have hook functions for unknown forms at other places than expressions.

See Also

erl_eval(3), erl_parse(3), io(3)