Function: tuareg--pattern-pre-form-fun

tuareg--pattern-pre-form-fun is a natively compiled function defined in tuareg.el.

Signature

(tuareg--pattern-pre-form-fun)

Documentation

Return the position of "->" marking the end of "fun".

Source Code

;; Defined in /nix/store/6mbh851dhnag8f92qfrlh9ckldzwf6c6-emacs-packages-deps/share/emacs/site-lisp/elpa/tuareg-20260626.936/tuareg.el
(defun tuareg--pattern-pre-form-fun ()
  "Return the position of \"->\" marking the end of \"fun\"."
  (if (tuareg--font-lock-in-string-or-comment)
      (setq tuareg--pattern-matcher-limit (point))

    (let* ((opoint (point))
           (limit (+ opoint 800))
           pos)
      (while (and
              (<= (point) limit)
              (setq pos (re-search-forward "[-({]" limit t))
              (cond
               ((or (char-equal ?\( (char-before))
                    (char-equal ?{  (char-before)))
                (backward-char)
                (if (ignore-errors (forward-list))
                    t
                  (goto-char (1- pos))
                  nil)) ; If braces are not balanced, stop.
              (t (not (char-equal ?> (char-after)))))))
      (setq tuareg--pattern-matcher-limit (point))
      ;; move the point back for the sub-matcher
      (goto-char opoint)
      (put-text-property (point) tuareg--pattern-matcher-limit
                         'font-lock-multiline t))
    tuareg--pattern-matcher-limit))