public class ErrorReportingParseRunner<V> extends AbstractParseRunner<V> implements MatchHandler
ParseRunner
implementation that creates an
InvalidInputError
for the error at a known error location.
It never causes the parser to perform more than one parsing run and is rarely used directly.
Instead its functionality is relied upon by the ReportingParseRunner
and RecoveringParseRunner
classes.Modifier and Type | Field and Description |
---|---|
private int |
errorIndex |
private java.util.List<MatcherPath> |
failedMatchers |
private MatchHandler |
inner |
private IsSingleCharMatcherVisitor |
isSingleCharMatcherVisitor |
private boolean |
seeking |
Constructor and Description |
---|
ErrorReportingParseRunner(Rule rule,
int errorIndex)
Creates a new ErrorReportingParseRunner instance for the given rule and the given errorIndex.
|
ErrorReportingParseRunner(Rule rule,
int errorIndex,
MatchHandler inner)
Creates a new ErrorReportingParseRunner instance for the given rule and the given errorIndex.
|
Modifier and Type | Method and Description |
---|---|
boolean |
match(MatcherContext<?> context)
Runs the given MatcherContext.
|
ParsingResult<V> |
run(InputBuffer inputBuffer)
Performs the actual parse and creates a corresponding ParsingResult instance.
|
createParsingResult, createRootContext, getParseErrors, getRootMatcher, getValueStack, resetValueStack, run, run, withParseErrors, withValueStack
private final IsSingleCharMatcherVisitor isSingleCharMatcherVisitor
private final int errorIndex
private final MatchHandler inner
private final java.util.List<MatcherPath> failedMatchers
private boolean seeking
public ErrorReportingParseRunner(Rule rule, int errorIndex)
rule
- the parser ruleerrorIndex
- the index of the error to reportpublic ErrorReportingParseRunner(Rule rule, int errorIndex, MatchHandler inner)
rule
- the parser ruleerrorIndex
- the index of the error to reportinner
- another MatchHandler to delegate the actual match handling to, can be nullpublic ParsingResult<V> run(InputBuffer inputBuffer)
ParseRunner
run
in interface ParseRunner<V>
inputBuffer
- the inputBuffer to usepublic boolean match(MatcherContext<?> context)
MatchHandler
match
in interface MatchHandler
context
- the MatcherContext