Package org.parboiled.parserunners
Class BasicParseRunner<V>
- java.lang.Object
-
- org.parboiled.parserunners.AbstractParseRunner<V>
-
- org.parboiled.parserunners.BasicParseRunner<V>
-
- All Implemented Interfaces:
MatchHandler
,ParseRunner<V>
public class BasicParseRunner<V> extends AbstractParseRunner<V> implements MatchHandler
The most basic of allParseRunner
implementations. It runs a rule against a given input text and builds a correspondingParsingResult
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.
-
-
Constructor Summary
Constructors Constructor Description BasicParseRunner(Rule rule)
Creates a new BasicParseRunner instance for the given rule.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
match(MatcherContext<?> context)
Runs the given MatcherContext.ParsingResult<V>
run(InputBuffer inputBuffer)
Performs the actual parse and creates a corresponding ParsingResult instance.static <V> ParsingResult<V>
run(Rule rule, String input)
Deprecated.As of 0.11.0 you should use the "regular" constructor and one of the "run" methods rather than this static method.-
Methods inherited from class org.parboiled.parserunners.AbstractParseRunner
createParsingResult, createRootContext, getParseErrors, getRootMatcher, getValueStack, resetValueStack, run, run, withParseErrors, withValueStack
-
-
-
-
Constructor Detail
-
BasicParseRunner
public BasicParseRunner(Rule rule)
Creates a new BasicParseRunner instance for the given rule.- Parameters:
rule
- the parser rule
-
-
Method Detail
-
run
@Deprecated public static <V> ParsingResult<V> run(Rule rule, String input)
Deprecated.As of 0.11.0 you should use the "regular" constructor and one of the "run" methods rather than this static method. This method will be removed in one of the coming releases.Create a new BasicParseRunner instance with the given rule and input text and returns the result of itsAbstractParseRunner.run(String)
method invocation.- Parameters:
rule
- the parser rule to runinput
- the input text to run on- Returns:
- the ParsingResult for the parsing run
-
run
public ParsingResult<V> run(InputBuffer inputBuffer)
Description copied from interface:ParseRunner
Performs the actual parse and creates a corresponding ParsingResult instance.- Specified by:
run
in interfaceParseRunner<V>
- Parameters:
inputBuffer
- the inputBuffer to use- Returns:
- the ParsingResult for the run
-
match
public boolean match(MatcherContext<?> context)
Description copied from interface:MatchHandler
Runs the given MatcherContext.- Specified by:
match
in interfaceMatchHandler
- Parameters:
context
- the MatcherContext- Returns:
- true if matched
-
-