Function: neocaml--doc-markup-close
neocaml--doc-markup-close is a natively compiled function defined in
neocaml.el.
Signature
(neocaml--doc-markup-close OPEN CLOSE LIMIT)
Documentation
Return the position of the CLOSE char balancing one open construct.
Scan from point up to LIMIT, treating OPEN and CLOSE (characters) as nesting delimiters and a backslash as escaping the next character. Point should be just past the opening delimiter. Return nil if the construct is unbalanced.
Source Code
;; Defined in /nix/store/ahssdx4rwzyxhyhavpn0bkznk13xrggi-emacs-packages-deps/share/emacs/site-lisp/elpa/neocaml-20260907.2015/neocaml.el
(defun neocaml--doc-markup-close (open close limit)
"Return the position of the CLOSE char balancing one open construct.
Scan from point up to LIMIT, treating OPEN and CLOSE (characters) as
nesting delimiters and a backslash as escaping the next character.
Point should be just past the opening delimiter. Return nil if the
construct is unbalanced."
(save-excursion
;; `skip-chars-forward' jumps over runs of uninteresting text at C
;; speed; only delimiters and backslashes are handled in Lisp.
(let ((skip (concat "^" (string open close) "\\\\"))
(depth 1) found)
(while (and (not found)
(progn (skip-chars-forward skip limit)
(< (point) limit)))
(let ((c (char-after)))
(cond ((eq c ?\\) (forward-char 1))
((eq c open) (setq depth (1+ depth)))
((eq c close)
(setq depth (1- depth))
(when (zerop depth) (setq found (point))))))
(forward-char 1))
found)))