private static boolean hasUnexpectedSibling(PsiElement element, boolean next, boolean line) {
      final PsiElement sibling = next
                                 ? PsiTreeUtil.skipSiblingsForward(element, PsiComment.class, PsiWhiteSpace.class, RegExpSetOptions.class)
                                 : PsiTreeUtil.skipSiblingsBackward(element, PsiComment.class, PsiWhiteSpace.class, RegExpSetOptions.class);
      if (sibling == null) {
        return false;
      }
      return !line || isUnexpectedSibling(element, next, sibling);
    }
private static boolean hasUnexpectedSibling(PsiElement element, boolean next, boolean line)