diff --git a/dev/containers/Containers_pp/Dump/index.html b/dev/containers/Containers_pp/Dump/index.html new file mode 100644 index 00000000..20a4be3c --- /dev/null +++ b/dev/containers/Containers_pp/Dump/index.html @@ -0,0 +1,2 @@ + +Dump (containers.Containers_pp.Dump)

Module Containers_pp.Dump

Printers that correspond closely to OCaml's syntax.

val list : t list -> t
\ No newline at end of file diff --git a/dev/containers/Containers_pp/Ext/index.html b/dev/containers/Containers_pp/Ext/index.html new file mode 100644 index 00000000..ccd48488 --- /dev/null +++ b/dev/containers/Containers_pp/Ext/index.html @@ -0,0 +1,2 @@ + +Ext (containers.Containers_pp.Ext)

Module Containers_pp.Ext

Extension node.

Custom nodes can be used to add user-defined behavior to the rendered output. For example, documents might be annotated with ANSI-terminal colors, or with HTML tags.

type 'a t = {
  1. pre : Out.t -> 'a -> unit;
    (*

    Printed before the wrapped value.

    *)
  2. post : Out.t -> 'a -> unit;
    (*

    Printed after the wrapped value.

    *)
}

An extension is a custom document node. It takes a value of type 'a, and a document d, and can output what it wants based on the custom value before and after d is printed.

The extension is considered to have width 0.

\ No newline at end of file diff --git a/dev/containers/Containers_pp/Flatten/index.html b/dev/containers/Containers_pp/Flatten/index.html new file mode 100644 index 00000000..5e1a5a13 --- /dev/null +++ b/dev/containers/Containers_pp/Flatten/index.html @@ -0,0 +1,2 @@ + +Flatten (containers.Containers_pp.Flatten)

Module Containers_pp.Flatten

Trivial printing, on a single line.

This is generally ugly, but it's simple and fast when we do not care about looks.

val to_out : Out.t -> t -> unit
val to_buffer : Stdlib.Buffer.t -> t -> unit
val to_string : t -> string
\ No newline at end of file diff --git a/dev/containers/Containers_pp/Infix/index.html b/dev/containers/Containers_pp/Infix/index.html new file mode 100644 index 00000000..fb7c76b5 --- /dev/null +++ b/dev/containers/Containers_pp/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (containers.Containers_pp.Infix)

Module Containers_pp.Infix

val (^) : t -> t -> t

Alias of append.

val (^+) : t -> t -> t

x ^+ y is x ^ text " " ^ y

val (^/) : t -> t -> t

x ^/ y is x ^ newline ^ y

\ No newline at end of file diff --git a/dev/containers/Containers_pp/Out/index.html b/dev/containers/Containers_pp/Out/index.html new file mode 100644 index 00000000..092534e6 --- /dev/null +++ b/dev/containers/Containers_pp/Out/index.html @@ -0,0 +1,2 @@ + +Out (containers.Containers_pp.Out)

Module Containers_pp.Out

Arbitrary output.

This is used for user-provided output.

type t = {
  1. char : char -> unit;
    (*

    Output a single char. The char is assumed not to be '\n'.

    *)
  2. sub_string : string -> int -> int -> unit;
    (*

    Output a string slice (optim for string)

    *)
  3. string : string -> unit;
    (*

    Output a string

    *)
  4. newline : unit -> unit;
    (*

    Output a newline

    *)
}
val of_buffer : Stdlib.Buffer.t -> t
val char : t -> char -> unit
val string : t -> string -> unit
val sub_string : t -> string -> int -> int -> unit
val newline : t -> unit
\ No newline at end of file diff --git a/dev/containers/Containers_pp/Pretty/index.html b/dev/containers/Containers_pp/Pretty/index.html new file mode 100644 index 00000000..e8b6a190 --- /dev/null +++ b/dev/containers/Containers_pp/Pretty/index.html @@ -0,0 +1,2 @@ + +Pretty (containers.Containers_pp.Pretty)

Module Containers_pp.Pretty

Pretty-printing.

These functions are parametrized by a width, and will try to fit the result within this width.

val to_out : width:int -> Out.t -> t -> unit

Render to an arbitrary output.

val to_string : width:int -> t -> string

Render to a string.

val to_buffer : width:int -> Stdlib.Buffer.t -> t -> unit

Render to a buffer.

val to_format : width:int -> Stdlib.Format.formatter -> t -> unit
\ No newline at end of file diff --git a/dev/containers/Containers_pp/Term_color/index.html b/dev/containers/Containers_pp/Term_color/index.html new file mode 100644 index 00000000..89a8f1cb --- /dev/null +++ b/dev/containers/Containers_pp/Term_color/index.html @@ -0,0 +1,2 @@ + +Term_color (containers.Containers_pp.Term_color)

Module Containers_pp.Term_color

Simple colors in terminals

type color = [
  1. | `Black
  2. | `Blue
  3. | `Cyan
  4. | `Green
  5. | `Magenta
  6. | `Red
  7. | `White
  8. | `Yellow
]
type style = [
  1. | `BG of color
  2. | `Bold
  3. | `FG of color
  4. | `Reset
  5. | `Underline
]
val color : color -> t -> t
val style_l : style list -> t -> t
\ No newline at end of file diff --git a/dev/containers/Containers_pp/index.html b/dev/containers/Containers_pp/index.html new file mode 100644 index 00000000..ccaa9709 --- /dev/null +++ b/dev/containers/Containers_pp/index.html @@ -0,0 +1,2 @@ + +Containers_pp (containers.Containers_pp)

Module Containers_pp

Pretty printing of documents.

A document is a structured tree of text with formatting instructions.

It can be rendered into a string ("pretty printed"), see Pretty.

This follows Wadler's paper "A prettier printer", but with some changes in the rendering part because we can't rely on lazyness to make the algebraic implementation efficient.

Some general considerations: the type t is the type of documents, a tree with text leaves that is pretty printed within a given width.

Layout is controlled via the combination of a few primitives:

Core

type t

The type of documents

val nil : t

Empty document

val char : char -> t

Single char.

val text : string -> t

Text. The string will be split on '\n', which are replaced by newline.

val textpf : ('a, unit, string, t) format4 -> 'a

Text, with a Printf-compatible format.

For example, textpf "%d-%d" 4 2 is like text "4-2".

val textf : ('a, Stdlib.Format.formatter, unit, t) format4 -> 'a

Text, with a Format-compatible format.

Note that this will bake-in any formatting done by Format. Newlines introduced by format will become hard newlines in the resulting document.

val nest : int -> t -> t

nest n d increases indentation by n inside d. If current indentation is m, then every newline inside d will be followed by n + m leading spaces.

val group : t -> t

Group the documents inside this.

Newlines immediately inside this group will either render as new lines or as spaces, depending on the width available.

val append : t -> t -> t

Concatenation.

val newline : t

A line break.

val nl : t

Alias for newline

val fill : t -> t list -> t

fill sep l resembles group (append_l ~sep l), except it tries to put as many items of l as possible on each line.

In terms of Format, this is like the hov box.

Output device

module Out : sig ... end

Arbitrary output.

Extensibility

module Ext : sig ... end

Extension node.

val ext : 'a Ext.t -> 'a -> t -> t

ext e v d wraps d with value v.

It is a document that has the same shape (and size) as d, except that additional data will be output when it is rendered using extension e.

When this is rendered, first e.pre out v is called; then d is printed; then e.post out v is called. Here out is the output buffer/stream for rendering.

Pretty print and rendering

module Pretty : sig ... end

Pretty-printing.

module Flatten : sig ... end

Trivial printing, on a single line.

val pp : Stdlib.Format.formatter -> t -> unit

Pretty-print, using Pretty and an unspecified margin.

val debug : Stdlib.Format.formatter -> t -> unit

Debug printer. This prints the structure of the document, it does not pretty-print it. See pp or Pretty.

Convenience functions

module Infix : sig ... end
include module type of Infix
val (^) : t -> t -> t

Alias of append.

val (^+) : t -> t -> t

x ^+ y is x ^ text " " ^ y

val (^/) : t -> t -> t

x ^/ y is x ^ newline ^ y

val sp : t

A single space

val append_l : ?sep:t -> t list -> t

append_l ?sep l is the concatenation of elements of l, separated by sep (default nil)

val append_sp : t list -> t

append_sp l is the concatenation of elements of l, separated by ' '

val append_nl : t list -> t

Same as append_l with sep=nl

val fill_map : t -> ('a -> t) -> 'a list -> t

fill_map sep f l is fill sep (List.map f l)

val bool : bool -> t
val int : int -> t
val float : float -> t
val float_hex : float -> t
val text_quoted : string -> t

text_quoted s is text (spf "%S" s)

val text_zero_width : string -> t

Text but we assume it takes no space on screen.

val of_list : ?sep:t -> ('a -> t) -> 'a list -> t

of_list f l maps each element of l to a document and concatenates them.

  • parameter sep

    separator inserted between elements (default nil)

val of_seq : ?sep:t -> ('a -> t) -> 'a Stdlib.Seq.t -> t

Same as of_list but with sequences.

val bracket : string -> t -> string -> t

bracket l d r groups d, between brackets l and r

val bracket2 : string -> t -> string -> t

bracket2 l d r groups d, indented by 2, between brackets l and r

val sexp_apply : string -> t list -> t

sexp_apply a l is the S-expr "(text a …l)", pretty-printed

val sexp_l : t list -> t

sexp_l [l1;…ln] is the S-expr "(l1 l2…ln)", pretty-printed

module Dump : sig ... end

Printers that correspond closely to OCaml's syntax.

module Term_color : sig ... end

Simple colors in terminals

\ No newline at end of file diff --git a/dev/containers/index.html b/dev/containers/index.html index 90c39417..d8edf060 100644 --- a/dev/containers/index.html +++ b/dev/containers/index.html @@ -1,2 +1,2 @@ -index (containers.index)

Package containers

Package info

changes-files
license-files
readme-files
\ No newline at end of file +index (containers.index)

Package containers

Package info

changes-files
license-files
readme-files
\ No newline at end of file