Class AbstractMatcher
- Direct Known Subclasses:
ActionMatcher, AnyMatcher, AnyOfMatcher, CharIgnoreCaseMatcher, CharMatcher, CharRangeMatcher, CustomMatcher, EmptyMatcher, FirstOfMatcher, NothingMatcher, OneOrMoreMatcher, OptionalMatcher, SequenceMatcher, TestMatcher, TestNotMatcher, ZeroOrMoreMatcher
public abstract class AbstractMatcher
extends ImmutableGraphNode<Matcher>
implements Matcher, Cloneable
Abstract base class of most regular
Matchers.-
Constructor Summary
ConstructorsConstructorDescriptionAbstractMatcher(String label) AbstractMatcher(Rule[] subRules, String label) AbstractMatcher(Rule subRule, String label) -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleangetLabel()getSubContext(MatcherContext context) Creates a context for the matching of this matcher using the given parent context.getTag()Retrieves a previously set tag object.booleanbooleanbooleanAttaches a label to this Rule.Enables memoization of rule mismatches for consecutive rule applications at the same input location.voidAssociates an arbitrary object with this matcher.skipNode()Instructs parboiled to not create a parse tree node for this rule.Instructs parboiled to not create a parse tree node for this rule and all subrules, which can significantly increase parsing performance.Instructs parboiled to not create parse tree nodes for the subrules of this rule, which can significantly increase parsing performance.toString()Methods inherited from class ImmutableGraphNode
getChildrenMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface GraphNode
getChildren
-
Constructor Details
-
AbstractMatcher
-
AbstractMatcher
-
AbstractMatcher
-
-
Method Details
-
isNodeSuppressed
public boolean isNodeSuppressed()- Specified by:
isNodeSuppressedin interfaceMatcher- Returns:
- true if this matcher has been marked with @SuppressNode
-
areSubnodesSuppressed
public boolean areSubnodesSuppressed()- Specified by:
areSubnodesSuppressedin interfaceMatcher- Returns:
- true if this matcher has been marked with @SuppressSubnodes
-
isNodeSkipped
public boolean isNodeSkipped()- Specified by:
isNodeSkippedin interfaceMatcher- Returns:
- true if this matcher has been marked with @SkipNode
-
areMismatchesMemoed
public boolean areMismatchesMemoed()- Specified by:
areMismatchesMemoedin interfaceMatcher- Returns:
- true if this matcher has been marked with @MemoMismatches
-
getLabel
-
hasCustomLabel
public boolean hasCustomLabel()- Specified by:
hasCustomLabelin interfaceMatcher- Returns:
- true if this matcher has been assigned a custom label
-
toString
-
label
Description copied from interface:RuleAttaches a label to this Rule. Corresponds to the @Label annotation. -
suppressNode
Description copied from interface:RuleInstructs parboiled to not create a parse tree node for this rule and all subrules, which can significantly increase parsing performance. Corresponds to the @SuppressNode annotation.- Specified by:
suppressNodein interfaceRule- Returns:
- this Rule
-
suppressSubnodes
Description copied from interface:RuleInstructs parboiled to not create parse tree nodes for the subrules of this rule, which can significantly increase parsing performance. Corresponds to the @SuppressSubnodes annotation.- Specified by:
suppressSubnodesin interfaceRule- Returns:
- this Rule
-
skipNode
Description copied from interface:RuleInstructs parboiled to not create a parse tree node for this rule. The parse tree nodes of all subrules are directly attached to the parent of this rule (or more correctly: the first ancestor not having been marked skipNode(). Note that, even though a rule marked as skipNode() does not create a parse tree node of its own and is therefore "invisible" in the parse tree, the rule still exists as a regular rule in the rule tree and is accompanied by a "regular" ruleContextduring rule matching. Corresponds to the @SkipNode annotation. -
memoMismatches
Description copied from interface:RuleEnables memoization of rule mismatches for consecutive rule applications at the same input location.- Specified by:
memoMismatchesin interfaceRule- Returns:
- this rule
-
getTag
-
setTag
Description copied from interface:MatcherAssociates an arbitrary object with this matcher. Used for example during profiling and packrat parsing. The matcher implementations themselves completely ignore the contents of this property. It purely serves as a performance optimization for ParseRunners and/or MatchHandlers and saves these from the need to use Map<Matcher, XYZ> structures for associating internal objects with matchers. -
getSubContext
Description copied from interface:MatcherCreates a context for the matching of this matcher using the given parent context.- Specified by:
getSubContextin interfaceMatcher- Parameters:
context- the parent context- Returns:
- the context this matcher is to be run in
-