Class NFATraversalRegexASTVisitor
java.lang.Object
com.oracle.truffle.regex.tregex.parser.ast.visitors.NFATraversalRegexASTVisitor
- Direct Known Subclasses:
ASTStepVisitor,MarkLookBehindEntriesVisitor,PureNFATransitionGenerator
Special AST visitor that will find all immediate successors of a given Term when the AST is seen
as a NFA, in priority order. A successor can either be a
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 marked with
RegexASTNode.isQuantifierPassThroughSequence(). 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.
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]
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected abstract booleanbooleanprotected booleanprotected booleanprotected voiddumpTransitionGuards(long[] guards) protected abstract voidenterLookAhead(LookAheadAssertion assertion) protected TBitSetprotected GroupBoundariesprotected long[]protected booleanprotected abstract booleanprotected booleanprotected abstract voidleaveLookAhead(LookAheadAssertion assertion) protected voidvoidsetCanTraverseCaret(boolean canTraverseCaret) voidsetMatchedConditionGroups(TBitSet matchedConditionGroups) voidsetReverse(boolean reverse) voidsetTraversableLookBehindAssertions(Set<LookBehindAssertion> traversableLookBehindAssertions) protected abstract voidvisit(RegexASTNode target) Visit the next successor found.
-
Field Details
-
ast
-
-
Constructor Details
-
NFATraversalRegexASTVisitor
-
-
Method Details
-
getTraversableLookBehindAssertions
-
setTraversableLookBehindAssertions
public void setTraversableLookBehindAssertions(Set<LookBehindAssertion> traversableLookBehindAssertions) -
canTraverseCaret
public boolean canTraverseCaret() -
setCanTraverseCaret
public void setCanTraverseCaret(boolean canTraverseCaret) -
setMatchedConditionGroups
-
getMatchedConditionGroups
-
getCurrentMatchedConditionGroups
-
isReverse
protected boolean isReverse() -
setReverse
public void setReverse(boolean reverse) -
isBuildingDFA
protected abstract boolean isBuildingDFA() -
canPruneAfterUnconditionalFinalState
protected abstract boolean canPruneAfterUnconditionalFinalState() -
run
-
visit
Visit the next successor found. -
enterLookAhead
-
leaveLookAhead
-
caretsOnPath
protected boolean caretsOnPath() -
dollarsOnPath
protected boolean dollarsOnPath() -
hasTransitionGuards
protected boolean hasTransitionGuards() -
getTransitionGuardsOnPath
protected long[] getTransitionGuardsOnPath() -
calcTransitionGuardsResult
protected void calcTransitionGuardsResult() -
getGroupBoundaries
-
dumpTransitionGuards
protected void dumpTransitionGuards(long[] guards)
-