package smart-print

  1. Overview
  2. Docs
A pretty-printing library in OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

v0.3.0.tar.gz
sha256=c28d6260af67666c5d70542dc496d3a0c3e48be441aa23f82df3cf2898d1884f
sha512=45e1485eaab0633f352868ab85d7551ec6c32a4b8a56dd882c0e3145a10630da746b92f0b4870f6c141abd12ceac161ac916d774627616e6929dfa485059d33e

doc/smart-print/SmartPrint/index.html

Module SmartPrintSource

SmartPrint library.

Sourcetype t

The document's abstract type.

Sourceval empty : t

The empty document.

Sourceval string : string -> t

A non-breakable string. The string should be newlines free.

Sourceval sub_string : string -> int -> int -> t

A non-breakable string pointing to the sub-string of an existing string. Does not duplicate the sub-string. The sub-string is indexed by its offset and its length.

Sourceval (!^) : string -> t

A shortcut for string.

Sourceval space : t

A breakable space.

Sourceval newline : t

A newline.

Sourceval append : t -> t -> t

Concatenation of two documents.

Sourceval (^-^) : t -> t -> t

A shortcut for append.

Sourceval concat_with_space : t -> t -> t

Concatenation of two documents with a breakable space in between. Like d1 ^-^ space ^-^ d2.

Sourceval (^^) : t -> t -> t

A shortcut for concat_with_space. Like d1 ^-^ space ^-^ d2.

Sourceval words : string -> t

Split a non-unicode string into words and breakable spaces.

Sourceval lines : string -> t

Split a non-unicode string into lines at each newline.

Sourceval indent : t -> t

Add one level of indentation.

Sourceval nest : t -> t

Group a document, breaking spaces only when necessary. Indent when spaces are broken.

Sourceval nest_all : t -> t

Group a document, breaking all spaces if the line is full. Indent when spaces are broken.

Sourceval group : t -> t

Group a document, breaking spaces only when necessary. Do not indent when spaces are broken.

Sourceval group_all : t -> t

Group a document, breaking all spaces if the line is full. Do not indent when spaces are broken.

Sourceval parens : t -> t

Enclose the document in parenthesis ( ).

Sourceval braces : t -> t

Enclose the document in braces { }.

Sourceval brakets : t -> t

Enclose the document in brakets [ ].

Sourceval angle_brakets : t -> t

Enclose the document in angle brakets < >.

Sourceval single_quotes : t -> t

Enclose the document in single quotes ' '.

Sourceval double_quotes : t -> t

Enclose the document in double quotes " ".

Sourceval concat : t list -> t

Concatenate the list of documents with no space. concat [d1; ...; dn] = d1 ^-^ ... ^-^ dn

Sourceval separate : t -> t list -> t

Concatenate the list of documents with no space but adding a separator in between. separate sep [d1; ...; dn] = d1 ^-^ sep ^-^ d2 ^-^ sep ... sep ^-^ dn

Sourcemodule OCaml : sig ... end

Pretty-printing of OCaml values.

Sourcemodule Debug : sig ... end

A pretty-printer for the pretty-printer itself.

Sourceval to_something : int -> int -> (char -> unit) -> (string -> unit) -> (string -> int -> int -> unit) -> t -> unit

Render a document with a maximal width per line and a tabulation size. Uses the functions add_char, add_string and add_sub_string given.

Sourceval to_buffer : int -> int -> Buffer.t -> t -> unit

Render a document in a buffer with a maximal width per line and a tabulation size.

Sourceval to_string : int -> int -> t -> string

Render a document in a string with a maximal width per line and a tabulation size.

Sourceval to_out_channel : int -> int -> out_channel -> t -> unit

Render a document in an output channel with a maximal width per line and a tabulation size.

Sourceval to_stdout : int -> int -> t -> unit

Render a document on stdout with a maximal width per line and a tabulation size.

OCaml

Innovation. Community. Security.