public static boolean isLexemeBoundary(@NotNull Editor editor, int offset) {
    if (offset <= 0 || offset >= editor.getDocument().getTextLength() ||
        DocumentUtil.isInsideSurrogatePair(editor.getDocument(), offset) ||
        isBetweenWhitespaces(editor.getDocument().getCharsSequence(), offset)) {
      return false;
    }
    EditorHighlighter highlighter = editor.getHighlighter();
    HighlighterIterator it = highlighter.createIterator(offset);
    return retreatTokenOnBoundary(it, editor.getDocument().getCharsSequence(), offset);
  }
public static boolean isLexemeBoundary(@NotNull Editor editor, int offset)