boolean (IndexPattern[] allIndexPatterns, IndexPattern indexPattern, CharSequence chars, List<CommentRange> commentRanges, int commentNum, PsiFile file, TextRange range, Processor<? super IndexPatternOccurrence> consumer, IntList matches, boolean multiLine ) { CommentRange commentRange = commentRanges.get(commentNum); int commentStart = commentRange.startOffset; int commentEnd = commentRange.endOffset; int commentPrefixLength = commentRange.prefixLength; int commentSuffixLength = commentRange.suffixLength; Pattern pattern = indexPattern.getPattern(); if (pattern != null) { ProgressManager.checkCanceled(); CharSequence input = StringPattern.newBombedCharSequence(new CharSequenceSubSequence(chars, commentStart - commentPrefixLength, commentEnd + commentSuffixLength)); Matcher matcher = pattern.matcher(input); while (true) { boolean found = matcher.find(); if (!found) break; int suffixStartOffset = input.length() - commentSuffixLength; int start = fitToRange(matcher.start(), commentPrefixLength, suffixStartOffset) + commentStart - commentPrefixLength; int end = fitToRange(matcher.end(), commentPrefixLength, suffixStartOffset) + commentStart - commentPrefixLength; if (start != end) { if ((range == null || range.getStartOffset() <= start && end <= range.getEndOffset()) && !matches.contains(start)) { List<TextRange> additionalRanges = multiLine ? findContinuation(start, chars, allIndexPatterns, commentRanges, commentNum) : Collections.emptyList(); if (range != null && !additionalRanges.isEmpty() && additionalRanges.get(additionalRanges.size() - 1).getEndOffset() > range.getEndOffset()) { continue; } matches.add(start); IndexPatternOccurrence occurrence = new IndexPatternOccurrenceImpl(file, start, end, indexPattern, additionalRanges); if (!consumer.process(occurrence)) { return false; } } } ProgressManager.checkCanceled(); } } return true; }