Package org.parboiled.matchers
Class StringMatcher
- java.lang.Object
-
- org.parboiled.trees.ImmutableGraphNode<Matcher>
-
- org.parboiled.matchers.AbstractMatcher
-
- org.parboiled.matchers.SequenceMatcher
-
- org.parboiled.matchers.StringMatcher
-
public class StringMatcher extends SequenceMatcher
ASequenceMatcher
specialization for sequences of CharMatchers. Performs fast string matching if the current context has it enabled.
-
-
Field Summary
Fields Modifier and Type Field Description char[]
characters
-
Constructor Summary
Constructors Constructor Description StringMatcher(Rule[] charMatchers, char[] characters)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
defaultLabel(String defaultLabel)
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
-
-
-
-
Constructor Detail
-
StringMatcher
public StringMatcher(Rule[] charMatchers, char[] characters)
-
-
Method Detail
-
getLabel
public String getLabel()
-
hasCustomLabel
public boolean hasCustomLabel()
- Specified by:
hasCustomLabel
in interfaceMatcher
- 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 interfaceMatcher
- Overrides:
match
in classSequenceMatcher
- Parameters:
context
- the MatcherContext- Returns:
- true if the match was successful
-
defaultLabel
public T defaultLabel(String defaultLabel)
-
-