use of com.intellij.dupLocator.iterators.NodeIterator in project intellij-community by JetBrains.
the class MatcherImpl method checkIfShouldAttemptToMatch.
public static boolean checkIfShouldAttemptToMatch(MatchContext context, NodeIterator matchedNodes) {
final CompiledPattern pattern = context.getPattern();
final NodeIterator patternNodes = pattern.getNodes();
try {
while (true) {
final PsiElement patternNode = patternNodes.current();
if (patternNode == null) {
return true;
}
final PsiElement matchedNode = matchedNodes.current();
if (matchedNode == null) {
return false;
}
final MatchingHandler matchingHandler = pattern.getHandler(patternNode);
if (matchingHandler == null || !matchingHandler.canMatch(patternNode, matchedNode, context)) {
return false;
}
matchedNodes.advance();
patternNodes.advance();
}
} finally {
patternNodes.reset();
matchedNodes.reset();
}
}
Aggregations