Search in sources :

Example 6 with RegExpPredicate

use of com.intellij.structuralsearch.impl.matcher.predicates.RegExpPredicate in project intellij-community by JetBrains.

the class MatchingHandler method findRegExpPredicate.

private static MatchPredicate findRegExpPredicate(MatchPredicate start) {
    if (start == null)
        return null;
    if (start instanceof RegExpPredicate)
        return start;
    if (start instanceof BinaryPredicate) {
        BinaryPredicate binary = (BinaryPredicate) start;
        final MatchPredicate result = findRegExpPredicate(binary.getFirst());
        if (result != null)
            return result;
        return findRegExpPredicate(binary.getSecond());
    } else if (start instanceof NotPredicate) {
        return null;
    }
    return null;
}
Also used : RegExpPredicate(com.intellij.structuralsearch.impl.matcher.predicates.RegExpPredicate) BinaryPredicate(com.intellij.structuralsearch.impl.matcher.predicates.BinaryPredicate) NotPredicate(com.intellij.structuralsearch.impl.matcher.predicates.NotPredicate)

Aggregations

RegExpPredicate (com.intellij.structuralsearch.impl.matcher.predicates.RegExpPredicate)6 SubstitutionHandler (com.intellij.structuralsearch.impl.matcher.handlers.SubstitutionHandler)2 Matcher (java.util.regex.Matcher)2 MalformedPatternException (com.intellij.structuralsearch.MalformedPatternException)1 LiteralWithSubstitutionHandler (com.intellij.structuralsearch.impl.matcher.handlers.LiteralWithSubstitutionHandler)1 BinaryPredicate (com.intellij.structuralsearch.impl.matcher.predicates.BinaryPredicate)1 NotPredicate (com.intellij.structuralsearch.impl.matcher.predicates.NotPredicate)1 NonNls (org.jetbrains.annotations.NonNls)1 Nullable (org.jetbrains.annotations.Nullable)1