@ParametersAreNonnullByDefault public class ListeningParseRunner<V> extends AbstractParseRunner<V> implements MatchHandler
ParseRunner
implementations. It runs a rule
against a given input text and builds a corresponding ParsingResult
instance. However, it does not report any parse errors nor recover from them.
Instead it simply marks the ParsingResult as "unmatched" if the input is not
valid with regard to the rule grammar.It never causes the parser to perform
more than one parsing run and is the fastest way to determine whether a given
input conforms to the rule grammar.rootMatcher, stackSnapshot, valueStack
Constructor and Description |
---|
ListeningParseRunner(Rule rule)
Creates a new BasicParseRunner instance for the given rule.
|
Modifier and Type | Method and Description |
---|---|
<T> boolean |
match(MatcherContext<T> context)
Runs the given MatcherContext.
|
void |
registerListener(ParseRunnerListener<V> listener) |
ParsingResult<V> |
run(InputBuffer inputBuffer)
Performs the actual parse and creates a corresponding ParsingResult instance.
|
createParsingResult, createRootContext, getValueStack, resetValueStack, run
public ListeningParseRunner(Rule rule)
rule
- the parser rulepublic final void registerListener(ParseRunnerListener<V> listener)
public ParsingResult<V> run(InputBuffer inputBuffer)
ParseRunner
run
in interface ParseRunner<V>
inputBuffer
- the inputBuffer to usepublic <T> boolean match(MatcherContext<T> context)
MatchHandler
match
in interface MatchHandler
context
- the MatcherContext