Function: c-ts-mode--emacs-set-ranges
c-ts-mode--emacs-set-ranges is a byte-compiled function defined in
c-ts-mode.el.gz.
Signature
(c-ts-mode--emacs-set-ranges BEG END)
Documentation
Set ranges for the C parser to skip some FOR_EACH_* macros.
BEG and END are described in treesit-range-rules.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/c-ts-mode.el.gz
(defun c-ts-mode--emacs-set-ranges (beg end)
"Set ranges for the C parser to skip some FOR_EACH_* macros.
BEG and END are described in `treesit-range-rules'."
(let* ((c-parser (treesit-parser-create 'c))
(old-ranges c-ts-mode--for-each-tail-ranges)
(new-ranges (treesit-query-range
'emacs-c c-ts-mode--emacs-c-range-query beg end))
(set-ranges (treesit--clip-ranges
(treesit--merge-ranges
old-ranges new-ranges beg end)
(point-min) (point-max)))
(reversed-ranges (c-ts-mode--reverse-ranges
set-ranges (point-min) (point-max))))
(setq-local c-ts-mode--for-each-tail-ranges set-ranges)
(treesit-parser-set-included-ranges c-parser reversed-ranges)))