Prepares a failure object for a new failure
Prepares a failure object for a new failure
The failure object, usually retrieved from the ParseCtx to avoid allocation overhead
The index at which this failure occurred
Any parsers which failed at the current index. These
get noted in the error message if traceFailure
is
set. By default, this is the current parser.
Whether or not this failure should prevent backtracking
Prepares a failure object to continue an existing failure, e.
Prepares a failure object to continue an existing failure, e.g. if some sub-parser failed and you want to pass the failure up the stack.
The failure returned by the subparser
The index of the *current* parser
Any parsers which failed at the current index. These
get noted in the error message if traceFailure
is
set. By default, the existing traceParsers
from the
original failure are left unchanged
Whether or not this parser failing should prevent backtracking. ORed with any cuts caused by the existing failure
Whether or not to surround this parser with parentheses when printing.
Whether or not to surround this parser with parentheses when printing.
By default a top-level parser is always left without parentheses, but
if a sub-parser is embedded inside with lower precedence, it will be
surrounded. Set to Integer.MaxValue
to never be parenthesized
Parses the given input
starting from the given index
Parses the given input
starting from the given index
The string we want to parse
The index in the string to start from. By default parsing starts from the beginning of a string, but you can start from halfway through the string if you want.
Allows you to pass in a callback that will get called by every named rule, its index, as it itself given a callback that can be used to recurse into the parse and return the result. Very useful for extracting auxiliary information from the parse, e.g. counting rule invocations to locate bottlenecks or unwanted backtracking in the parser.
Parses the given input
starting from the given index
and logDepth
Whether or not this parser should show up when TracedFailure.trace is called.
Whether or not this parser should show up when TracedFailure.trace is called. If not set, the parser will only show up in TracedFailure.fullStack
Prepares a success object to be returned.
Prepares a success object to be returned.
The existing success object, usually taken from ParseCtx to avoid allocation overhead.
The value that this parser succeeded with
The index of the parser *after* having successfully parsed part of the input
Any parsers which failed at the current index in the creation of this success. Even though this parser succeeded, failures inside sub-parsers must be reported to ensure proper error reporting.
Whether the parse crossed a cut and should prevent backtracking
Captures the string parsed by the given parser p.