private static boolean isAtomic(RegExpAtom element) {
      while (element != null) {
        if (element instanceof RegExpClosure closure) {
          if (closure.getQuantifier().isPossessive()) {
            return true;
          }
        }
        else if (element instanceof RegExpGroup group) {
          if (group.getType() == RegExpGroup.Type.ATOMIC) {
            return true;
          }
        }
        element = PsiTreeUtil.getParentOfType(element, RegExpClosure.class, RegExpGroup.class);
      }
      return false;
    }
private static boolean isAtomic(RegExpAtom element)