org.parboiled.parserunners
Class RecordingParseRunner.Handler

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

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

A MatchHandler implementation keeping track of the furthest match in the current input buffer, and therefore the first location corresponding to an InvalidInputError. For the actual matching this handler relies on another, inner MatchHandler instance it delegates to.


Constructor Summary
RecordingParseRunner.Handler()
          Creates a new Handler which delegates to a BasicParseRunner.Handler instance.
RecordingParseRunner.Handler(MatchHandler inner)
          Creates a new Handler which delegates to the given MatchHandler instance.
 
Method Summary
 int getErrorIndex()
          Returns the index of the first InvalidInputError in the input text.
 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

RecordingParseRunner.Handler

public RecordingParseRunner.Handler()
Creates a new Handler which delegates to a BasicParseRunner.Handler instance.


RecordingParseRunner.Handler

public RecordingParseRunner.Handler(MatchHandler inner)
Creates a new Handler which delegates to the given MatchHandler instance.

Parameters:
inner - the inner instance to delegate to
Method Detail

getErrorIndex

public int getErrorIndex()
Returns the index of the first InvalidInputError in the input text.

Returns:
the index of the first parse error or -1, if the input is error free.

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