boolean (final Processor<? super WordOccurrence> processor, final CharSequence tokenText, int from, int to, final WordOccurrence.Kind kind, @NotNull WordOccurrence occurrence, boolean mayHaveFileRefs ) { // This code seems strange but it is more effective as Character.isJavaIdentifier_xxx_ is quite costly operation due to unicode int index = from; ScanWordsLoop: while (true) { while (true) { if (index == to) break ScanWordsLoop; char c = tokenText.charAt(index); if (isAsciiIdentifierPart(c) || Character.isJavaIdentifierStart(c)) { break; } index++; } int wordStart = index; while (true) { index++; if (index == to) break; char c = tokenText.charAt(index); if (isAsciiIdentifierPart(c)) continue; if (!Character.isJavaIdentifierPart(c)) break; } int wordEnd = index; occurrence.init(tokenText, wordStart, wordEnd, kind); if (!processor.process(occurrence)) return false; if (mayHaveFileRefs) { occurrence.init(tokenText, wordStart, wordEnd, WordOccurrence.Kind.FOREIGN_LANGUAGE); if (!processor.process(occurrence)) return false; } } return true; }