This module is a first start of what should become a full-featured
pretty printer for Prolog terms with many options and parameters.
Eventually, it should replace portray_clause/1 and various other
- To be done
- - This is just a quicky. We need proper handling of portray/1, avoid
printing very long terms multiple times, spacing (around operators),
- - Use a record for the option-processing.
- - The current approach is far too simple, often resulting in illegal
- print_term(+Term, +Options) is det
- Pretty print a Prolog term. The following options are processed:
- Define the output stream. Default is
- Width of a line. If the output is a tty and tty_size/2
can produce a size the default is the number of columns
minus 8. Otherwise the default is 72 characters. If the
Column is unbound it is unified with the computed value.
- Left margin for continuation lines. Default is the current
line position or
0 if that is not available.
- Distance between tab-stops. Default is 8 characters.
- Defines how arguments of compound terms are placed. Defined
Simply place them left to right (no line-breaks)
Place them vertically, aligned with the open bracket (not
As horizontal if line-width is not exceeded, vertical
otherwise. See also
- An integer
Place them vertically aligned, <N> spaces to the right of
the beginning of the head.
- Used by
indent_arguments(auto) to decide whether to introduce
a newline after the `(` or not. If specified and > 0, this
provides the default integer for
"hanging" mode is used if otherwise the indentation increment
is twice this value.
- This is the inverse of the write_term/3 option
Default is to respect them.
- List of options passed to write_term/3 for terms that are
not further processed. Default:
false), add a full stop (.) to the output.
false), add a newline to the output.