void (final ScanWordProcessor processor, final CharSequence chars, final char @Nullable [] charArray, final int startOffset, final int endOffset, final boolean mayHaveEscapes) { int index = startOffset; final boolean hasArray = charArray != null; ScanWordsLoop: while (true) { while (true) { if (index >= endOffset) break ScanWordsLoop; final char c = hasArray ? charArray[index] : chars.charAt(index); if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || (Character.isJavaIdentifierStart(c) && c != '$')) { break; } index++; if (mayHaveEscapes && c == '\\') index++; //the next symbol is for escaping } int index1 = index; while (true) { index++; if (index >= endOffset) break; final char c = hasArray ? charArray[index] : chars.charAt(index); if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')) continue; if (!Character.isJavaIdentifierPart(c) || c == '$') break; } if (index - index1 > 100) continue; // Strange limit but we should have some! processor.run(chars, charArray, index1, index); } }