void (CharSequence input, OccurrenceConsumer consumer, TodoScanningState todoScanningState) { todoScanningState.myOccurrences.clear(); for (int i = todoScanningState.myMatchers.length - 1; i >= 0; --i) { Matcher matcher = todoScanningState.myMatchers[i]; if (matcher == null) continue; matcher.reset(input); try { while (matcher.find()) { ProgressManager.checkCanceled(); int start = matcher.start(); if (start != matcher.end() && !todoScanningState.myOccurrences.contains(start)) { consumer.incTodoOccurrence(todoScanningState.myPatterns[i]); todoScanningState.myOccurrences.add(start); } } } catch (StackOverflowError error) { LOG.error(error); // do not reindex file, just ignore it } } }