Table of Contents

TomlReaderState Struct

Definition

Namespace
Bodu.Text.Toml.Reader
Assembly
Bodu.Text.Toml.dll
Package
Bodu.Text.Toml 1.0.0
Source
TomlReaderState.cs

Carries the resumable state of a Utf8TomlReader between input blocks: an opaque snapshot that, together with the unconsumed bytes, lets a new reader continue exactly where the previous block's reader stopped.

public struct TomlReaderState
Inherited Members
Extension Methods

Remarks

The multi-block protocol is as follows: construct a reader over the available bytes with isFinalBlock: false; when Read() returns false, capture CurrentState, carry the bytes from BytesConsumed onward into the next buffer together with the newly arrived data, and construct the next reader from that buffer and this state. A token never spans reader instances - the reader consumes input only in whole tokens - so the caller's buffer must eventually contain the largest single token.

The state preserves the grammar context (the scan state and the open-container stack), the line counter, and the byte position within the current line, so token positions and error positions remain line- and column-accurate across blocks. Byte offsets (TokenStartIndex and Offset) are relative to the current block's buffer.

Constructors

TomlReaderState(TomlReaderOptions)

Initializes a new instance of the TomlReaderState struct describing the start of a document.

public TomlReaderState(TomlReaderOptions options = default)

Parameters

options TomlReaderOptions

The reader options controlling the specification version and maximum bracket nesting depth.

Remarks

A default-initialized TomlReaderState equally describes the start of a document with default options.

Properties

Options

Gets the reader options the state carries.

public readonly TomlReaderOptions Options { get; }

Property Value

TomlReaderOptions

The options supplied when the state was created.

Applies to

ProductVersions
.NET8, 10