org.parboiled.parserunners
Class ReportingParseRunner.Handler

java.lang.Object
  extended by org.parboiled.parserunners.ReportingParseRunner.Handler
All Implemented Interfaces:
MatchHandler
Enclosing class:
ReportingParseRunner<V>

public static class ReportingParseRunner.Handler
extends java.lang.Object
implements MatchHandler

A MatchHandler implementation that reports the InvalidInputError at a given error index. For the actual matching this handler relies on another, inner MatchHandler instance it delegates to.


Constructor Summary
ReportingParseRunner.Handler(int errorIndex)
          Create a new handler that can report the InvalidInputError at the given error index.
ReportingParseRunner.Handler(int errorIndex, MatchHandler inner)
          Create a new handler that can report the InvalidInputError at the given error index.
 
Method Summary
 InvalidInputError getParseError()
          Returns the InvalidInputError instance that was created during the reporting run.
 boolean match(MatcherContext<?> context)
          Runs the given MatcherContext.
 boolean matchRoot(MatcherContext<?> rootContext)
          Runs the root MatcherContext.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReportingParseRunner.Handler

public ReportingParseRunner.Handler(int errorIndex)
Create a new handler that can report the InvalidInputError at the given error index. It relies on a new BasicParseRunner.Handler instance for the actual matching.

Parameters:
errorIndex - the InputLocation of the error to be reported

ReportingParseRunner.Handler

public ReportingParseRunner.Handler(int errorIndex,
                                    MatchHandler inner)
Create a new handler that can report the InvalidInputError at the given error index. It relies on the given MatchHandler instance for the actual matching.

Parameters:
errorIndex - the InputLocation of the error to be reported
inner - the inner MatchHandler to use
Method Detail

getParseError

public InvalidInputError getParseError()
Returns the InvalidInputError instance that was created during the reporting run.

Returns:
the InvalidInputError

matchRoot

public boolean matchRoot(MatcherContext<?> rootContext)
Description copied from interface: MatchHandler
Runs the root MatcherContext.

Specified by:
matchRoot in interface MatchHandler
Parameters:
rootContext - the root MatcherContext.
Returns:
true if matched

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