Function: web-mode-rsf-balanced
web-mode-rsf-balanced is a natively compiled function defined in
web-mode.el.
Signature
(web-mode-rsf-balanced REGEXP-OPEN REGEXP-CLOSE &optional LIMIT NOERROR)
Source Code
;; Defined in /nix/store/2qgnz1rp30nzfz6w0apx4kdm14if1bbs-emacs-packages-deps/share/emacs/site-lisp/elpa/web-mode-20260831.219/web-mode.el
;;---- SEARCH ------------------------------------------------------------------
(defun web-mode-rsf-balanced (regexp-open regexp-close &optional limit noerror)
(unless noerror (setq noerror t))
(let ((continue t)
(level 1)
(pos (point))
ret
(regexp (concat regexp-open "\\|" regexp-close)))
(while continue
(setq ret (re-search-forward regexp limit noerror))
(cond
((null ret)
(setq continue nil)
)
(t
(if (string-match-p regexp-open (match-string-no-properties 0))
(setq level (1+ level))
(setq level (1- level)))
(when (< level 1)
(setq continue nil)
)
) ;t
) ;cond
) ;while
(when (not (= level 0)) (goto-char pos))
ret))