public abstract class RepeatMatcher extends AbstractMatcher
Note that it is forbidden for the subrule as an argument to match an empty input. Unfortunately, due to current limitations, this can only be detected at runtime.
Example:
public Rule threeTimesHello() { return repeat("hello").times(3); }
Modifier | Constructor and Description |
---|---|
protected |
RepeatMatcher(Rule subRule) |
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
enoughCycles(int cycles) |
MatcherType |
getType()
Returns the type of this matcher
|
<V> boolean |
match(MatcherContext<V> context)
Tries a match on the given MatcherContext.
|
protected abstract boolean |
runAgain(int cycles) |
getLabel, getSubContext, hasCustomLabel, label, toString
getChildren
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getChildren
protected RepeatMatcher(Rule subRule)
public MatcherType getType()
Matcher
MatcherType
public <V> boolean match(MatcherContext<V> context)
Matcher
context
- the MatcherContextprotected abstract boolean enoughCycles(int cycles)
protected abstract boolean runAgain(int cycles)