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 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.
  • Constructor Details

    • BasicParseRunner

      public BasicParseRunner(Rule rule)
      Creates a new BasicParseRunner instance for the given rule.
      Parameters:
      rule - the parser rule
  • Method Details

    • 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 its AbstractParseRunner.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(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
    • match

      public boolean match(MatcherContext<?> context)
      Description copied from interface: MatchHandler
      Runs the given MatcherContext.
      Specified by:
      match in interface MatchHandler
      Parameters:
      context - the MatcherContext
      Returns:
      true if matched