ParseResult
in
Tags
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
Parameters
- $other : ParseResult
Tags
Return values
ParseResultcontinueWith()
Use the remainder of this ParseResult as the input for a parser.
public
continueWith(Parser $parser) : ParseResult
Parameters
- $parser : Parser
Tags
Return values
ParseResulterrorMessage()
public
errorMessage() : string
Tags
Return values
stringexpected()
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
Tags
Return values
stringgot()
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
Tags
Return values
StreamisFail()
True if the parser has failed.
public
isFail() : bool
Tags
Return values
boolisSuccess()
True if the parser was successful.
public
isSuccess() : bool
Tags
Return values
boolmap()
Map a function over the output
public
map(callable $transform) : ParseResult
Parameters
- $transform : callable
Tags
Return values
ParseResultoutput()
The output of the parser.
public
output() : mixed
Tags
position()
Get the last position of where the parser ended up when producing this result.
public
position() : Position
Tags
Return values
Positionremainder()
The part of the input that did not get parsed.
public
remainder() : Stream
Tags
Return values
Streamthrow()
Throw a ParserFailure exception if the Parser failed, or complain if you're trying to throw a successful ParseResult.
public
throw() : void