boolean (@NotNull NodeIterator matchedNodes) { final MatchContext matchContext = getMatchContext(); final CompiledPattern pattern = matchContext.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.canMatch(patternNode, matchedNode, matchContext)) { return false; } matchedNodes.advance(); patternNodes.advance(); } } finally { patternNodes.reset(); matchedNodes.reset(); } }