Class BranchTrackingVisitor
- java.lang.Object
-
- org.sonarsource.analyzer.commons.regex.ast.RegexBaseVisitor
-
- org.sonarsource.analyzer.commons.regex.helpers.BranchTrackingVisitor
-
- All Implemented Interfaces:
RegexVisitor
- Direct Known Subclasses:
FailingLookaheadFinder,PossessiveQuantifierContinuationFinder
public class BranchTrackingVisitor extends RegexBaseVisitor
The BranchTrackingVisitor saves the nearest enclosing branching construct as it traverses the tree. This helps to track node predecessors, which is useful to avoid cycles during Automaton evaluation.
-
-
Constructor Summary
Constructors Constructor Description BranchTrackingVisitor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IndexRangegetPredecessorsRangeOf(RegexTree tree)Return the range containing all predecessors of the node.voidvisitDisjunction(DisjunctionTree tree)voidvisitRepetition(RepetitionTree tree)-
Methods inherited from class org.sonarsource.analyzer.commons.regex.ast.RegexBaseVisitor
after, backslash, before, supportsAnyOfFeatures, visit, visit, visitAtomicGroup, visitBackReference, visitBoundary, visitCapturingGroup, visitCharacter, visitCharacterClass, visitCharacterClassIntersection, visitCharacterClassUnion, visitCharacterRange, visitConditionalSubpattern, visitDot, visitEscapedCharacterClass, visitGroup, visitInCharClass, visitLookAround, visitMiscEscapeSequence, visitNonCapturingGroup, visitSequence
-
-
-
-
Method Detail
-
visitDisjunction
public void visitDisjunction(DisjunctionTree tree)
- Specified by:
visitDisjunctionin interfaceRegexVisitor- Overrides:
visitDisjunctionin classRegexBaseVisitor
-
visitRepetition
public void visitRepetition(RepetitionTree tree)
- Specified by:
visitRepetitionin interfaceRegexVisitor- Overrides:
visitRepetitionin classRegexBaseVisitor
-
getPredecessorsRangeOf
public IndexRange getPredecessorsRangeOf(RegexTree tree)
Return the range containing all predecessors of the node. If all paths from a node lead to another, then the former is a predecessor of the latter- Parameters:
tree- a node- Returns:
- IndexRange for all the node's predecessors
-
-