Header menu logo XParsec

Reader<'T, 'State, 'Input> Type

A cursor that tracks the current position in the input and the user state. It is used by the parser to read from the input and manage state.

Constructors

Constructor Description

Reader(input, state, index)

Full Usage: Reader(input, state, index)

Parameters:
    input : 'Input
    state : 'State
    index : int

Returns: Reader<'T, 'State, 'Input>
input : 'Input
state : 'State
index : int
Returns: Reader<'T, 'State, 'Input>

Instance members

Instance member Description

this.AtEnd

Full Usage: this.AtEnd

Returns: bool
Returns: bool

this.Id

Full Usage: this.Id

Returns: ReaderId
Returns: ReaderId

this.Index

Full Usage: this.Index

this.Input

Full Usage: this.Input

Returns: 'Input
Returns: 'Input

this.Length

Full Usage: this.Length

Returns: int
Returns: int

this.Peek

Full Usage: this.Peek

Returns: 'T voption
Returns: 'T voption

this.PeekN

Full Usage: this.PeekN

Parameters:
    count : int

Returns: ReadOnlySpan<'T>

Returns up to `count` items starting at the current position, clamped to the remaining input. Use this for "peek as many as are there" lookups; for strict BCL bounds semantics call `Input.AsSpan(index, length)` directly.

count : int
Returns: ReadOnlySpan<'T>

this.Position

Full Usage: this.Position

this.Skip

Full Usage: this.Skip

this.SkipN

Full Usage: this.SkipN

Parameters:
    count : int

count : int

this.Slice

Full Usage: this.Slice

Parameters:
    newStart : int
    newLength : int
    newState : 'a

Returns: Reader<'T, 'a, 'Input>

Creates a child Reader over a slice of the current input with an explicit initial state. The state type may differ from the parent reader's.

See the two-arg Slice for slicing semantics. The child reader has its own ReaderId and is independent of the parent.

newStart : int
newLength : int
newState : 'a
Returns: Reader<'T, 'a, 'Input>

this.Slice

Full Usage: this.Slice

Parameters:
    newStart : int
    newLength : int

Returns: Reader<'T, unit, 'Input>

Creates a child Reader over a slice of the current input, starting at newStart items past the current position and spanning newLength items. The child reader's state is reset to unit — use the three-arg overload to seed an explicit state.

Slicing is the standard way to run a sub-parser over a bounded region with a fresh (and possibly differently-typed) state. The child reader has its own ReaderId; Position values cross between parent and child readers will be rejected by the position setter.

newStart : int
newLength : int
Returns: Reader<'T, unit, 'Input>

this.State

Full Usage: this.State

this.TryRead

Full Usage: this.TryRead

Returns: 'T voption
Returns: 'T voption

Type something to start searching.