Function: tuareg--syntax-quotation

tuareg--syntax-quotation is a natively compiled function defined in tuareg.el.

Signature

(tuareg--syntax-quotation END)

Source Code

;; Defined in /nix/store/6mbh851dhnag8f92qfrlh9ckldzwf6c6-emacs-packages-deps/share/emacs/site-lisp/elpa/tuareg-20260626.936/tuareg.el
(defun tuareg--syntax-quotation (end)
  (let ((ppss (syntax-ppss)))
    (when (eq t (nth 3 ppss))
      (pcase (char-after (nth 8 ppss))
        (`?<
         ;; We're indeed inside a quotation.
         (when (re-search-forward ">>" end 'move)
           (put-text-property (1- (point)) (point)
                              'syntax-table (string-to-syntax "|"))))
        (`?\{
         ;; We're inside a quoted string
         ;; https://v2.ocaml.org/manual/extn.html#sec244
         (let ((id (save-excursion
                     (goto-char (1+ (nth 8 ppss)))
                     (buffer-substring (point)
                                       (progn (skip-chars-forward "[:lower:]_")
                                              (point))))))
           (when (search-forward (concat "|" id "}") end 'move)
             (put-text-property (1- (point)) (point)
                                'syntax-table (string-to-syntax "|")))))
        (c (error "Unexpected char '%c' starting delimited string" c))))))