public abstract class NFATraversalRegexASTVisitor extends Object
CharacterClass or a
MatchFound node.
Examples:
Successors of "b" in (a|b)c:
1.: "c"
Successors of "b" in (a|b)*c:
1.: "a"
2.: "b"
3.: "c"
For every successor, the visitor will find the full path of AST nodes that have been traversed
from the initial node to the successor node, where Group nodes are treated specially: The
path will contain separate entries for entering and leaving a Group,
and a special pass-through node for empty sequences of Groups marked with
Group.isExpandedQuantifier(). Furthermore, the visitor will not descend into lookaround
assertions, it will jump over them and just add their corresponding LookAheadAssertion or
LookBehindAssertion node to the path. This visitor is not thread-safe, since it uses the
methods of RegexASTVisitorIterable for traversing groups.
Examples with full path information:
Successors of "b" in (a|b)c:
1.: [leave group 1], [CharClass c]
Successors of "b" in (a|b)*c:
1.: [leave group 1], [enter group 1], [CharClass a]
2.: [leave group 1], [enter group 1], [CharClass b]
3.: [leave group 1], [CharClass c]
| Modifier | Constructor and Description |
|---|---|
protected |
NFATraversalRegexASTVisitor(RegexAST ast) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canTraverseCaret() |
protected boolean |
dollarsOnPath() |
protected abstract void |
enterLookAhead(LookAheadAssertion assertion) |
protected GroupBoundaries |
getGroupBoundaries() |
protected PositionAssertion |
getLastDollarOnPath() |
Set<LookBehindAssertion> |
getTraversableLookBehindAssertions() |
protected abstract void |
leaveLookAhead(LookAheadAssertion assertion) |
protected void |
run(Term runRoot) |
void |
setCanTraverseCaret(boolean canTraverseCaret) |
void |
setReverse(boolean reverse) |
void |
setTraversableLookBehindAssertions(Set<LookBehindAssertion> traversableLookBehindAssertions) |
protected abstract void |
visit(RegexASTNode target)
Visit the next successor found.
|
protected final RegexAST ast
protected NFATraversalRegexASTVisitor(RegexAST ast)
public Set<LookBehindAssertion> getTraversableLookBehindAssertions()
public void setTraversableLookBehindAssertions(Set<LookBehindAssertion> traversableLookBehindAssertions)
public boolean canTraverseCaret()
public void setCanTraverseCaret(boolean canTraverseCaret)
public void setReverse(boolean reverse)
protected void run(Term runRoot)
protected abstract void visit(RegexASTNode target)
protected abstract void enterLookAhead(LookAheadAssertion assertion)
protected abstract void leaveLookAhead(LookAheadAssertion assertion)
protected boolean dollarsOnPath()
protected PositionAssertion getLastDollarOnPath()
protected GroupBoundaries getGroupBoundaries()