maybe_number() = number() | nan | infinity | negative_infinity
Number type extended by nan and infinity values
section() = #{binary() => value()}
A TOML table
semantic_error() = semerr_redefinition() | semerr_inline()
Data-level error, meaning that data represented by TOML config is forbidden by TOML specification.
semerr_data_location() = [pos_integer() | string()]
Location of a semantic error in inline data (arrays and objects). The location is a path specified in terms appropriate for respective data types: key for objects, 1-based index for arrays.
semerr_inline() = {duplicate, Key::string(), semerr_data_location(), semerr_location()} | {type_mismatch, {Pos::pos_integer(), OffendingType::atom(), ExpectedType::atom()}, semerr_data_location(), semerr_location()}
Error signifying that inline object has two keys of the same name or an inline array has elements of different types.
Pos
is a 1-based index in the array, ExpectedType
is data type of the
first array element, and OffendingType
is the type of the first element
that doesn't match.
semerr_location() = {Path::[string(), ...], CurLine::pos_integer(), PrevLine::pos_integer()}
Location information of semantic error. Path
is name of the offending
section and, if applicable, key.
semerr_redefinition() = {auto_section, key, semerr_location()} | {section, key | section | array_section, semerr_location()} | {array_section, key | section | auto_section, semerr_location()} | {key, key | section | auto_section | array_section, semerr_location()}
Error signifying that a key/section was already defined, either explicitly
or implicitly. The structure of the error follows convention of
{Type, PreviousType, semerr_location()}
.
auto_section
in Type
means that there already exists a key with the
same name as one of the parent sections of the current section.
auto_section
in PreviousType
means that the section was not defined
explicitly, but earlier sections restrict how it could look like (i.e.
a subsection was already defined).
toml_error() = {tokenize, Line::pos_integer()} | {parse, Line::pos_integer()} | {semantic, semantic_error()} | {bad_return, validate_location(), Result::term()}
Error in processing TOML.
validate_location() = {Section::[string()], Key::string(), Line::pos_integer()}
Location information of validation error (see validate_fun()
).
value() = maybe_number() | binary() | boolean() | [value()] | section()
Valid TOML values
get/2 | Utility function to access a value or sub-table by path. |
parse/1 | Parse a TOML config from a string. |
read_file/1 | Parse a TOML file on disk. |
Utility function to access a value or sub-table by path
parse(String::string() | binary() | iolist()) -> {ok, section()} | {error, toml_error()}
Parse a TOML config from a string
read_file(File::file:name_all()) -> {ok, section()} | {error, ReadError | toml_error()}
Parse a TOML file on disk
Generated by EDoc