|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.parboiled.trees.ImmutableGraphNode<Matcher>
org.parboiled.matchers.AbstractMatcher
org.parboiled.matchers.CustomMatcher
public abstract class CustomMatcher
Base class of custom matcher implementations. If you want to implement custom matchers they have to be derived from this class. Instances of derived classes can be directly used in rule defining expressions. Caution: For performance reasons the parsing engine delegates the task of taking and restoring value stack snapshots to the matchers. If your custom matcher can run parser actions underneath it your custom matcher implementation therefore has to take care of value stack managment itselves! (See the implementation of the SequenceMatcher for hints on how to do this!)
Constructor Summary | |
---|---|
protected |
CustomMatcher(Rule[] subRules,
java.lang.String label)
|
protected |
CustomMatcher(Rule subRule,
java.lang.String label)
|
protected |
CustomMatcher(java.lang.String label)
|
Method Summary | ||
---|---|---|
|
accept(MatcherVisitor<R> visitor)
Accepts the given matcher visitor. |
|
abstract boolean |
canMatchEmpty()
Determines whether this matcher instance allows empty matches. |
|
abstract char |
getStarterChar()
Returns one of possibly several chars that a match can start with. |
|
abstract boolean |
isSingleCharMatcher()
Determines whether this matcher instance always matches exactly one character. |
|
abstract boolean |
isStarterChar(char c)
Determines whether this matcher instance can start a match with the given char. |
Methods inherited from class org.parboiled.matchers.AbstractMatcher |
---|
areMismatchesMemoed, areSubnodesSuppressed, getLabel, getSubContext, getTag, hasCustomLabel, 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.matchers.Matcher |
---|
match |
Methods inherited from interface org.parboiled.trees.GraphNode |
---|
getChildren |
Constructor Detail |
---|
protected CustomMatcher(java.lang.String label)
protected CustomMatcher(Rule subRule, java.lang.String label)
protected CustomMatcher(Rule[] subRules, java.lang.String label)
Method Detail |
---|
public abstract boolean isSingleCharMatcher()
public abstract boolean canMatchEmpty()
public abstract boolean isStarterChar(char c)
c
- the char
public abstract char getStarterChar()
public <R> R accept(MatcherVisitor<R> visitor)
Matcher
visitor
- the visitor
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |