Version: 0.3.1

primitives

satisfy

A parser that satisfies a predicate. Useful as a building block for writing things like char(), digit()...

function satisfy(callable $predicate) : Parser

skipWhile

Skip 0 or more characters as long as the predicate holds.

function skipWhile(callable $predicate) : Parser

skipWhile1

Skip 1 or more characters as long as the predicate holds.

function skipWhile1(callable $predicate) : Parser

takeWhile

Keep parsing 0 or more characters as long as the predicate holds.

function takeWhile(callable $predicate) : Parser

takeWhile1

Keep parsing 1 or more characters as long as the predicate holds.

function takeWhile1(callable $predicate) : Parser

anySingle

Parse and return a single character of anything.

function anySingle() : Parser

anything

Parse and return a single character of anything.

function anything() : Parser

anySingleBut

Match any character but the given one.

function anySingleBut(string $x) : Parser

oneOf

Succeeds if the current character is in the supplied list of characters. Returns the parsed character.

function oneOf(array $chars) : Parser

oneOfS

A compact form of 'oneOf'. oneOfS("abc") == oneOf(['a', 'b', 'c'])

function oneOfS(string $chars) : Parser

noneOf

The dual of 'oneOf'. Succeeds if the current character is not in the supplied list of characters. Returns the parsed character.

function noneOf(array $chars) : Parser

noneOfS

A compact form of 'noneOf'. noneOfS("abc") == noneOf(['a', 'b', 'c'])

function noneOfS(string $chars) : Parser

takeRest

Consume the rest of the input and return it as a string. This parser never fails, but may return the empty string.

function takeRest() : Parser

nothing

Parse nothing, but still succeed.

This serves as the zero parser in append() operations.

function nothing() : Parser

everything

Parse everything; that is, consume the rest of the input until the end.

function everything() : Parser

success

Always succeed, no matter what the input was.

function success() : Parser

failure

Always fail, no matter what the input was.

function failure() : Parser

eof

Parse the end of the input

function eof() : Parser