Function: python--treesit-syntax-propertize

python--treesit-syntax-propertize is a byte-compiled function defined in python.el.gz.

Signature

(python--treesit-syntax-propertize START END)

Documentation

Propertize triple-quote strings between START and END.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/python.el.gz
(defun python--treesit-syntax-propertize (start end)
  "Propertize triple-quote strings between START and END."
  (save-excursion
    (goto-char start)
    (while (re-search-forward (rx (or "\"\"\"" "'''")) end t)
      (let ((node (treesit-node-at (- (point) 3))))
        ;; Handle triple-quoted strings.
        (pcase (treesit-node-type node)
          ("string_start"
           (put-text-property (1- (point)) (point)
                              'syntax-table (string-to-syntax "|")))
          ("string_end"
           (put-text-property (- (point) 3) (- (point) 2)
                              'syntax-table (string-to-syntax "|"))))))))