package otoml

  1. Overview
  2. Docs

Default TOML implementation.

exception Key_error of string

Raised when a TOML table does not have specified key.

exception Type_error of string

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

exception Parse_error of (int * int) option * string

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

type 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
module Printer : sig ... end
module Parser : sig ... end

Constructors

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

Accessors

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

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

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

High-level interface

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

Innovation. Community. Security.