package otoml

  1. Overview
  2. Docs

Module OtomlSource

Default TOML implementation.

Sourceexception Key_error of string

Raised when a TOML table does not have specified key.

Sourceexception Type_error of string

Raised when an operation is performed with an incompatible TOML type.

Sourceexception Parse_error of (int * int) option * string

Raised when a TOML document cannot be parsed due to syntax or semantic errors.

Sourcetype t =
  1. | TomlString of string
  2. | TomlInteger of int
  3. | TomlFloat of float
  4. | TomlBoolean of bool
  5. | TomlOffsetDateTime of string
  6. | TomlLocalDateTime of string
  7. | TomlLocalDate of string
  8. | TomlLocalTime of string
  9. | TomlArray of t list
  10. | TomlTable of (string * t) list
  11. | TomlInlineTable of (string * t) list
  12. | TomlTableArray of t list
Sourcemodule Printer : sig ... end
Sourcemodule Parser : sig ... end

Constructors

Sourceval string : string -> t
Sourceval integer : int -> t
Sourceval float : float -> t
Sourceval boolean : bool -> t
Sourceval offset_datetime : string -> t
Sourceval local_datetime : string -> t
Sourceval local_date : string -> t
Sourceval local_time : string -> t
Sourceval array : t list -> t
Sourceval table : (string * t) list -> t
Sourceval inline_table : (string * t) list -> t

Accessors

Sourceval get_value : t -> t
Sourceval get_table : t -> (string * t) list
Sourceval get_array : ?strict:bool -> t -> t list

In non-strict mode, forces a value x to a single-item array [x]

Sourceval get_string : ?strict:bool -> t -> string
Sourceval get_integer : ?strict:bool -> t -> int
Sourceval get_float : ?strict:bool -> t -> float
Sourceval get_boolean : ?strict:bool -> t -> bool

High-level interface

Sourceval list_table_keys : t -> string list
Sourceval find : t -> (t -> 'a) -> string list -> 'a
Sourceval find_opt : t -> (t -> 'a) -> string list -> 'a option
Sourceval find_or : default:'a -> t -> (t -> 'a) -> string list -> 'a
Sourceval find_result : t -> (t -> 'a) -> string list -> ('a, string) result
Sourceval update : ?use_inline_tables:bool -> t -> string list -> t option -> t
Sourcemodule Base : sig ... end