otf.pretty
: A pretty printing library#
The library is based on Christian Lindig’s “strictly pretty” [pdf] article.
The code was modified to add the features from the QuickC– implementation
- class otf.pretty.Doc#
Type used to represent documents
This constructor should never be called directly
Documents can be concatenated via the
+
operator.
- otf.pretty.EMPTY = DocNil()#
The empty document
- otf.pretty.BREAK = DocBREAK(text=' ')#
A break is either rendered as a space or a newline followed by a spaces (the number of spaces is determined by the indentation level)
- otf.pretty.nest(indentation, doc)#
Set the indentation level for a document.
- otf.pretty.fgrp(doc)#
BREAKs inside the group are considered individually.
- Parameters
doc (Doc) –
- Returns
Doc: