The new function
is_emptyallows testing (in constant time) whether a document is empty.
Documentation: add a warning about the time and space complexity of a naive use of
The library now requires OCaml 4.03 or newer.
Add a new micro-benchmark, which uses
core_benchand involves randomly-generated arithmetic expressions.
Improved documentation. (Initial proposal by Thomas Refis, extended by François Pottier.)
The internal modules
PPrintOCamlhave been removed. (Their existence was an implementation detail.) Please refer to
Trailing blank characters at the end of a line are now suppressed. This includes indentation characters (whose production is implicit) as well as blank characters that are explicitly produced by the combinators
blank. Trailing blank characters are suppressed in both rendering modes (pretty and compact). (Contributed by Thomas Refis, reviewed and polished by François Pottier.)
Change the behavior of
Format.pp_print_textinternally. This means that a newline character causes a call to
Format.pp_force_newline; a space character causes a call to
Format.pp_print_space; and every other character is printed using
Avoid a few compilation warnings.
linefield to the
staterecord, which can be read by the code that implements custom documents. Add a
rangecombinator that allows retrieving the start and end points of a (sub)document in the output. (Suggested by Victor Gomes.)
Update the code and build options to use
-safe-string. This means that the library now requires OCaml 4.02 or later, and is compatible with 4.06.
Moved to github and changed the license to LGPL with an exception.
Minor changes in the implementation of
substring. Initially committed on 2014/03/24, but left out of the 20140424 release due to a goof-up.
Changed the behavior of
align, which was not consistent with its documentation.
alignnow sets the indentation level to the current column. In particular, this means that
align (align d)is equivalent to
align d, which was not the case previously. Thanks to Dmitry Grebeniuk for reporting this issue.
The library is now extensible (in principle). A
customdocument constructor allows the user to define her own documents, as long as they fit the manner in which the current rendering engine works.
compactrendering engine is now tail-recursive too.
Minor optimisation in the smart constructor
New (simpler) pretty-printing engine. The representation of documents in memory is slightly larger; document construction is perhaps slightly slower, while rendering is significantly faster. (Construction dominates rendering.) The rendering speed is now guaranteed to be independent of the width parameter. The price to pay for this simplification is that the primitive document constructors
nestingare no longer supported. The API is otherwise unchanged.
First official release of PPrint.