Header menu logo XParsec

Combinators Module

Types

Type Description

ParserCE

Functions and values

Function or value Description

(.>>) p1 p2 reader

Full Usage: (.>>) p1 p2 reader

Parameters:
    p1 : Parser<'A, 'T, 'State, 'Input>
    p2 : Parser<'B, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<'A, 'T, 'State>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input, 'B

Applies the parsers `p1` and `p2` in sequence. If both succeed, returns the result of `p1`.

p1 : Parser<'A, 'T, 'State, 'Input>
p2 : Parser<'B, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<'A, 'T, 'State>

(.>>.) p1 p2 reader

Full Usage: (.>>.) p1 p2 reader

Parameters:
    p1 : Parser<'A, 'T, 'State, 'Input>
    p2 : Parser<'B, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<('A * 'B), 'T, 'State>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input, 'B

Applies the parsers `p1` and `p2` in sequence. If both succeed, returns the result of `p1` and `p2`.

p1 : Parser<'A, 'T, 'State, 'Input>
p2 : Parser<'B, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<('A * 'B), 'T, 'State>

() p1 message reader

Full Usage: () p1 message reader

Parameters:
    p1 : Parser<'A, 'T, 'State, 'Input>
    message : string
    reader : Reader<'T, 'State, 'Input>

Returns: Result<'A, ParseError<'T, 'State>>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input

Applies the parser `p1`, if it succeeds, returns the result of `p1`. If `p1` fails without consuming input, the parser fails with the given `message`. If `p1` fails and consumes input, the parser fails with the result of `p1`.

p1 : Parser<'A, 'T, 'State, 'Input>
message : string
reader : Reader<'T, 'State, 'Input>
Returns: Result<'A, ParseError<'T, 'State>>

() p1 message reader

Full Usage: () p1 message reader

Parameters:
    p1 : Parser<'A, 'T, 'State, 'Input>
    message : string
    reader : Reader<'T, 'State, 'Input>

Returns: Result<'A, ParseError<'T, 'State>>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input

Applies the parser `p1`, if it succeeds, returns the result of `p1`. If `p1` fails without consuming input, the parser fails with the given `message`. If `p1` fails and consumes input, the parser fails with a nested error of the given `message` and the result of `p1`.

p1 : Parser<'A, 'T, 'State, 'Input>
message : string
reader : Reader<'T, 'State, 'Input>
Returns: Result<'A, ParseError<'T, 'State>>

(<|>%) p1 x reader

Full Usage: (<|>%) p1 x reader

Parameters:
    p1 : Parser<'A, 'T, 'State, 'Input>
    x : 'A
    reader : Reader<'T, 'State, 'Input>

Returns: Result<'A, ParseError<'T, 'State>>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input

Applies the parser `p1` and, if it fails, returns the value `x`. If `p1` succeeds, the input is consumed. If `p1` fails, no input is consumed.

p1 : Parser<'A, 'T, 'State, 'Input>
x : 'A
reader : Reader<'T, 'State, 'Input>
Returns: Result<'A, ParseError<'T, 'State>>

(<|>) p1 p2 reader

Full Usage: (<|>) p1 p2 reader

Parameters:
    p1 : Parser<'A, 'T, 'State, 'Input>
    p2 : Parser<'A, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: Result<'A, ParseError<'T, 'State>>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input

Applies the parser p1 and, if it fails, restores the reader position and applies p2. Returns the result of the first parser that succeeds, or both errors if both fail.

XParsec's <|>always backtracks on failure of p1 — regardless of how much input p1 consumed before failing. This is unlike FParsec, where <|> only tries the right-hand side if the LHS failed without consuming input.

As a consequence, XParsec has no attempt combinator: every alternative already behaves like one. The position-save is a struct copy, so the always-backtrack default is cheap. If you need "fail fast when input was consumed", reach for notFollowedBy or <?> to gate or relabel instead.

p1 : Parser<'A, 'T, 'State, 'Input>
p2 : Parser<'A, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: Result<'A, ParseError<'T, 'State>>

(>>%) p x reader

Full Usage: (>>%) p x reader

Parameters:
    p : Parser<'A, 'T, 'State, 'Input>
    x : 'a
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<'a, 'T, 'State>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input, 'a

Applies the parser `p` and, if it succeeds, returns the value `x`.

p : Parser<'A, 'T, 'State, 'Input>
x : 'a
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<'a, 'T, 'State>

(>>.) p1 p2 reader

Full Usage: (>>.) p1 p2 reader

Parameters:
    p1 : Parser<'A, 'T, 'State, 'Input>
    p2 : Parser<'B, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<'B, 'T, 'State>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input, 'B

Applies the parsers `p1` and `p2` in sequence. If both succeed, returns the result of `p2`.

p1 : Parser<'A, 'T, 'State, 'Input>
p2 : Parser<'B, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<'B, 'T, 'State>

p >>= binder

Full Usage: p >>= binder

Parameters:
    p : Parser<'a, 'b, 'c, 'd>
    binder : 'a -> Parser<'e, 'b, 'c, 'd>

Returns: Reader<'b, 'c, 'd> -> ParseResult<'e, 'b, 'c>
Modifiers: inline
Type parameters: 'a, 'b, 'c, 'd, 'e

Applies the parser `p` and, if it succeeds, computes the parser `p2` of `binder` with the result of `p`. Finally, it returns the result of `p2`.

p : Parser<'a, 'b, 'c, 'd>
binder : 'a -> Parser<'e, 'b, 'c, 'd>
Returns: Reader<'b, 'c, 'd> -> ParseResult<'e, 'b, 'c>

(|>>) p mapping reader

Full Usage: (|>>) p mapping reader

Parameters:
    p : Parser<'A, 'T, 'State, 'Input>
    mapping : 'A -> 'B
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<'B, 'T, 'State>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input, 'B

Applies the parser `p` and, if it succeeds, computes the function `mapping` with the result of `p`.

p : Parser<'A, 'T, 'State, 'Input>
mapping : 'A -> 'B
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<'B, 'T, 'State>

between pOpen pClose p reader

Full Usage: between pOpen pClose p reader

Parameters:
    pOpen : Parser<'A, 'T, 'State, 'Input>
    pClose : Parser<'B, 'T, 'State, 'Input>
    p : Parser<'C, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<'C, 'T, 'State>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input, 'B, 'C

Applies the parsers `pOpen`, `p` and `pClose` in sequence. If all succeed, returns the result of `p`.

pOpen : Parser<'A, 'T, 'State, 'Input>
pClose : Parser<'B, 'T, 'State, 'Input>
p : Parser<'C, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<'C, 'T, 'State>

bind p binder reader

Full Usage: bind p binder reader

Parameters:
    p : Parser<'A, 'T, 'State, 'Input>
    binder : 'A -> Parser<'B, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<'B, 'T, 'State>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input, 'B

Applies the parser `p` and, if it succeeds, computes the parser `p2` of `binder` with the result of `p`. Finally, it returns the result of `p2`.

p : Parser<'A, 'T, 'State, 'Input>
binder : 'A -> Parser<'B, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<'B, 'T, 'State>

chainl p pOp orElse reader

Full Usage: chainl p pOp orElse reader

Parameters:
    p : Parser<'a, 'b, 'c, 'd>
    pOp : Parser<('a -> 'a -> 'a), 'b, 'c, 'd>
    orElse : 'a
    reader : Reader<'b, 'c, 'd>

Returns: Result<'a, ParseError<'b, 'c>>

Applies the parser `p` zero or more times, separated by `pOp`. If `pOp` succeeds, combines the results of `p` before and after in a left-associative manner. If `p` fails on the first attempt, this parser returns the result of `orElse`. This parser always succeeds.

p : Parser<'a, 'b, 'c, 'd>
pOp : Parser<('a -> 'a -> 'a), 'b, 'c, 'd>
orElse : 'a
reader : Reader<'b, 'c, 'd>
Returns: Result<'a, ParseError<'b, 'c>>

chainl1 p pOp reader

Full Usage: chainl1 p pOp reader

Parameters:
    p : Parser<'A, 'T, 'State, 'Input>
    pOp : Parser<('A -> 'A -> 'A), 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<'A, 'T, 'State>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input

Applies the parser `p` one or more times, separated by `pOp`. If `pOp` succeeds, combines the results of `p` before and after in a left-associative manner. If `p` fails on the first attempt, this parser fails.

p : Parser<'A, 'T, 'State, 'Input>
pOp : Parser<('A -> 'A -> 'A), 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<'A, 'T, 'State>

chainr p pOp orElse reader

Full Usage: chainr p pOp orElse reader

Parameters:
    p : Parser<'a, 'b, 'c, 'd>
    pOp : Parser<('a -> 'a -> 'a), 'b, 'c, 'd>
    orElse : 'a
    reader : Reader<'b, 'c, 'd>

Returns: Result<'a, ParseError<'b, 'c>>

Applies the parser `p` zero or more times, separated by `pOp`. If `pOp` succeeds, combines the results of `p` before and after in a right-associative manner. If `p` fails on the first attempt, this parser returns the result of `orElse`. This parser always succeeds.

p : Parser<'a, 'b, 'c, 'd>
pOp : Parser<('a -> 'a -> 'a), 'b, 'c, 'd>
orElse : 'a
reader : Reader<'b, 'c, 'd>
Returns: Result<'a, ParseError<'b, 'c>>

chainr1 p pOp reader

Full Usage: chainr1 p pOp reader

Parameters:
    p : Parser<'A, 'T, 'State, 'Input>
    pOp : Parser<('A -> 'A -> 'A), 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<'A, 'T, 'State>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input

Applies the parser `p` one or more times, separated by `pOp`. If `pOp` succeeds, combines the results of `p` before and after in a right-associative manner. If `p` fails on the first attempt, this parser fails.

p : Parser<'A, 'T, 'State, 'Input>
pOp : Parser<('A -> 'A -> 'A), 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<'A, 'T, 'State>

choice ps

Full Usage: choice ps

Parameters:
    ps : Parser<'A, 'T, 'State, 'Input> seq

Returns: Parser<'A, 'T, 'State, 'Input>

Applies the parsers ps in order. Returns the result of the first parser that succeeds, or a nested error containing every branch's failure if all fail.

Like <|>, choicealways backtracks: if a branch fails after consuming input, the reader position is restored before the next branch runs. There is no per-branch attempt needed — XParsec has no attempt at all. This is unlike FParsec, where choice only continues if a branch failed without consuming input.

Accumulating every branch's error allocates a list per call; prefer choiceL when the per-branch detail isn't needed.

ps : Parser<'A, 'T, 'State, 'Input> seq
Returns: Parser<'A, 'T, 'State, 'Input>

choiceL ps message

Full Usage: choiceL ps message

Parameters:
    ps : Parser<'A, 'T, 'State, 'Input> seq
    message : string

Returns: Parser<'A, 'T, 'State, 'Input>

Applies the parsers ps in order. Returns the result of the first parser that succeeds, or fails with the given message if all fail — discarding the per-branch errors that choice would have accumulated.

Same backtracking semantics as choice and <|>: every branch is tried with the reader rewound to the entry position. Use this over choice when you can supply a clearer top-level error than the nested per-branch tree.

ps : Parser<'A, 'T, 'State, 'Input> seq
message : string
Returns: Parser<'A, 'T, 'State, 'Input>

countMany1Satisfies predicate reader

Full Usage: countMany1Satisfies predicate reader

Parameters:
    predicate : 'a -> bool
    reader : Reader<'a, 'b, 'c>

Returns: ParseResult<int64, 'a, 'b>

Applies a predicate to the input one or more times and returns the number of successful matches.

If the predicate fails on the first element, this parser fails. It is more efficient than `many1 (satisfy predicate)` when only the count is needed.

predicate : 'a -> bool
reader : Reader<'a, 'b, 'c>
Returns: ParseResult<int64, 'a, 'b>

countManySatisfies predicate reader

Full Usage: countManySatisfies predicate reader

Parameters:
    predicate : 'a -> bool
    reader : Reader<'a, 'b, 'c>

Returns: ParseResult<int64, 'a, 'b>

Applies a predicate to the input zero or more times and returns the number of successful matches.

This parser always succeeds. It is more efficient than `many (satisfy predicate)` when only the count is needed.

predicate : 'a -> bool
reader : Reader<'a, 'b, 'c>
Returns: ParseResult<int64, 'a, 'b>

dispatch f reader

Full Usage: dispatch f reader

Parameters:
    f : 'T voption -> Parser<'Parsed, 'T, 'State, 'Input> - A function that maps the lookahead token (or ValueNone at the end of input) to a parser.
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<'Parsed, 'T, 'State>
Modifiers: inline
Type parameters: 'T, 'Parsed, 'State, 'Input

Peeks at the next token (without consuming it) and uses it to select the next parser to run.

This combinator is ideal for implementing LL(1) grammars (predictive parsing). It allows the parser to branch deterministically based on a single lookahead token.

Use dispatch instead of choice when the next token uniquely identifies which parser to use. This avoids the overhead of sequential trial-and-error and prevents unnecessary backtracking.

f : 'T voption -> Parser<'Parsed, 'T, 'State, 'Input>

A function that maps the lookahead token (or ValueNone at the end of input) to a parser.

reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<'Parsed, 'T, 'State>

dispatchWithState f reader

Full Usage: dispatchWithState f reader

Parameters:
    f : 'State -> 'T voption -> Parser<'Parsed, 'T, 'State, 'Input> - A function that maps the current state and lookahead token to a parser.
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<'Parsed, 'T, 'State>
Modifiers: inline
Type parameters: 'State, 'T, 'Parsed, 'Input

Peeks at the next token (without consuming it) and retrieves the current user state, using both to select the next parser to run.

This is an optimization for Context-Sensitive LL(1) grammars.

It avoids the overhead of getUserState >>= ... by passing the state directly to the dispatch function. This is particularly useful for parsers that need to switch behavior based on a context.

f : 'State -> 'T voption -> Parser<'Parsed, 'T, 'State, 'Input>

A function that maps the current state and lookahead token to a parser.

reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<'Parsed, 'T, 'State>

followedBy p1 reader

Full Usage: followedBy p1 reader

Parameters:
    p1 : Parser<'A, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<unit, 'T, 'State>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input

Applies the parser `p1`, if it succeeds, ensures that the parser has not changed the input position. If `p1` fails, no input is consumed.

p1 : Parser<'A, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<unit, 'T, 'State>

followedByL p1 message reader

Full Usage: followedByL p1 message reader

Parameters:
    p1 : Parser<'A, 'T, 'State, 'Input>
    message : string
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<unit, 'T, 'State>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input

Applies the parser `p1`, if it succeeds, ensures that the parser has not changed the input position. If `p1` fails, no input is consumed. If `p1` succeeds and consumes input, the parser fails with the given `message`.

p1 : Parser<'A, 'T, 'State, 'Input>
message : string
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<unit, 'T, 'State>

lookAhead p1 reader

Full Usage: lookAhead p1 reader

Parameters:
    p1 : Parser<'A, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: Result<'A, ParseError<'T, 'State>>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input

Applies the parser `p1`, if it succeeds, returns the result of `p1` without consuming input.

p1 : Parser<'A, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: Result<'A, ParseError<'T, 'State>>

many p reader

Full Usage: many p reader

Parameters:
    p : Parser<'A, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<ImmutableArray<'A>, 'T, 'State>

Applies the parser `p` zero or more times. If it succeeds, returns the results as an ImmutableArray. This parser always succeeds.

p : Parser<'A, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<ImmutableArray<'A>, 'T, 'State>

many1 p reader

Full Usage: many1 p reader

Parameters:
    p : Parser<'A, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<ImmutableArray<'A>, 'T, 'State>

Applies the parser `p` one or more times. If it succeeds, returns the results as an ImmutableArray. If `p` fails on the first attempt, this parser fails.

p : Parser<'A, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<ImmutableArray<'A>, 'T, 'State>

many1Items2 p1 p reader

Full Usage: many1Items2 p1 p reader

Parameters:
    p1 : Parser<'A, 'T, 'State, 'Input>
    p : Parser<'A, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<ImmutableArray<'A>, 'T, 'State>

Applies the parser `p1` followed by `p` zero or more times. If it succeeds, returns the results as an ImmutableArray. If `p1` fails, this parser fails.

p1 : Parser<'A, 'T, 'State, 'Input>
p : Parser<'A, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<ImmutableArray<'A>, 'T, 'State>

many1Till p pEnd reader

Full Usage: many1Till p pEnd reader

Parameters:
    p : Parser<'A, 'T, 'State, 'Input>
    pEnd : Parser<'B, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<(ImmutableArray<'A> * 'B), 'T, 'State>

Applies the parser `p` one or more times, until `pEnd` succeeds. If it succeeds, returns the results as an ImmutableArray and the result of `pEnd`. If `p` fails on the first attempt, this parser fails. This parser also fails if `pEnd` fails.

p : Parser<'A, 'T, 'State, 'Input>
pEnd : Parser<'B, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<(ImmutableArray<'A> * 'B), 'T, 'State>

manyTill p pEnd reader

Full Usage: manyTill p pEnd reader

Parameters:
    p : Parser<'A, 'T, 'State, 'Input>
    pEnd : Parser<'B, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<(ImmutableArray<'A> * 'B), 'T, 'State>

Applies the parser `p` zero or more times, until `pEnd` succeeds. If it succeeds, returns the results as an ImmutableArray and the result of `pEnd`. This parser fails if `pEnd` fails.

p : Parser<'A, 'T, 'State, 'Input>
pEnd : Parser<'B, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<(ImmutableArray<'A> * 'B), 'T, 'State>

notEmpty p1 reader

Full Usage: notEmpty p1 reader

Parameters:
    p1 : Parser<'A, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<'A, 'T, 'State>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input

Applies the parser `p1`, if it succeeds, ensures that the parser has changed the input position.

p1 : Parser<'A, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<'A, 'T, 'State>

notFollowedBy p1 reader

Full Usage: notFollowedBy p1 reader

Parameters:
    p1 : Parser<'A, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<unit, 'T, 'State>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input

Applies the parser `p1`, if it succeeds, this parser fails without consuming input. If `p1` fails without consuming input, the parser succeeds. If `p1` fails and consumes input, this parser fails without consuming input.

p1 : Parser<'A, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<unit, 'T, 'State>

notFollowedByL p1 message reader

Full Usage: notFollowedByL p1 message reader

Parameters:
    p1 : Parser<'A, 'T, 'State, 'Input>
    message : string
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<unit, 'T, 'State>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input

Applies the parser `p1`, if it succeeds, this parser fails without consuming input, with the given `message`. If `p1` fails without consuming input, the parser succeeds. If `p1` fails and consumes input, this parser fails without consuming input, with the given `message`.

p1 : Parser<'A, 'T, 'State, 'Input>
message : string
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<unit, 'T, 'State>

opt p1 reader

Full Usage: opt p1 reader

Parameters:
    p1 : Parser<'A, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<'A voption, 'T, 'State>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input

Applies the parser `p1` and, if it fails, returns `ValueNone`. If `p1` succeeds, the input is consumed. If `p1` fails, no input is consumed.

p1 : Parser<'A, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<'A voption, 'T, 'State>

optional p1 reader

Full Usage: optional p1 reader

Parameters:
    p1 : Parser<'A, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<unit, 'T, 'State>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input

Attempts to apply the parser `p1`. Always succeeds, returning `()`. If `p1` succeeds, the input is consumed. If `p1` fails, no input is consumed.

p1 : Parser<'A, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<unit, 'T, 'State>

parray n p reader

Full Usage: parray n p reader

Parameters:
    n : int
    p : Parser<'A, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<ImmutableArray<'A>, 'T, 'State>

Applies the parser p exactly n times. If every application succeeds, returns the results as an ImmutableArray of length n. Stops and propagates the inner error on the first failure.

Builds via SmallArrayBuilder{T}, so counts ≤ 4 avoid allocating an ImmutableArray.Builder. Use skipArray when you only need the side effect.

n : int
p : Parser<'A, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<ImmutableArray<'A>, 'T, 'State>

parser

Full Usage: parser

Returns: ParserCE

A computation expression builder for parsers.

Returns: ParserCE

pipe2 p1 p2 f reader

Full Usage: pipe2 p1 p2 f reader

Parameters:
    p1 : Parser<'A, 'T, 'State, 'Input>
    p2 : Parser<'B, 'T, 'State, 'Input>
    f : 'A -> 'B -> 'C
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<'C, 'T, 'State>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input, 'B, 'C

Applies the parsers `p1` and `p2` in sequence. If both succeed, returns the result of `f` applied to the results of `p1` and `p2`.

p1 : Parser<'A, 'T, 'State, 'Input>
p2 : Parser<'B, 'T, 'State, 'Input>
f : 'A -> 'B -> 'C
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<'C, 'T, 'State>

pipe3 p1 p2 p3 f reader

Full Usage: pipe3 p1 p2 p3 f reader

Parameters:
    p1 : Parser<'A, 'T, 'State, 'Input>
    p2 : Parser<'B, 'T, 'State, 'Input>
    p3 : Parser<'C, 'T, 'State, 'Input>
    f : 'A -> 'B -> 'C -> 'D
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<'D, 'T, 'State>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input, 'B, 'C, 'D

Applies the 3 parsers in sequence. If both succeed, returns the result of `f` applied to the results of the parsers.

p1 : Parser<'A, 'T, 'State, 'Input>
p2 : Parser<'B, 'T, 'State, 'Input>
p3 : Parser<'C, 'T, 'State, 'Input>
f : 'A -> 'B -> 'C -> 'D
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<'D, 'T, 'State>

pipe4 p1 p2 p3 p4 f

Full Usage: pipe4 p1 p2 p3 p4 f

Parameters:
    p1 : Parser<'A, 'T, 'State, 'Input>
    p2 : Parser<'B, 'T, 'State, 'Input>
    p3 : Parser<'C, 'T, 'State, 'Input>
    p4 : Parser<'D, 'T, 'State, 'Input>
    f : 'A -> 'B -> 'C -> 'D -> 'E

Returns: Reader<'T, 'State, 'Input> -> ParseResult<'E, 'T, 'State>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input, 'B, 'C, 'D, 'E

Applies the 4 parsers in sequence. If all succeed, returns the result of `f` applied to the results of the parsers.

p1 : Parser<'A, 'T, 'State, 'Input>
p2 : Parser<'B, 'T, 'State, 'Input>
p3 : Parser<'C, 'T, 'State, 'Input>
p4 : Parser<'D, 'T, 'State, 'Input>
f : 'A -> 'B -> 'C -> 'D -> 'E
Returns: Reader<'T, 'State, 'Input> -> ParseResult<'E, 'T, 'State>

pipe5 p1 p2 p3 p4 p5 f

Full Usage: pipe5 p1 p2 p3 p4 p5 f

Parameters:
    p1 : Parser<'A, 'T, 'State, 'Input>
    p2 : Parser<'B, 'T, 'State, 'Input>
    p3 : Parser<'C, 'T, 'State, 'Input>
    p4 : Parser<'D, 'T, 'State, 'Input>
    p5 : Parser<'E, 'T, 'State, 'Input>
    f : 'A -> 'B -> 'C -> 'D -> 'E -> 'F

Returns: Reader<'T, 'State, 'Input> -> ParseResult<'F, 'T, 'State>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input, 'B, 'C, 'D, 'E, 'F

Applies the 5 parsers in sequence. If all succeed, returns the result of `f` applied to the results of the parsers.

p1 : Parser<'A, 'T, 'State, 'Input>
p2 : Parser<'B, 'T, 'State, 'Input>
p3 : Parser<'C, 'T, 'State, 'Input>
p4 : Parser<'D, 'T, 'State, 'Input>
p5 : Parser<'E, 'T, 'State, 'Input>
f : 'A -> 'B -> 'C -> 'D -> 'E -> 'F
Returns: Reader<'T, 'State, 'Input> -> ParseResult<'F, 'T, 'State>

sepBy p pSep reader

Full Usage: sepBy p pSep reader

Parameters:
    p : Parser<'A, 'T, 'State, 'Input>
    pSep : Parser<'B, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<(ImmutableArray<'A> * ImmutableArray<'B>), 'T, 'State>

Applies the parser `p` zero or more times, separated by `pSep`. If it succeeds, returns the results as an ImmutableArray. This parser always succeeds.

p : Parser<'A, 'T, 'State, 'Input>
pSep : Parser<'B, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<(ImmutableArray<'A> * ImmutableArray<'B>), 'T, 'State>

sepBy1 p pSep reader

Full Usage: sepBy1 p pSep reader

Parameters:
    p : Parser<'A, 'T, 'State, 'Input>
    pSep : Parser<'B, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<(ImmutableArray<'A> * ImmutableArray<'B>), 'T, 'State>

Applies the parser `p` one or more times, separated by `pSep`. If it succeeds, returns the results as an ImmutableArray. If `p` fails on the first attempt, this parser fails.

p : Parser<'A, 'T, 'State, 'Input>
pSep : Parser<'B, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<(ImmutableArray<'A> * ImmutableArray<'B>), 'T, 'State>

sepEndBy p pSep reader

Full Usage: sepEndBy p pSep reader

Parameters:
    p : Parser<'A, 'T, 'State, 'Input>
    pSep : Parser<'B, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<(ImmutableArray<'A> * ImmutableArray<'B>), 'T, 'State>

Applies the parser `p` zero or more times, separated and optionally ended by `pSep`. If it succeeds, returns the results as an ImmutableArray. This parser always succeeds.

p : Parser<'A, 'T, 'State, 'Input>
pSep : Parser<'B, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<(ImmutableArray<'A> * ImmutableArray<'B>), 'T, 'State>

sepEndBy1 p pSep reader

Full Usage: sepEndBy1 p pSep reader

Parameters:
    p : Parser<'A, 'T, 'State, 'Input>
    pSep : Parser<'B, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<(ImmutableArray<'A> * ImmutableArray<'B>), 'T, 'State>

Applies the parser `p` one or more times, separated and optionally ended by `pSep`. If it succeeds, returns the results as an ImmutableArray. If `p` fails on the first attempt, this parser fails.

p : Parser<'A, 'T, 'State, 'Input>
pSep : Parser<'B, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<(ImmutableArray<'A> * ImmutableArray<'B>), 'T, 'State>

skipArray n p reader

Full Usage: skipArray n p reader

Parameters:
    n : int
    p : Parser<'A, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<unit, 'T, 'State>

Applies the parser p exactly n times, discarding the results. Returns unit on full success, or propagates the inner error on the first failure.

Equivalent to parray n p |>> ignore but without allocating the intermediate result array. Use this when you only need to advance the reader.

n : int
p : Parser<'A, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<unit, 'T, 'State>

skipMany p reader

Full Usage: skipMany p reader

Parameters:
    p : Parser<'A, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<unit, 'T, 'State>

Applies the parser `p` zero or more times. If it succeeds, returns unit. This parser always succeeds.

p : Parser<'A, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<unit, 'T, 'State>

skipMany1 p reader

Full Usage: skipMany1 p reader

Parameters:
    p : Parser<'A, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<unit, 'T, 'State>

Applies the parser `p` one or more times. If it succeeds, returns unit. If `p` fails on the first attempt, this parser fails.

p : Parser<'A, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<unit, 'T, 'State>

skipMany1Satisfies predicate reader

Full Usage: skipMany1Satisfies predicate reader

Parameters:
    predicate : 'a -> bool
    reader : Reader<'a, 'b, 'c>

Returns: ParseResult<unit, 'a, 'b>

Skips one or more input elements that satisfy the given predicate.

If the predicate fails on the first element, this parser fails.

predicate : 'a -> bool
reader : Reader<'a, 'b, 'c>
Returns: ParseResult<unit, 'a, 'b>

skipMany1Till p pEnd reader

Full Usage: skipMany1Till p pEnd reader

Parameters:
    p : Parser<'A, 'T, 'State, 'Input>
    pEnd : Parser<'B, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<unit, 'T, 'State>

Applies the parser `p` one or more times, until `pEnd` succeeds. If it succeeds, returns unit. If `p` fails on the first attempt, this parser fails. This parser also fails if `pEnd` fails.

p : Parser<'A, 'T, 'State, 'Input>
pEnd : Parser<'B, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<unit, 'T, 'State>

skipManySatisfies predicate reader

Full Usage: skipManySatisfies predicate reader

Parameters:
    predicate : 'a -> bool
    reader : Reader<'a, 'b, 'c>

Returns: ParseResult<unit, 'a, 'b>

Skips zero or more input elements that satisfy the given predicate.

This parser always succeeds. It is a highly efficient way to skip input like whitespace or comments.

predicate : 'a -> bool
reader : Reader<'a, 'b, 'c>
Returns: ParseResult<unit, 'a, 'b>

skipManyTill p pEnd reader

Full Usage: skipManyTill p pEnd reader

Parameters:
    p : Parser<'A, 'T, 'State, 'Input>
    pEnd : Parser<'B, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<unit, 'T, 'State>

Applies the parser `p` zero or more times, until `pEnd` succeeds. If it succeeds, returns unit. This parser fails if `pEnd` fails.

p : Parser<'A, 'T, 'State, 'Input>
pEnd : Parser<'B, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<unit, 'T, 'State>

skipSepBy p pSep reader

Full Usage: skipSepBy p pSep reader

Parameters:
    p : Parser<'A, 'T, 'State, 'Input>
    pSep : Parser<'B, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<unit, 'T, 'State>

Applies the parser `p` zero or more times, separated by `pSep`. If it succeeds, returns unit. This parser always succeeds.

p : Parser<'A, 'T, 'State, 'Input>
pSep : Parser<'B, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<unit, 'T, 'State>

skipSepBy1 p pSep reader

Full Usage: skipSepBy1 p pSep reader

Parameters:
    p : Parser<'A, 'T, 'State, 'Input>
    pSep : Parser<'B, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<unit, 'T, 'State>

Applies the parser `p` one or more times, separated by `pSep`. If it succeeds, returns unit. If `p` fails on the first attempt, this parser fails.

p : Parser<'A, 'T, 'State, 'Input>
pSep : Parser<'B, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<unit, 'T, 'State>

skipSepEndBy p pSep reader

Full Usage: skipSepEndBy p pSep reader

Parameters:
    p : Parser<'A, 'T, 'State, 'Input>
    pSep : Parser<'B, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<unit, 'T, 'State>

Applies the parser `p` zero or more times, separated and optionally ended by `pSep`. If it succeeds, returns unit. This parser always succeeds.

p : Parser<'A, 'T, 'State, 'Input>
pSep : Parser<'B, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<unit, 'T, 'State>

skipSepEndBy1 p pSep reader

Full Usage: skipSepEndBy1 p pSep reader

Parameters:
    p : Parser<'A, 'T, 'State, 'Input>
    pSep : Parser<'B, 'T, 'State, 'Input>
    reader : Reader<'T, 'State, 'Input>

Returns: ParseResult<unit, 'T, 'State>

Applies the parser `p` one or more times, separated and optionally ended by `pSep`. If it succeeds, returns unit. If `p` fails on the first attempt, this parser fails.

p : Parser<'A, 'T, 'State, 'Input>
pSep : Parser<'B, 'T, 'State, 'Input>
reader : Reader<'T, 'State, 'Input>
Returns: ParseResult<unit, 'T, 'State>

tuple2 p1 p2

Full Usage: tuple2 p1 p2

Parameters:
    p1 : Parser<'A, 'T, 'State, 'Input>
    p2 : Parser<'B, 'T, 'State, 'Input>

Returns: Reader<'T, 'State, 'Input> -> ParseResult<('A * 'B), 'T, 'State>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input, 'B

Applies the parsers `p1` and `p2` in sequence. If both succeed, returns the results in a tuple.

p1 : Parser<'A, 'T, 'State, 'Input>
p2 : Parser<'B, 'T, 'State, 'Input>
Returns: Reader<'T, 'State, 'Input> -> ParseResult<('A * 'B), 'T, 'State>

tuple3 p1 p2 p3

Full Usage: tuple3 p1 p2 p3

Parameters:
    p1 : Parser<'A, 'T, 'State, 'Input>
    p2 : Parser<'B, 'T, 'State, 'Input>
    p3 : Parser<'C, 'T, 'State, 'Input>

Returns: Reader<'T, 'State, 'Input> -> ParseResult<('A * 'B * 'C), 'T, 'State>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input, 'B, 'C

Applies the parsers `p1`, `p2` and `p3` in sequence. If all succeed, returns the results in a tuple.

p1 : Parser<'A, 'T, 'State, 'Input>
p2 : Parser<'B, 'T, 'State, 'Input>
p3 : Parser<'C, 'T, 'State, 'Input>
Returns: Reader<'T, 'State, 'Input> -> ParseResult<('A * 'B * 'C), 'T, 'State>

tuple4 p1 p2 p3 p4

Full Usage: tuple4 p1 p2 p3 p4

Parameters:
    p1 : Parser<'A, 'T, 'State, 'Input>
    p2 : Parser<'B, 'T, 'State, 'Input>
    p3 : Parser<'C, 'T, 'State, 'Input>
    p4 : Parser<'D, 'T, 'State, 'Input>

Returns: Reader<'T, 'State, 'Input> -> ParseResult<('A * 'B * 'C * 'D), 'T, 'State>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input, 'B, 'C, 'D

Applies the parsers `p1`, `p2`, `p3` and `p4` in sequence. If all succeed, returns the results in a tuple.

p1 : Parser<'A, 'T, 'State, 'Input>
p2 : Parser<'B, 'T, 'State, 'Input>
p3 : Parser<'C, 'T, 'State, 'Input>
p4 : Parser<'D, 'T, 'State, 'Input>
Returns: Reader<'T, 'State, 'Input> -> ParseResult<('A * 'B * 'C * 'D), 'T, 'State>

tuple5 p1 p2 p3 p4 p5

Full Usage: tuple5 p1 p2 p3 p4 p5

Parameters:
    p1 : Parser<'A, 'T, 'State, 'Input>
    p2 : Parser<'B, 'T, 'State, 'Input>
    p3 : Parser<'C, 'T, 'State, 'Input>
    p4 : Parser<'D, 'T, 'State, 'Input>
    p5 : Parser<'E, 'T, 'State, 'Input>

Returns: Reader<'T, 'State, 'Input> -> ParseResult<('A * 'B * 'C * 'D * 'E), 'T, 'State>
Modifiers: inline
Type parameters: 'A, 'T, 'State, 'Input, 'B, 'C, 'D, 'E

Applies the parsers `p1`, `p2`, `p3`, `p4` and `p5` in sequence. If all succeed, returns the results in a tuple.

p1 : Parser<'A, 'T, 'State, 'Input>
p2 : Parser<'B, 'T, 'State, 'Input>
p3 : Parser<'C, 'T, 'State, 'Input>
p4 : Parser<'D, 'T, 'State, 'Input>
p5 : Parser<'E, 'T, 'State, 'Input>
Returns: Reader<'T, 'State, 'Input> -> ParseResult<('A * 'B * 'C * 'D * 'E), 'T, 'State>

Type something to start searching.