module Parser: sig
.. end
Parses raw data into Toml data structures
type
location = {
|
source : string ; |
|
line : int ; |
|
column : int ; |
|
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 -> Toml.Value.table
Given a lexer buffer and a source (eg, a filename), returns a Toml table.
Since 2.0.0
Raises Toml.Parser.Error
if the buffer is not valid Toml.
val from_string : string -> Toml.Value.table
Given an UTF-8 string, returns a Toml table.
Since 2.0.0
Raises Toml.Parser.Error
if the string is not valid Toml.
val from_channel : Pervasives.in_channel -> Toml.Value.table
Given an input channel, returns a Toml table.
Since 2.0.0
Raises Toml.Parser.Error
if the data in the channel is not valid Toml.
val from_filename : string -> Toml.Value.table
Given a filename, returns a Toml table.
Since 2.0.0
RaisesToml.Parser.Error
if the data in the file is not valid Toml.
Pervasives.Sys_error
if the file could not be opened.