Version: next

primitives

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

succeed

Always succeed, no matter what the input was.

function succeed() : Parser

fail

Always fail, no matter what the input was.

function fail(string $label) : Parser

eof

Parse the end of the input

function eof() : Parser