Package org.parboiled.matchers
Class FirstOfStringsMatcher
- java.lang.Object
-
- org.parboiled.trees.ImmutableGraphNode<Matcher>
-
- org.parboiled.matchers.AbstractMatcher
-
- org.parboiled.matchers.FirstOfMatcher
-
- org.parboiled.matchers.FirstOfStringsMatcher
-
public class FirstOfStringsMatcher extends FirstOfMatcher
A specialized FirstOfMatcher that handles FirstOf(string, string, ...) rules much faster that the regular FirstOfMatcher. If fast string matching is enabled this matcher uses a prebuilt character tree to efficiently determine whether the next input characters match the rule expression.
-
-
Field Summary
Fields Modifier and Type Field Description char[][]
strings
-
Constructor Summary
Constructors Constructor Description FirstOfStringsMatcher(Rule[] subRules, char[][] strings)
-
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.FirstOfMatcher
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
-
FirstOfStringsMatcher
public FirstOfStringsMatcher(Rule[] subRules, char[][] strings)
-
-
Method Detail
-
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 classFirstOfMatcher
- Parameters:
context
- the MatcherContext- Returns:
- true if the match was successful
-
getLabel
public String getLabel()
- Specified by:
getLabel
in interfaceMatcher
- Overrides:
getLabel
in classAbstractMatcher
- 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 interfaceMatcher
- Overrides:
hasCustomLabel
in classAbstractMatcher
- Returns:
- true if this matcher has been assigned a custom label
-
defaultLabel
public T defaultLabel(String defaultLabel)
-
-