Function: c-ts-mode--reverse-ranges
c-ts-mode--reverse-ranges is a byte-compiled function defined in
c-ts-mode.el.gz.
Signature
(c-ts-mode--reverse-ranges RANGES BEG END)
Documentation
Reverse RANGES and return the new ranges between BEG and END.
Positions that were included in RANGES are not in the returned ranges, and vice versa.
Return nil if RANGES is nil. This way, passing the returned
ranges to treesit-parser-set-included-ranges will make the
parser parse the whole buffer.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/c-ts-mode.el.gz
(defun c-ts-mode--reverse-ranges (ranges beg end)
"Reverse RANGES and return the new ranges between BEG and END.
Positions that were included in RANGES are not in the returned
ranges, and vice versa.
Return nil if RANGES is nil. This way, passing the returned
ranges to `treesit-parser-set-included-ranges' will make the
parser parse the whole buffer."
(if (null ranges)
nil
(let ((new-ranges nil)
(prev-end beg))
(dolist (range ranges)
(when (< prev-end (car range))
(push (cons prev-end (car range)) new-ranges))
(setq prev-end (cdr range)))
(when (< prev-end end)
(push (cons prev-end end) new-ranges))
(nreverse new-ranges))))