Function: c-ts-mode--syntax-propertize

c-ts-mode--syntax-propertize is a byte-compiled function defined in c-ts-mode.el.gz.

Signature

(c-ts-mode--syntax-propertize BEG END)

Documentation

Apply syntax text property to template delimiters between BEG and END.

< and > are usually punctuation, e.g., in ->. But when used for
templates, they should be considered pairs.

This function checks for < and > in the changed RANGES and applies appropriate text property to alter the syntax of template delimiters < and >'s.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/c-ts-mode.el.gz
(defun c-ts-mode--syntax-propertize (beg end)
  "Apply syntax text property to template delimiters between BEG and END.

< and > are usually punctuation, e.g., in ->.  But when used for
templates, they should be considered pairs.

This function checks for < and > in the changed RANGES and applies
appropriate text property to alter the syntax of template
delimiters < and >'s."
  (goto-char beg)
  (while (re-search-forward (rx (or "<" ">")) end t)
    (pcase (treesit-node-type
            (treesit-node-parent
             (treesit-node-at (match-beginning 0))))
      ("template_argument_list"
       (put-text-property (match-beginning 0)
                          (match-end 0)
                          'syntax-table
                          (pcase (char-before)
                            (?< '(4 . ?>))
                            (?> '(5 . ?<))))))))