org.parboiled.matchers
Class StringMatcher

java.lang.Object
  extended by org.parboiled.trees.ImmutableGraphNode<Matcher>
      extended by org.parboiled.matchers.AbstractMatcher
          extended by org.parboiled.matchers.SequenceMatcher
              extended by org.parboiled.matchers.StringMatcher
All Implemented Interfaces:
java.lang.Cloneable, Matcher, Rule, GraphNode<Matcher>

public class StringMatcher
extends SequenceMatcher

A SequenceMatcher specialization for sequences of CharMatchers. Performs fast string matching if the current context has it enabled.


Field Summary
 char[] characters
           
 
Constructor Summary
StringMatcher(Rule[] charMatchers, char[] characters)
           
 
Method Summary
 T defaultLabel(java.lang.String defaultLabel)
           
 java.lang.String getLabel()
           
 boolean hasCustomLabel()
           
 boolean match(MatcherContext context)
          Tries a match on the given MatcherContext.
 
Methods inherited from class org.parboiled.matchers.SequenceMatcher
accept
 
Methods inherited from class org.parboiled.matchers.AbstractMatcher
areMismatchesMemoed, areSubnodesSuppressed, getSubContext, getTag, isNodeSkipped, isNodeSuppressed, label, memoMismatches, setTag, skipNode, suppressNode, suppressSubnodes, toString
 
Methods inherited from class org.parboiled.trees.ImmutableGraphNode
getChildren
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.parboiled.trees.GraphNode
getChildren
 

Field Detail

characters

public final char[] characters
Constructor Detail

StringMatcher

public StringMatcher(Rule[] charMatchers,
                     char[] characters)
Method Detail

getLabel

public java.lang.String getLabel()
Specified by:
getLabel in interface Matcher
Returns:
the label of the matcher (which is identical to the label of the Rule this matcher matches)

hasCustomLabel

public boolean hasCustomLabel()
Specified by:
hasCustomLabel in interface Matcher
Returns:
true if this matcher has been assigned a custom label

match

public boolean match(MatcherContext context)
Description copied from interface: Matcher
Tries a match on the given MatcherContext.

Specified by:
match in interface Matcher
Overrides:
match in class SequenceMatcher
Parameters:
context - the MatcherContext
Returns:
true if the match was successful

defaultLabel

public T defaultLabel(java.lang.String defaultLabel)