Header menu logo XParsec

XParsec Namespace

Type/Module Description

Builders

ByteParsers

CharParsers

Defines parsers for characters and strings. These parsers are more optimized for working with strings than the general parsers in `XParsec.Parsers`.

Combinators

ErrorFormatting

ErrorType<'T, 'State>

Describes why a parser failed. The default formatParseError renders these in a tree, but consumers are free to pattern-match and emit their own format.

ImmutableArrayBuilder<'T>

ImmutableArrayCE

InfiniteLoopException<'State>

Raised by looping combinators (many, sepBy*, manyTill, chainl1, fold, foldUserState, manyChars, …) when the inner parser succeeds without advancing the reader. Carries the Position{S} at which the loop got stuck so the bug can be localised.

IReadable<'T, 'Slice>

A type that can be read from, representing the input to a parser. Implement this interface to create your own input types. Use the Reader module for common input types like string, array, etc.

LineEndings<'Input>

LineIndex

ParseError

Helpers for constructing and inspecting ParseError{T,S} values. Also exposes the canonical Message values used by the standard combinators (`shouldConsume`, `bothFailed`, etc.) so user code can pattern-match against them and produce the same error shape.

ParseError<'T, 'State>

A parse error: the Position{S} at which the parser gave up, plus the structured ErrorType{T,S} describing why.

Parser<'Parsed, 'T, 'State, 'Input>

A parser is a function from a Reader{T,S,I} to a ParseResult{P,T,S}. It mutates the reader's index/state on success, and is expected to leave the reader at the position it was at on entry when it returns Error without intending to consume input.

ParseResult<'Parsed, 'T, 'State>

The result of running a parser: either the parsed value or a ParseError{T,S}. Aliased to the BCL Result type so it integrates with standard `Result.bind`/`Result.map` / `match` workflows.

Parsers

Position<'State>

A snapshot of a Reader's progress: the issuing reader's Id, the current Index, and the user State. Capture with reader.Position and restore by assigning back; assigning a position from a different reader throws.

RaiseHelpers

ReadableArray<'T>

An array slice that can be read as input by the parser.

ReadableArrayBuilder<'T>

Append-only builder that materialises into a ReadableArray, usually without copying. Single-shot: after ToReadableArray the builder releases its buffer.

ReadableImmutableArray<'T>

An immutable array slice that can be read as input by the parser.

ReadableMemory<'T>

A memory slice that can be read as input by the parser.

ReadableResizeArray<'T>

A ResizeArray slice that can be read as input by the parser.

ReadableString

A string slice that can be read as input by the parser.

Reader

Reader<'T, 'State, 'Input>

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.

ReaderId

An opaque identifier minted per Reader{T,S,I} instance. Used by Position{S} values to detect cross-reader assignments and reject them with a clear error rather than corrupting parser state.

RefParser<'Parsed, 'T, 'State, 'Input>

Holds a mutable reference to a parser allowing the creation of forward-reference or mutually recursive parsers

SmallArrayBuilder<'T>

 Stack-allocated builder for small ImmutableArray results (<= 4 items).
 Holds four inline slots and spills to an ImmutableArray.Builder on the 5th item.
 ToImmutable() dispatches to the exact-size ImmutableArray.Create overload for
 small counts, avoiding both the Builder allocation and the size-fitting copy.

 Use as a mutable local:
     let mutable xs = SmallArrayBuilder<'T>()
     xs.Add(item)
     ...
     xs.ToImmutable()

 Single-shot: do not reuse after ToImmutable().
 IsByRefLike forces the struct to stay on the stack — it can't be boxed, captured in
 a closure, stored in a heap field, or cross an async boundary. This prevents the
 silent-copy bugs typical of mutable value types.

Type something to start searching.