void (@NotNull CharSequence fileText, @NotNull Processor<? super WordOccurrence> processor) { if (myLexer == null) { myLexer = new GroovyLexer(); } myLexer.start(fileText); WordOccurrence occurrence = null; // shared occurrence while (myLexer.getTokenType() != null) { final IElementType type = myLexer.getTokenType(); if (type == GroovyTokenTypes.mIDENT || TokenSets.KEYWORDS.contains(type)) { if (occurrence == null) occurrence = new WordOccurrence(fileText,myLexer.getTokenStart(),myLexer.getTokenEnd(), WordOccurrence.Kind.CODE); else occurrence.init(fileText,myLexer.getTokenStart(),myLexer.getTokenEnd(), WordOccurrence.Kind.CODE); if (!processor.process(occurrence)) return; } else if (TokenSets.COMMENT_SET.contains(type)) { if (!stripWords(processor, fileText,myLexer.getTokenStart(),myLexer.getTokenEnd(), WordOccurrence.Kind.COMMENTS, occurrence)) return; } else if (TokenSets.STRING_LITERALS.contains(type)) { if (!stripWords(processor, fileText, myLexer.getTokenStart(), myLexer.getTokenEnd(), WordOccurrence.Kind.LITERALS, occurrence)) { return; } if (type == STRING_SQ || type == STRING_TSQ) { if (!stripWords(processor, fileText, myLexer.getTokenStart(),myLexer.getTokenEnd(),WordOccurrence.Kind.CODE, occurrence)) return; } } else { if (!stripWords(processor, fileText, myLexer.getTokenStart(), myLexer.getTokenEnd(), null, occurrence)) { return; } } myLexer.advance(); } }