org.parboiled.parserunners
Class BasicParseRunner<V>

java.lang.Object
  extended by org.parboiled.parserunners.BasicParseRunner<V>
All Implemented Interfaces:
ParseRunner<V>
Direct Known Subclasses:
ProfilingParseRunner, RecordingParseRunner, RecoveringParseRunner, ReportingParseRunner, TracingParseRunner

public class BasicParseRunner<V>
extends java.lang.Object
implements ParseRunner<V>

The most basic of all 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.


Nested Class Summary
static class BasicParseRunner.Handler
          The most trivial MatchHandler implementation.
 
Field Summary
protected  java.lang.Object initialValueStackSnapshot
           
protected  InputBuffer inputBuffer
           
protected  boolean matched
           
protected  java.util.List<ParseError> parseErrors
           
protected  MatcherContext<V> rootContext
           
 Matcher rootMatcher
           
protected  ValueStack<V> valueStack
           
 
Constructor Summary
BasicParseRunner(Rule rule)
          Creates a new BasicParseRunner instance for the given rule.
BasicParseRunner(Rule rule, ValueStack<V> valueStack)
          Creates a new BasicParseRunner instance for the given rule using the given ValueStack instance.
 
Method Summary
 ParsingResult<V> run(char[] input)
           
 ParsingResult<V> run(InputBuffer inputBuffer)
          Performs the actual parse and creates a corresponding ParsingResult instance.
static
<V> ParsingResult<V>
run(Rule rule, java.lang.String input)
          Create a new BasicParseRunner instance with the given rule and input text and returns the result of its run(String) method invocation.
 ParsingResult<V> run(java.lang.String input)
          Performs the actual parse and creates a corresponding ParsingResult instance.
protected  boolean runRootContext()
           
protected  boolean runRootContext(MatchHandler handler, boolean fastStringMatching)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parseErrors

protected final java.util.List<ParseError> parseErrors

valueStack

protected final ValueStack<V> valueStack

initialValueStackSnapshot

protected final java.lang.Object initialValueStackSnapshot

rootMatcher

public final Matcher rootMatcher

inputBuffer

protected InputBuffer inputBuffer

rootContext

protected MatcherContext<V> rootContext

matched

protected boolean matched
Constructor Detail

BasicParseRunner

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

Parameters:
rule - the parser rule

BasicParseRunner

public BasicParseRunner(Rule rule,
                        ValueStack<V> valueStack)
Creates a new BasicParseRunner instance for the given rule using the given ValueStack instance.

Parameters:
rule - the parser rule
valueStack - the value stack
Method Detail

run

public static <V> ParsingResult<V> run(Rule rule,
                                       java.lang.String input)
Create a new BasicParseRunner instance with the given rule and input text and returns the result of its run(String) method invocation.

Parameters:
rule - the parser rule to run
input - the input text to run on
Returns:
the ParsingResult for the parsing run

run

public ParsingResult<V> run(java.lang.String input)
Description copied from interface: ParseRunner
Performs the actual parse and creates a corresponding ParsingResult instance.

Specified by:
run in interface ParseRunner<V>
Parameters:
input - the input text to parse
Returns:
the ParsingResult for the run

run

public ParsingResult<V> run(char[] input)

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 interface ParseRunner<V>
Parameters:
inputBuffer - the inputBuffer to use
Returns:
the ParsingResult for the run

runRootContext

protected boolean runRootContext()

runRootContext

protected boolean runRootContext(MatchHandler handler,
                                 boolean fastStringMatching)