TomlParser structv0.1.0
pub struct TomlParser {
// private fields
}
Constructors
TomlParser
pub func TomlParser(
allocator: Allocator,
input: char8[..],
limits: TomlLimits
) -> TomlParser
A parser over input under limits.
| Name | Type | Description |
|---|---|---|
allocator | Allocator | where the storage comes from |
input | char8[..] | the text to read |
limits | TomlLimits | the bounds the parse refuses to exceed |
Returns: a parser ready to read the input
Methods
Failure
pub func Failure(self: &TomlParser) -> TomlParseFailure?
Why parsing stopped, positioned, or none while nothing has gone wrong.
A caller using Parse never needs this: the failure comes back in the result.
Returns: the failure, or none
Failed
pub func Failed(self: &TomlParser) -> bool
Whether parsing has failed.
Returns: whether the parse stopped on a failure
Parse
pub func Parse(self: &var TomlParser) -> TomlValue ! TomlParseFailure
Reads the whole document into a table.
On failure the table holds whatever had been read before the refusal, and Outcome says what stopped it
and where. A partial document is not a usable one; it is returned rather than discarded so a caller can
show what was understood before the line that was not.
What comes back is the values and nothing else. Comments never reach the parser, and neither does the
blank line someone put between two sections or the fact that a number was written in hexadecimal. This
reads configuration; it does not edit files.
Returns: the document, or the failure and where it was found
Related
TomlLimits
pub struct TomlLimits {
// private fields
}
What a parse will accept.
Associated functions
Default
pub func Default() -> TomlLimits
Limits that suit a configuration file: deep enough for anything written by hand, shallow enough that a document built to exhaust the stack does not.
Returns: the limits an ordinary parse uses
Unlimited
pub func Unlimited() -> TomlLimits
Limits that refuse nothing, for input already known to be trustworthy.
Returns: limits that refuse nothing, for input that is already trusted