Simple library for pretty printing text. A PP object represents
essentially a list of strings. The method render can be used
to render this object to a single string formatted in a certain
way.
Logically the strings to be pretty printed are grouped
hierarchically into groups that have to be printed side by side,
and groups that have to be printed above the other.
In implementation PP is structured recursively. It has
right and under pointers that again point to PP
objects. The PP at 'right' is to be printed right to the current
PP, and the PP at 'under' is to be printed below the current
PP. There is also a field line which contains a single
string (which should not contain a newline). It represents the
single line of text belonging to the currect PP.
The field indent specifies an indentation offset for the PP (and
all PP's below it).
In addition to the redering method, this library also provides
some methods for constructing PPs.
Example: see source code.
author: wishnu@cs.uu.nl |