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, toStringgetChildrenclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetChildrenprotected RepeatMatcher(Rule subRule)
public MatcherType getType()
MatcherMatcherTypepublic <V> boolean match(MatcherContext<V> context)
Matchercontext - the MatcherContextprotected abstract boolean enoughCycles(int cycles)
protected abstract boolean runAgain(int cycles)