package mdx

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Code blocks.

type value =
  1. | Raw
  2. | OCaml
  3. | Error of string list
  4. | Cram of {
    1. pad : int;
    2. tests : Cram.t list;
    }
  5. | Toplevel of Toplevel.t list

The type for block values.

type section = int * string

The type for sections.

type t = {
  1. line : int;
  2. file : string;
  3. section : section option;
  4. labels : (string * string option) list;
  5. header : string option;
  6. contents : string list;
  7. value : value;
}

The type for supported code blocks.

Printers

val dump : t Fmt.t

dump is the printer for dumping code blocks. Useful for debugging.

val pp_header : t Fmt.t

pp_header pretty-prints block headers.

val pp_contents : t Fmt.t

pp_contents pretty-prints block contents.

pp_footer pretty-prints block footer.

val pp : t Fmt.t

pp pretty-prints blocks.

val pp_line_directive : (string * int) Fmt.t

pp_line_directive pretty-prints a line directive given as a filename and line number.

Accessors

val mode : t -> [ `Non_det of [ `Command | `Output ] | `Normal ]

mode t is t's mode.

val directory : t -> string option

directory t is the directory where t tests should be run.

val value : t -> value

value t is t's value.

val section : t -> section option

section t is t's section.

val header : t -> string option

header t is t's header.

val executable_contents : t -> string list

executable_contents t is either t's contents if t is a raw or a cram block, or t's commands if t is a toplevel fragments (e.g. the phrase result is discarded).

Evaluation

val eval : t -> t

eval t is the same as t but with it's value replaced by either Cram or Toplevel blocks, depending on t's header.

Parsers

val labels_of_string : string -> (string * string option) list

labels_of_string s cuts s into a list of labels.

OCaml

Innovation. Community. Security.