TomlParser Class
Parses TOML into an incremental event stream.
public sealed class TomlParserProperties
| Name | Description |
|---|---|
| Current | Gets the current parse event. |
| Depth | Gets the current event depth. |
| Diagnostics | Gets diagnostics produced by the parser. |
| HasErrors | Gets a value indicating whether diagnostics include errors. |
| ParserOptions | Gets the parser options. |
| SourceName | Gets the optional source name associated with the parsed payload. |
Current
TomlParser.csDepth
TomlParser.csDiagnostics
TomlParser.csHasErrors
TomlParser.csParserOptions
TomlParser.csSourceName
TomlParser.csMethods
| Name | Description |
|---|---|
| Create(TextReader, TomlParserOptions, TomlSerializerOptions?) | Creates a parser over TOML text from a TextReader. |
| Create(TextReader, TomlSerializerOptions?) | Creates a parser over TOML text from a TextReader. |
| Create(string, TomlParserOptions, TomlSerializerOptions?) | Creates a parser over a TOML string. |
| Create(string, TomlSerializerOptions?) | Creates a parser over a TOML string. |
| GetPropertyName() | Gets the current property name by decoding it from the original TOML input. |
| GetString() | Gets the current string scalar value by decoding it from the original TOML input. |
| MoveNext() | Advances to the next parse event. |
Create overloads
Create(TextReader, TomlParserOptions, TomlSerializerOptions?)
TomlParser.csCreates a parser over TOML text from a TextReader.
public static TomlParser Create(TextReader reader, TomlParserOptions parserOptions, TomlSerializerOptions? options = null)Parameters
readerTextReader- The text reader.
parserOptionsTomlParserOptions- Parser options controlling error handling.
optionsTomlSerializerOptions?- Optional parser/serializer options.
Returns
TomlParser A parser instance positioned before the first event.
Exceptions
TomlException- The input is longer than
TomlSerializerOptions.MaxInputLength. ArgumentNullExceptionreaderisnull.ArgumentNullExceptionparserOptionsisnull.
Create(TextReader, TomlSerializerOptions?)
TomlParser.csCreates a parser over TOML text from a TextReader.
public static TomlParser Create(TextReader reader, TomlSerializerOptions? options = null)Parameters
readerTextReader- The text reader.
optionsTomlSerializerOptions?- Optional parser/serializer options.
Returns
TomlParser A parser instance positioned before the first event.
Exceptions
TomlException- The input is longer than
TomlSerializerOptions.MaxInputLength. ArgumentNullExceptionreaderisnull.
Create(string, TomlParserOptions, TomlSerializerOptions?)
TomlParser.csCreates a parser over a TOML string.
public static TomlParser Create(string toml, TomlParserOptions parserOptions, TomlSerializerOptions? options = null)Parameters
tomlstring- The TOML payload.
parserOptionsTomlParserOptions- Parser options controlling error handling.
optionsTomlSerializerOptions?- Optional parser/serializer options.
Returns
TomlParser A parser instance positioned before the first event.
Exceptions
TomlException- The input is longer than
TomlSerializerOptions.MaxInputLength. ArgumentNullExceptiontomlisnull.ArgumentNullExceptionparserOptionsisnull.
Create(string, TomlSerializerOptions?)
TomlParser.csCreates a parser over a TOML string.
public static TomlParser Create(string toml, TomlSerializerOptions? options = null)Parameters
tomlstring- The TOML payload.
optionsTomlSerializerOptions?- Optional parser/serializer options.
Returns
TomlParser A parser instance positioned before the first event.
Exceptions
TomlException- The input is longer than
TomlSerializerOptions.MaxInputLength. ArgumentNullExceptiontomlisnull.
GetPropertyName()
TomlParser.csGets the current property name by decoding it from the original TOML input.
public string GetPropertyName()Returns
string The decoded property name.
Exceptions
InvalidOperationException- The current event is not a property name.
GetString()
TomlParser.csGets the current string scalar value by decoding it from the original TOML input.
public string GetString()Returns
string The decoded string value.
Exceptions
InvalidOperationException- The current event is not a string scalar.
MoveNext()
TomlParser.csAdvances to the next parse event.
public bool MoveNext()Returns
bool true when a parse event is available; otherwise false.
Exceptions
TomlException- The TOML payload is invalid and
TomlParserOptions.ModeisTomlParserMode.Strict.