package ostap

  1. Overview
  2. Docs

Module Ostap.PrettySource

Pretty --- a general set of pretty-printer combinators. Implemented as a wrapper for the standard module Format to ease its use.

Sourcetype printer = Format.formatter -> unit

Printer type.

Sourceval toString : printer -> string

String conversion.

Sourceval empty : printer

Empty printer.

Sourceval newline : printer

Newline printer.

Sourceval break : printer

Break printer (prints a logical break, see standard module Format).

Sourceval box : printer

Opens box (see standard module Format).

Sourceval vbox : printer

Opens vertical box (see standard module Format).

Sourceval hbox : printer

Opens horizontal box (see standard module Format).

Sourceval hovbox : printer

Opens horizontal/vertical box (see standard module Format).

Sourceval hvbox : printer

Opens horizontal and vertical box (see standard module Format).

Sourceval endbox : printer

Closes box (see standard module Format).

Sourceval string : string -> printer

string str makes printer which prints str.

Sourceval int : int -> printer

int n makes printer of int.

Sourceval char : char -> printer

char c makes printer of char.

Sourceval bool : bool -> printer

bool b makes printer of bool.

Sourceval float : float -> printer

float f makes printer of float.

Sourceval seq : printer list -> printer

List printing combinator.

Sourceval seqa : printer array -> printer

Array printing combinator.

Sourceval listBy : printer -> printer list -> printer

listBy del list prints elements of list delimited by del.

Sourceval listAllBy : printer -> printer list -> printer

listAllBy del list prints elements of list delimited by del. Empty elements still cause printing delimiters before them

Sourceval arrayBy : printer -> printer array -> printer

arrayBy del array prints elements of array delimited by del.

Sourceval arrayAllBy : printer -> printer array -> printer

arrayAllBy del array prints elements of array delimited by del. Empty elements still cause printing delimiters before them

Sourceval listBySemicolon : printer list -> printer

A synonym for listBy (string "; ").

Sourceval listByComma : printer list -> printer

A synonym for listBy (string ", ").

Sourceval listBySpace : printer list -> printer

A synonym for listBy (string " ").

Sourceval listBySemicolonBreak : printer list -> printer

A synonym for listBy (seq [string "; "; break]).

Sourceval listByCommaBreak : printer list -> printer

A synonym for listBy (seq [string ", "; break]).

Sourceval listBySpaceBreak : printer list -> printer

A synonym for listBy (seq [string " "; break]).

Sourceval listByBreak : printer list -> printer

A synonym for listBy break.

Sourceval arrayBySemicolon : printer array -> printer

A synonym for arrayBy (string "; ").

Sourceval arrayByComma : printer array -> printer

A synonym for arrayBy (string ", ").

Sourceval arrayBySpace : printer array -> printer

A synonym for arrayBy (string " ").

Sourceval arrayBySemicolonBreak : printer array -> printer

A synonym for arrayBy (seq [string "; "; break]).

Sourceval arrayByCommaBreak : printer array -> printer

A synonym for arrayBy (seq [string ", "; break]).

Sourceval arrayBySpaceBreak : printer array -> printer

A synonym for arrayBy (seq [string " "; break]).

Sourceval arrayByBreak : printer array -> printer

A synonym for arrayBy break.

Shortcuts for boxed formatting

Sourceval boxed : printer -> printer

Prints its argument within box (see standard module Format).

Sourceval hboxed : printer -> printer

Prints its argument within hbox (see standard module Format).

Sourceval vboxed : printer -> printer

Prints its argument within vbox (see standard module Format).

Sourceval hovboxed : printer -> printer

Prints its argument within hovbox (see standard module Format).

Sourceval hvboxed : printer -> printer

Prints its argument within hvbox (see standard module Format).

Sourceval block : printer -> printer -> printer -> printer

block o c b prints b as a contents of block with opening o and closing c.

Sourceval plock : printer -> printer -> printer

plock o b prints b as a contents of prefixed block with opening o.

Sourceval brboxed : printer -> printer -> printer -> printer

brboxed left right p surrounds p by "brackets" left and right.

Sourceval rboxed : printer -> printer

Synonym for brboxed (string "(") (string ")").

Sourceval sboxed : printer -> printer

Synonym for brboxed (string "[") (string "]").

Sourceval cboxed : printer -> printer

Synonym for brboxed (string "{") (string "}").