pprint.pl -- Pretty Print Prolog terms
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 special-purpose predicates.
- print_term(+Term, +Options) is det
- Pretty print a Prolog term. The following options are processed:
- output(+Stream)
- Define the output stream. Default is
user_output
- right_margin(+Integer)
- Width of a line. Default is 72 characters.
- left_margin(+Integer)
- Left margin for continuation lines. Default is 0.
- tab_width(+Integer)
- Distance between tab-stops. Default is 8 characters.
- indent_arguments(+Spec)
- Defines how arguments of compound terms are placed. Defined
values are:
false
- Simply place them left to right (no line-breaks)
true
- Place them vertically, aligned with the open bracket (not implemented)
auto
(default)- As horizontal if line-width is not exceeded, vertical otherwise.
- An integer
- Place them vertically aligned, <N> spaces to the right of the beginning of the head.
- operators(+Boolean)
- This is the inverse of the write_term/3 option
ignore_ops
. Default is to respect them. - write_options(+List)
- List of options passed to write_term/3 for terms that are
not further processed. Default:
[ numbervars(true), quoted(true), portray(true) ]
- prepare_term(+Term, -Template, -Cycles, -Constraints)[private]
- Prepare a term, possibly holding cycles and constraints for printing.
- indent(+Out, +Indent, +Options)[private]
- Newline and indent to the indicated column. Respects the option
tab_width
. Default is 8. If the tab-width equals zero, indentation is emitted using spaces. - print_width(+Term, -W, +Options) is det[private]
- Width required when printing `normally' left-to-right.
- pprint(+Term, +Context, +Options)[private]
- The bottom-line print-routine.
- is_op1(+Name, -Type, -Priority, -ArgPriority, +Options) is semidet[private]
- True if Name is an operator taking one argument of Type.
- is_op2(+Name, -LeftPri, -Pri, -RightPri, +Options) is semidet[private]
- True if Name is an operator taking two arguments of Type.
- need_space(@Term1, @Term2, +LeftOptions, +RightOptions)[private]
- True if a space is needed between Term1 and Term2 if they are printed using the given option lists.
- end_code_type(+Term, -Code, Options)[private]
- True when code is the first/last character code that is emitted by printing Term using Options.
- primitive(+Term, -Class) is semidet[private]
- True if Term is a primitive term, rendered using the CSS class Class.
- operator_module(-Module, +Options) is det[private]
- Find the module for evaluating operators.
- arg_options(+Options, -OptionsOut) is det[private]
- Increment depth in Options.