org.parboiled.parserunners
Class TracingParseRunner<V>

java.lang.Object
  extended by org.parboiled.parserunners.BasicParseRunner<V>
      extended by org.parboiled.parserunners.TracingParseRunner<V>
All Implemented Interfaces:
ParseRunner<V>

public class TracingParseRunner<V>
extends BasicParseRunner<V>

A ParseRunner implementation used for debugging purposes. It exhibits the same behavior as the ReportingParseRunner but collects debugging information as to which rules did match and which didn't.


Nested Class Summary
static class TracingParseRunner.Handler
          A MatchHandler implementation that reports the InvalidInputError at a given error index.
 
Field Summary
 
Fields inherited from class org.parboiled.parserunners.BasicParseRunner
initialValueStackSnapshot, inputBuffer, matched, parseErrors, rootContext, rootMatcher, valueStack
 
Constructor Summary
TracingParseRunner(Rule rule)
          Creates a new TracingParseRunner instance for the given rule.
TracingParseRunner(Rule rule, Predicate<?> filter)
          Creates a new TracingParseRunner instance for the given rule.
 
Method Summary
 java.lang.String getLog()
          Retrieves a string containing all generated log messages.
protected  boolean runRootContext()
           
 
Methods inherited from class org.parboiled.parserunners.BasicParseRunner
run, run, run, run, runRootContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TracingParseRunner

public TracingParseRunner(Rule rule)
Creates a new TracingParseRunner instance for the given rule.

Parameters:
rule - the parser rule

TracingParseRunner

public TracingParseRunner(Rule rule,
                          Predicate<?> filter)
Creates a new TracingParseRunner instance for the given rule. The given filter is used to select the matchers to print tracing statements for. NOTE: The given filter must be of type Predicate, Boolean>>. The reason this type is not directly specified in the constructors signature is that this would make predicate expressions using the Predicates operations and the predefined predicate constructors in Filters much more cumbersome to write (due to Java limited type parameters inference logic you would have to explicitly state the type parameters in many places).

Parameters:
rule - the parser rule
filter - the matcher filter selecting the matchers to print tracing statements for. Must be of type Predicate, Boolean>>.
Method Detail

getLog

public java.lang.String getLog()
Retrieves a string containing all generated log messages.

Returns:
the log messages

runRootContext

protected boolean runRootContext()
Overrides:
runRootContext in class BasicParseRunner<V>