boolean (HighlighterIterator iterator, CharSequence fileText, FileType fileType, boolean left) { final BracePair pair = findPair(left, iterator, fileText, fileType); if (pair == null) return false; final IElementType opposite = left ? gt() : lt(); if ((left ? pair.getRightBraceType() : pair.getLeftBraceType()) != opposite) return true; if (fileType != myFileType) return false; final IElementType braceElementType = left ? lt() : gt(); int count = 0; try { int paired = 1; while (true) { count++; if (left) { iterator.advance(); } else { iterator.retreat(); } if (iterator.atEnd()) break; final IElementType tokenType = iterator.getTokenType(); if (tokenType == opposite) { paired--; if (paired == 0) return true; continue; } if (tokenType == braceElementType) { paired++; continue; } if ( (myTokenSetAllowedInsideAngleBrackets == null || !myTokenSetAllowedInsideAngleBrackets.contains(tokenType)) && (myBasicTokenSetAllowedInsideAngleBrackets == null || !myBasicTokenSetAllowedInsideAngleBrackets.contains(tokenType))) { return false; } } return false; } finally { while (count-- > 0) { if (left) { iterator.retreat(); } else { iterator.advance(); } } } }