The failure case of Parsed
containing an error message and the remaining input.
Represents a lazy failure message.
Represents a lazy failure message.
Implementations can use the specified ParserContext
to construct
the actual message, e.g. for adding parts of the input to the message.
Represents the result of a Parser
, a value of type T
in case of success,
a message in case of failure as well as the ParserContext
for the remaining
input.
The abstract base for all parser implementations.
The abstract base for all parser implementations.
Contains the main parse
function as well as various
combinator function to create a new parser based on this one.
Represents the state and context of a parsing operation, containing the input string as well as positional information/
Represents an offset into a source string.
Represents an offset into a source string. Its main purpose is error reporting, e.g. printing a visual representation of the line containing the error.
the source for this position
the offset into the source string
Represents the input string for a parsing operation.
The success case of Parsed
containing the result and the remaining input.
Message companion providing several pre-built messages and factory methods.
Companion factory for creating new parser instances.
Companion for creating new ParserContext
instances.
The failure case of
Parsed
containing an error message and the remaining input.Implementation note: The message property is of type
Message
, to allow for lazy message creation. The former SDK parser combinators which this API is partially inspired by contained a lot of unnecessary string concatenations for messages which were then never read. This implementation avoids this extra cost and the result is measurable (about 15% performance gain for a typical Markdown document for example).A provider that produces an error message for this failure based on its ParserContext
The parser's unconsumed input at the point where the failure occurred.