package toml

  1. Overview
  2. Docs

Module Toml.ParserSource

Parses raw data into Toml data structures

Sourcetype 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.

Sourcetype result = [
  1. | `Ok of Types.table
  2. | `Error of string * location
]

Parsing result. Either Ok or error (which contains a (message, location) tuple).

Sourceval parse : Lexing.lexbuf -> string -> result

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

  • since 2.0.0
Sourceval from_string : string -> result

Given an UTF-8 string, returns a result.

  • since 2.0.0
Sourceval from_channel : in_channel -> result

Given an input channel, returns a result.

  • since 2.0.0
Sourceval from_filename : string -> result

Given a filename, returns a result.

  • since 2.0.0
Sourceexception Error of string * location
Sourceval unsafe : result -> Types.table

A combinator to force the result. Raise Error if the result was `Error.

  • since 4.0.0
OCaml

Innovation. Community. Security.