Skip to content

run

run(p: Parser, input: Input): *

Executes a parser against input text.

This is a convenience variation of parse. Like parse, it can accept strings, ArrayBuffers, DataViews, and typed arrays as input.

If p succeeds, its result is returned directly from run, rather than returning a Reply object or a Result(../types/result.md) from which it has to be extraced. If the parse fails, run will throw an error with the message generated by Kessel's error system.

Parameters

  • p: The parser to execute.
  • input: The text to execute p against.

Returns

  • Returns the parsed result.

Throws

  • Throws an error if any parser within p throws an error.
  • Throws an error if p fails, containing the full error message detailing that failure.

See Also