boolean (int position, CharSequence myBuffer, @Nullable TokenInfo tokenInfo) { int index = 0; int offset = position; String longestKeyword = null; IElementType longestKeywordType = null; while (offset < myBuffer.length()) { char c = myBuffer.charAt(offset++); int nextIndex = myTrie.findSubNode(index, myIgnoreCase ? Character.toUpperCase(c) : c); if (nextIndex == 0) { break; } index = nextIndex; if (myHashCodes.contains(index) && isWordEnd(offset, myBuffer)) { String keyword = myBuffer.subSequence(position, offset).toString(); String testKeyword = myIgnoreCase ? StringUtil.toUpperCase(keyword) : keyword; for (int i = 0; i < CustomHighlighterTokenType.KEYWORD_TYPE_COUNT; i++) { if (myKeywordSets.get(i).contains(testKeyword)) { longestKeyword = testKeyword; longestKeywordType = getToken(i); break; } } } } if (longestKeyword != null && tokenInfo != null) { tokenInfo.updateData(position, position + longestKeyword.length(), longestKeywordType); } return longestKeyword != null; }