org.parboiled.parserunners
Class ErrorReportingParseRunner<V>

java.lang.Object
  extended by org.parboiled.parserunners.AbstractParseRunner<V>
      extended by org.parboiled.parserunners.ErrorReportingParseRunner<V>
All Implemented Interfaces:
MatchHandler, ParseRunner<V>

public class ErrorReportingParseRunner<V>
extends AbstractParseRunner<V>
implements MatchHandler

A 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.


Constructor Summary
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.
 
Method Summary
 boolean match(MatcherContext<?> context)
          Runs the given MatcherContext.
 ParsingResult<V> run(InputBuffer inputBuffer)
          Performs the actual parse and creates a corresponding ParsingResult instance.
 
Methods inherited from class org.parboiled.parserunners.AbstractParseRunner
getParseErrors, getRootMatcher, getValueStack, run, run, withParseErrors, withValueStack
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ErrorReportingParseRunner

public ErrorReportingParseRunner(Rule rule,
                                 int errorIndex)
Creates a new ErrorReportingParseRunner instance for the given rule and the given errorIndex.

Parameters:
rule - the parser rule
errorIndex - the index of the error to report

ErrorReportingParseRunner

public ErrorReportingParseRunner(Rule rule,
                                 int errorIndex,
                                 MatchHandler inner)
Creates a new ErrorReportingParseRunner instance for the given rule and the given errorIndex. The given MatchHandler is used as a delegate for the actual match handling.

Parameters:
rule - the parser rule
errorIndex - the index of the error to report
inner - another MatchHandler to delegate the actual match handling to, can be null
Method Detail

run

public ParsingResult<V> run(InputBuffer inputBuffer)
Description copied from interface: ParseRunner
Performs the actual parse and creates a corresponding ParsingResult instance.

Specified by:
run in interface ParseRunner<V>
Parameters:
inputBuffer - the inputBuffer to use
Returns:
the ParsingResult for the run

match

public boolean match(MatcherContext<?> context)
Description copied from interface: MatchHandler
Runs the given MatcherContext.

Specified by:
match in interface MatchHandler
Parameters:
context - the MatcherContext
Returns:
true if matched