Header menu logo XParsec

Parsers Module

Nested modules

Modules Description

Internal

Contains generalized parser implementations, not intended to be used directly.

Functions and values

Function or value Description

anyInRange xMin xMax reader

Full Usage: anyInRange xMin xMax reader

Parameters:
    xMin : 'T
    xMax : 'T
    reader : Reader<'T, 'State, 'Input, 'InputSlice>

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

Succeeds if the next item in the input is in the given range (inclusive), and consumes one item. Returns the item, otherwise fails with the Unexpected item.

xMin : 'T
xMax : 'T
reader : Reader<'T, 'State, 'Input, 'InputSlice>
Returns: ParseResult<'T, 'T, 'State>

anyOf xs

Full Usage: anyOf xs

Parameters:
    xs : 'T seq

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

Succeeds if the next item in the input is equal to any of the given items, and consumes one item. Returns the item, otherwise fails with the Unexpected item.

xs : 'T seq
Returns: Reader<'T, 'a, 'b, 'c> -> ParseResult<'T, 'T, 'a>

eof reader

Full Usage: eof reader

Parameters:
    reader : Reader<'T, 'State, 'Input, 'InputSlice>

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

Succeeds if the Reader position is at the end of the input. This parser does not consume any input.

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

fail x reader

Full Usage: fail x reader

Parameters:
    x : ErrorType<'T, 'State>
    reader : Reader<'T, 'State, 'Input, 'InputSlice>

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

Always fails with the given error. This parser does not consume any input.

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

getPosition reader

Full Usage: getPosition reader

Parameters:
    reader : Reader<'T, 'State, 'Input, 'InputSlice>

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

Return the current Reader position. This parser does not consume any input.

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

getUserState reader

Full Usage: getUserState reader

Parameters:
    reader : Reader<'T, 'State, 'Input, 'InputSlice>

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

Return the current user state. This parser does not consume any input.

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

itemReturn x result reader

Full Usage: itemReturn x result reader

Parameters:
    x : 'T
    result : 'a
    reader : Reader<'T, 'State, 'Input, 'InputSlice>

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

Succeeds if the next item in the input is equal to the given item, and consumes one item. Returns the item if it is equal to the given item, otherwise fails with the Expected item.

x : 'T
result : 'a
reader : Reader<'T, 'State, 'Input, 'InputSlice>
Returns: ParseResult<'a, 'T, 'State>

noneOf xs

Full Usage: noneOf xs

Parameters:
    xs : 'T seq

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

Succeeds if the next item in the input is equal to none of the given items, and consumes one item. Returns the item, otherwise fails with the Unexpected item.

xs : 'T seq
Returns: Reader<'T, 'a, 'b, 'c> -> ParseResult<'T, 'T, 'a>

pid reader

Full Usage: pid reader

Parameters:
    reader : Reader<'T, 'State, 'Input, 'InputSlice>

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

Succeeds if the Reader position is not at the end of the input, and consumes one item.

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

pitem x reader

Full Usage: pitem x reader

Parameters:
    x : 'T
    reader : Reader<'T, 'State, 'Input, 'InputSlice>

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

Succeeds if the next item in the input is equal to the given item, and consumes one item. Returns the item, otherwise fails with the Expected item.

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

preturn x reader

Full Usage: preturn x reader

Parameters:
    x : 'Parsed
    reader : Reader<'T, 'State, 'Input, 'InputSlice>

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

Always succeeds and returns the given value. This parser does not consume any input.

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

pseq xs

Full Usage: pseq xs

Parameters:
    xs : 'a

Returns: Reader<'T, 'b, 'c, 'd> -> ParseResult<'a, 'T, 'b>

Succeeds if the next items in the input are equal to the given items, and consumes them. Returns the items, otherwise fails with the Expected items.

xs : 'a
Returns: Reader<'T, 'b, 'c, 'd> -> ParseResult<'a, 'T, 'b>

pseqReturn xs result

Full Usage: pseqReturn xs result

Parameters:
    xs : 'a
    result : 'b

Returns: Reader<'T, 'c, 'd, 'e> -> ParseResult<'b, 'T, 'c>

Succeeds if the next items in the input are equal to the given items, and consumes them. Returns the result, otherwise fails with the Expected items.

xs : 'a
result : 'b
Returns: Reader<'T, 'c, 'd, 'e> -> ParseResult<'b, 'T, 'c>

pzero reader

Full Usage: pzero reader

Parameters:
    reader : Reader<'T, 'State, 'Input, 'InputSlice>

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

Always fails with the zero error. This parser does not consume any input.

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

satisfy f reader

Full Usage: satisfy f reader

Parameters:
    f : 'T -> bool
    reader : Reader<'T, 'State, 'Input, 'InputSlice>

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

Succeeds if the predicate is satisfied by the next item in the input, and consumes one item. Returns the item if the predicate is satisfied, otherwise fails with the Unexpected item.

f : 'T -> bool
reader : Reader<'T, 'State, 'Input, 'InputSlice>
Returns: ParseResult<'T, 'T, 'State>

satisfyL f msg reader

Full Usage: satisfyL f msg reader

Parameters:
    f : 'T -> bool
    msg : string
    reader : Reader<'T, 'State, 'Input, 'InputSlice>

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

Succeeds if the predicate is satisfied by the next item in the input, and consumes one item. Returns the item if the predicate is satisfied, otherwise fails with the given message.

f : 'T -> bool
msg : string
reader : Reader<'T, 'State, 'Input, 'InputSlice>
Returns: ParseResult<'T, 'T, 'State>

setPosition position reader

Full Usage: setPosition position reader

Parameters:
    position : Position<'State>
    reader : Reader<'T, 'State, 'Input, 'InputSlice>

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

Set the Reader position to the given value. An exception is thrown if the ReaderId is inconsistent with the Reader.

position : Position<'State>
reader : Reader<'T, 'State, 'Input, 'InputSlice>
Returns: ParseResult<unit, 'T, 'State>

setUserState state reader

Full Usage: setUserState state reader

Parameters:
    state : 'State
    reader : Reader<'T, 'State, 'Input, 'InputSlice>

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

Set the user state to the given value. This parser does not consume any input.

state : 'State
reader : Reader<'T, 'State, 'Input, 'InputSlice>
Returns: ParseResult<unit, 'T, 'State>

skipAnyInRange xMin xMax reader

Full Usage: skipAnyInRange xMin xMax reader

Parameters:
    xMin : 'T
    xMax : 'T
    reader : Reader<'T, 'State, 'Input, 'InputSlice>

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

Succeeds if the next item in the input is in the given range (inclusive), and consumes one item. Returns unit, otherwise fails with the Unexpected item.

xMin : 'T
xMax : 'T
reader : Reader<'T, 'State, 'Input, 'InputSlice>
Returns: ParseResult<unit, 'T, 'State>

skipAnyOf xs

Full Usage: skipAnyOf xs

Parameters:
    xs : 'T seq

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

Succeeds if the next item in the input is equal to any of the given items, and consumes one item. Returns unit, otherwise fails with the Unexpected item.

xs : 'T seq
Returns: Reader<'T, 'a, 'b, 'c> -> ParseResult<unit, 'T, 'a>

skipItem x reader

Full Usage: skipItem x reader

Parameters:
    x : 'T
    reader : Reader<'T, 'State, 'Input, 'InputSlice>

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

Succeeds if the next item in the input is equal to the given item, and consumes one item. Returns unit, otherwise fails with the Expected item.

x : 'T
reader : Reader<'T, 'State, 'Input, 'InputSlice>
Returns: ParseResult<unit, 'T, 'State>

skipNoneOf xs

Full Usage: skipNoneOf xs

Parameters:
    xs : 'T seq

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

Succeeds if the next item in the input is equal to none of the given items, and consumes one item. Returns unit, otherwise fails with the Unexpected item.

xs : 'T seq
Returns: Reader<'T, 'a, 'b, 'c> -> ParseResult<unit, 'T, 'a>

updateUserState mapper reader

Full Usage: updateUserState mapper reader

Parameters:
    mapper : 'State -> 'State
    reader : Reader<'T, 'State, 'Input, 'InputSlice>

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

Update the user state using the given function. This parser does not consume any input.

mapper : 'State -> 'State
reader : Reader<'T, 'State, 'Input, 'InputSlice>
Returns: ParseResult<unit, 'T, 'State>

userStateSatisfies predicate reader

Full Usage: userStateSatisfies predicate reader

Parameters:
    predicate : 'State -> bool
    reader : Reader<'T, 'State, 'Input, 'InputSlice>

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

Succeeds if the user state satisfies the given predicate. This parser does not consume any input.

predicate : 'State -> bool
reader : Reader<'T, 'State, 'Input, 'InputSlice>
Returns: ParseResult<unit, 'T, 'State>

Type something to start searching.