Documentation

ParseResult

Tags
template
psalm-immutable

Table of Contents

Methods

append()  : ParseResult
Append the output of two successful ParseResults. If one or both have failed, it returns the first failed ParseResult.
continueWith()  : ParseResult
Use the remainder of this ParseResult as the input for a parser.
errorMessage()  : string
expected()  : string
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.
got()  : Stream
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.
isFail()  : bool
True if the parser has failed.
isSuccess()  : bool
True if the parser was successful.
map()  : ParseResult
Map a function over the output
output()  : mixed
The output of the parser.
position()  : Position
Get the last position of where the parser ended up when producing this result.
remainder()  : Stream
The part of the input that did not get parsed.
throw()  : void
Throw a ParserFailure exception if the Parser failed, or complain if you're trying to throw a successful ParseResult.

Methods

append()

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

public append(ParseResult $other) : ParseResult
APIYes
Parameters
$other : ParseResult
Tags
psalm-param

ParseResult<T> $other

psalm-return

ParseResult<T>

psalm-mutation-free
Return values
ParseResult

continueWith()

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

public continueWith(Parser $parser) : ParseResult
APIYes
Parameters
$parser : Parser
Tags
template
psalm-param

Parser<T2> $parser

psalm-return

ParseResult<T2>

psalm-mutation-free
Return values
ParseResult

errorMessage()

public errorMessage() : string
Tags
psalm-mutation-free
Return values
string

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 expected() : string
APIYes
Tags
see
Parser::label()
psalm-mutation-free
Return values
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 got() : Stream
APIYes
Tags
psalm-mutation-free
Return values
Stream

isFail()

True if the parser has failed.

public isFail() : bool
APIYes
Tags
psalm-mutation-free
Return values
bool

isSuccess()

True if the parser was successful.

public isSuccess() : bool
APIYes
Tags
psalm-mutation-free
Return values
bool

map()

Map a function over the output

public map(callable $transform) : ParseResult
APIYes
Parameters
$transform : callable
Tags
template
psalm-param

pure-callable(T):T2 $transform

psalm-return

ParseResult<T2>

psalm-mutation-free
Return values
ParseResult

output()

The output of the parser.

public output() : mixed
APIYes
Tags
psalm-return

T

psalm-mutation-free

position()

Get the last position of where the parser ended up when producing this result.

public position() : Position
Tags
psalm-mutation-free
Return values
Position

remainder()

The part of the input that did not get parsed.

public remainder() : Stream
APIYes
Tags
psalm-mutation-free
Return values
Stream

throw()

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

public throw() : void
APIYes
Tags
throws
ParserHasFailed
throws
BadMethodCallException

        
On this page

Search results