org.parboiled.parserunners
Class RecordingParseRunner<V>
java.lang.Object
org.parboiled.parserunners.BasicParseRunner<V>
org.parboiled.parserunners.RecordingParseRunner<V>
- All Implemented Interfaces:
- ParseRunner<V>
public class RecordingParseRunner<V>
- extends BasicParseRunner<V>
A ParseRunner
implementation that records the location of the first InvalidInputError
found,
without actually creating a InvalidInputError
instance and adding it to the list of ParseErrors.
It never causes the parser to perform more than one parsing run and is rarely used directly. Instead its functionality
is relied upon by the ReportingParseRunner
and RecoveringParseRunner
classes.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RecordingParseRunner
public RecordingParseRunner(Rule rule)
- Creates a new RecordingParseRunner instance for the given rule.
- Parameters:
rule
- the parser rule
RecordingParseRunner
public RecordingParseRunner(Rule rule,
ValueStack<V> valueStack)
- Creates a new RecordingParseRunner instance for the given rule using the given ValueStack instance.
- Parameters:
rule
- the parser rulevalueStack
- the value stack
run
public static <V> ParsingResult<V> run(Rule rule,
java.lang.String input)
- Create a new RecordingParseRunner instance with the given rule and input text and returns the result of
its
BasicParseRunner.run(String)
method invocation.
- Parameters:
rule
- the parser rule to runinput
- the input text to run on
- Returns:
- the ParsingResult for the parsing run
runRootContext
protected boolean runRootContext()
- Overrides:
runRootContext
in class BasicParseRunner<V>
getErrorIndex
public int getErrorIndex()
- Returns the index of the first
InvalidInputError
in the input text.
Must not be called before the BasicParseRunner.run(String)
has been called.
- Returns:
- the index of the first parse error or -1, if the input is error free.