public class TracingParseRunner<V> extends ReportingParseRunner<V> implements MatchHandler
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.| Modifier and Type | Field and Description |
|---|---|
private Predicate<Tuple2<Context<?>,java.lang.Boolean>> |
filter |
private MatcherPath |
lastPath |
private int |
line |
private Sink<java.lang.String> |
log |
| Constructor and Description |
|---|
TracingParseRunner(Rule rule)
Creates a new TracingParseRunner instance without filter and a console log for the given rule.
|
| Modifier and Type | Method and Description |
|---|---|
Predicate<Tuple2<Context<?>,java.lang.Boolean>> |
getFilter() |
Sink<java.lang.String> |
getLog() |
boolean |
match(MatcherContext<?> context)
Runs the given MatcherContext.
|
private void |
print(MatcherContext<?> context,
boolean matched) |
protected ParsingResult<V> |
runBasicMatch(InputBuffer inputBuffer) |
TracingParseRunner<V> |
withFilter(Predicate<?> filter)
Attaches the given filter to this TracingParseRunner instance.
|
TracingParseRunner<V> |
withLog(Sink<java.lang.String> log)
Attaches the given log to this TracingParseRunner instance.
|
run, run, runLocatingMatch, runReportingMatchcreateParsingResult, createRootContext, getParseErrors, getRootMatcher, getValueStack, resetValueStack, run, run, withParseErrors, withValueStackprivate Sink<java.lang.String> log
private MatcherPath lastPath
private int line
public TracingParseRunner(Rule rule)
rule - the parser rulepublic TracingParseRunner<V> withFilter(Predicate<?> filter)
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).filter - the matcher filter selecting the matchers to print tracing statements for. Must be of type
Predicatepublic TracingParseRunner<V> withLog(Sink<java.lang.String> log)
log - the log to usepublic Sink<java.lang.String> getLog()
protected ParsingResult<V> runBasicMatch(InputBuffer inputBuffer)
runBasicMatch in class ReportingParseRunner<V>public boolean match(MatcherContext<?> context)
MatchHandlermatch in interface MatchHandlercontext - the MatcherContextprivate void print(MatcherContext<?> context, boolean matched)