Package org.sonar.java.regex.ast
Class RegexBaseVisitor
- java.lang.Object
-
- org.sonar.java.regex.ast.RegexBaseVisitor
-
- All Implemented Interfaces:
RegexVisitor
public class RegexBaseVisitor extends Object implements RegexVisitor
-
-
Constructor Summary
Constructors Constructor Description RegexBaseVisitor()
-
Method Summary
-
-
-
Method Detail
-
getActiveFlags
protected int getActiveFlags()
-
flagActive
protected boolean flagActive(int flag)
-
getJavaCharacterForFlag
@CheckForNull protected JavaCharacter getJavaCharacterForFlag(int flag)
Returns the character inside the regex that was used to set the given flag. This will return null if the flag is not set or if the flag has been set from outside of the regex (i.e. as an argument to Pattern.compile). Therefore this should not be used to check whether a flag is set.
-
visit
protected void visit(RegexTree tree)
-
visit
public void visit(RegexParseResult regexParseResult)
- Specified by:
visit
in interfaceRegexVisitor
-
before
protected void before(RegexParseResult regexParseResult)
Override to perform an action before any part of the regex is visited.
-
after
protected void after(RegexParseResult regexParseResult)
Override to perform an action after the entire regex has been visited.
-
visitPlainCharacter
public void visitPlainCharacter(PlainCharacterTree tree)
- Specified by:
visitPlainCharacter
in interfaceRegexVisitor
-
visitUnicodeCodePoint
public void visitUnicodeCodePoint(UnicodeCodePointTree tree)
- Specified by:
visitUnicodeCodePoint
in interfaceRegexVisitor
-
visitCharacter
protected void visitCharacter(CharacterTree tree)
Override to visit both PlainCharacterTrees and UnicodeCodePointTrees
-
visitSequence
public void visitSequence(SequenceTree tree)
- Specified by:
visitSequence
in interfaceRegexVisitor
-
visitDisjunction
public void visitDisjunction(DisjunctionTree tree)
- Specified by:
visitDisjunction
in interfaceRegexVisitor
-
visitCapturingGroup
public void visitCapturingGroup(CapturingGroupTree tree)
- Specified by:
visitCapturingGroup
in interfaceRegexVisitor
-
visitNonCapturingGroup
public final void visitNonCapturingGroup(NonCapturingGroupTree tree)
- Specified by:
visitNonCapturingGroup
in interfaceRegexVisitor
-
doVisitNonCapturingGroup
protected void doVisitNonCapturingGroup(NonCapturingGroupTree tree)
-
visitAtomicGroup
public void visitAtomicGroup(AtomicGroupTree tree)
- Specified by:
visitAtomicGroup
in interfaceRegexVisitor
-
visitLookAround
public void visitLookAround(LookAroundTree tree)
- Specified by:
visitLookAround
in interfaceRegexVisitor
-
visitBackReference
public void visitBackReference(BackReferenceTree tree)
- Specified by:
visitBackReference
in interfaceRegexVisitor
-
visitRepetition
public void visitRepetition(RepetitionTree tree)
- Specified by:
visitRepetition
in interfaceRegexVisitor
-
visitCharacterClass
public void visitCharacterClass(CharacterClassTree tree)
- Specified by:
visitCharacterClass
in interfaceRegexVisitor
-
visitCharacterRange
public void visitCharacterRange(CharacterRangeTree tree)
- Specified by:
visitCharacterRange
in interfaceRegexVisitor
-
visitCharacterClassUnion
public void visitCharacterClassUnion(CharacterClassUnionTree tree)
- Specified by:
visitCharacterClassUnion
in interfaceRegexVisitor
-
visitCharacterClassIntersection
public void visitCharacterClassIntersection(CharacterClassIntersectionTree tree)
- Specified by:
visitCharacterClassIntersection
in interfaceRegexVisitor
-
visitDot
public void visitDot(DotTree tree)
- Specified by:
visitDot
in interfaceRegexVisitor
-
visitEscapedCharacterClass
public void visitEscapedCharacterClass(EscapedCharacterClassTree tree)
- Specified by:
visitEscapedCharacterClass
in interfaceRegexVisitor
-
visitBoundary
public void visitBoundary(BoundaryTree boundaryTree)
- Specified by:
visitBoundary
in interfaceRegexVisitor
-
visitMiscEscapeSequence
public void visitMiscEscapeSequence(MiscEscapeSequenceTree tree)
- Specified by:
visitMiscEscapeSequence
in interfaceRegexVisitor
-
-