Function: rust-ts-mode--syntax-propertize
rust-ts-mode--syntax-propertize is a byte-compiled function defined in
rust-ts-mode.el.gz.
Signature
(rust-ts-mode--syntax-propertize BEG END)
Documentation
Apply syntax properties to special characters between BEG and END.
Apply syntax properties to various special characters with contextual meaning between BEG and END.
The apostrophe ' should be treated as string when used for char literals.
< and > are usually punctuation, e.g., as greater/less-than. But
when used for types, they should be considered pairs.
This function checks for < and > in the changed RANGES and apply appropriate text property to alter the syntax of template delimiters < and >'s.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/rust-ts-mode.el.gz
(defun rust-ts-mode--syntax-propertize (beg end)
"Apply syntax properties to special characters between BEG and END.
Apply syntax properties to various special characters with
contextual meaning between BEG and END.
The apostrophe \\=' should be treated as string when used for char literals.
< and > are usually punctuation, e.g., as greater/less-than. But
when used for types, they should be considered pairs.
This function checks for < and > in the changed RANGES and apply
appropriate text property to alter the syntax of template
delimiters < and >'s."
(goto-char beg)
(while (search-forward "'" end t)
(when (string-equal "char_literal"
(treesit-node-type
(treesit-node-at (match-beginning 0))))
(put-text-property (match-beginning 0) (match-end 0)
'syntax-table (string-to-syntax "\""))))
(goto-char beg)
(while (re-search-forward (rx (or "<" ">")) end t)
(pcase (treesit-node-type
(treesit-node-parent
(treesit-node-at (match-beginning 0))))
((or "type_arguments" "type_parameters")
(put-text-property (match-beginning 0)
(match-end 0)
'syntax-table
(pcase (char-before)
(?< '(4 . ?>))
(?> '(5 . ?<))))))))