parser property
Parser for a TOML value.
We have to use a LateParser
since values (arrays for example)
can contain values themselves. If we didn't use LateParser
, the
initialization of parser would be cyclic which is not allowed.
It is important that TomlDateTime
and TomlFloat
and are parsed before
TomlInteger
, since a TomlDateTime
and a TomlFloat
can start with a
TomlInteger
.
Implementation
static final Parser<TomlValue> parser =
LateParser(() => ChoiceParser<TomlValue>([
TomlDateTime.parser,
TomlFloat.parser,
TomlInteger.parser,
TomlBoolean.parser,
TomlString.parser,
TomlArray.parser,
TomlInlineTable.parser
], failureJoiner: selectFarthestJoined)
.orFailure('value expected'));