Version: 0.8.0

ParseResult

isSuccess

True if the parser was successful.

public function isSuccess() : bool

isFail

True if the parser has failed.

public function isFail() : bool

output

The output of the parser.

public function output()

remainder

The part of the input that did not get parsed.

public function remainder() : Stream

expected

A message that indicates what the failed parser expected to find at its position in the input. It contains the label that was attached to the parser.

public function expected() : string

got

A message indicating the input that the failed parser got at the point where it failed. It's only informational, so don't use this for processing. A future version might change this behaviour.

public function got() : Stream

append

Append the output of two successful ParseResults. If one or both have failed, it returns the first failed ParseResult.

public function append(ParseResult $other) : ParseResult

map

Map a function over the output

public function map(callable $transform) : ParseResult

continueWith

Use the remainder of this ParseResult as the input for a parser.

public function continueWith(Parser $parser) : ParseResult

throw

Throw a ParserFailure exception if the Parser failed, or complain if you're trying to throw a successful ParseResult.

public function throw() : void