org.parboiled.parserunners
Class RecoveringParseRunner.Handler

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

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

A MatchHandler implementation that recognizes the special Chars.RESYNC character to overcome InvalidInputErrors at the respective error indices.


Constructor Summary
RecoveringParseRunner.Handler(InvalidInputError currentError)
          Creates a new Handler.
 
Method Summary
protected  int gobbleIllegalCharacters(MatcherContext context, java.util.List<Matcher> followMatchers)
           
 boolean match(MatcherContext<?> context)
          Runs the given MatcherContext.
 boolean matchRoot(MatcherContext<?> rootContext)
          Runs the root MatcherContext.
protected  boolean prepareErrorLocation(MatcherContext context)
           
protected  boolean resynchronize(MatcherContext context)
           
protected  boolean runTestMatch(MatcherContext context)
           
protected  boolean willMatchDelError(MatcherContext context)
           
protected  boolean willMatchInsError(MatcherContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RecoveringParseRunner.Handler

public RecoveringParseRunner.Handler(InvalidInputError currentError)
Creates a new Handler. If a non-null InvalidInputError is given the handler will set its endIndex to the correct index if the error corresponds to an error that can only be overcome by resynchronizing.

Parameters:
currentError - an optional InvalidInputError whose endIndex is to set during resyncing
Method Detail

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

prepareErrorLocation

protected boolean prepareErrorLocation(MatcherContext context)

willMatchDelError

protected boolean willMatchDelError(MatcherContext context)

willMatchInsError

protected boolean willMatchInsError(MatcherContext context)

runTestMatch

protected boolean runTestMatch(MatcherContext context)

resynchronize

protected boolean resynchronize(MatcherContext context)

gobbleIllegalCharacters

protected int gobbleIllegalCharacters(MatcherContext context,
                                      java.util.List<Matcher> followMatchers)