package toml

  1. Overview
  2. Docs

Parses raw data into Toml data structures

type location = {
  1. source : string;
  2. line : int;
  3. column : int;
  4. position : int;
}

The location of an error. The source gives the source file of the error. The other fields give the location of the error inside the source. They all start from one. The line is the line number, the column is the number of characters from the start of the line, and the position is the number of characters from the start of the source.

exception Error of string * location

Exception raised when a parsing error occurs. Contains a (message, location) tuple.

val parse : Lexing.lexbuf -> string -> Value.table

Given a lexer buffer and a source (eg, a filename), returns a Toml table.

  • since 2.0.0
val from_string : string -> Value.table

Given an UTF-8 string, returns a Toml table.

  • since 2.0.0
val from_channel : Pervasives.in_channel -> Value.table

Given an input channel, returns a Toml table.

  • since 2.0.0
val from_filename : string -> Value.table

Given a filename, returns a Toml table.

  • raises Pervasives.Sys_error

    if the file could not be opened.

  • since 2.0.0
OCaml

Innovation. Community. Security.