Function: c-ts-mode--for-each-tail-body-matcher
c-ts-mode--for-each-tail-body-matcher is a byte-compiled function
defined in c-ts-mode.el.gz.
Signature
(c-ts-mode--for-each-tail-body-matcher N P BOL &rest _)
Documentation
A matcher that matches the first line after a FOR_EACH_* macro.
For BOL see treesit-simple-indent-rules.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/c-ts-mode.el.gz
;;; Support for FOR_EACH_* macros
;;
;; FOR_EACH_TAIL, FOR_EACH_TAIL_SAFE, FOR_EACH_FRAME etc., followed by
;; an unbracketed body will mess up the parser, which parses the thing
;; as a function declaration. We "fix" it by adding a shadow parser
;; with the tag `for-each'. We use this parser to find each
;; FOR_EACH_* macro with a unbracketed body, and set the ranges of the
;; default C parser so that it skips those FOR_EACH_*'s. Note that we
;; only ignore FOR_EACH_*'s with a unbracketed body. Those with a
;; bracketed body parse more or less fine.
;;
;; In the meantime, we have a special fontification rule for
;; FOR_EACH_* macros with a bracketed body that removes any applied
;; fontification (which are wrong anyway), to keep them consistent
;; with the skipped FOR_EACH_* macros (which have no fontification).
;; The rule is in 'emacs-devel' feature.
(defun c-ts-mode--for-each-tail-body-matcher (_n _p bol &rest _)
"A matcher that matches the first line after a FOR_EACH_* macro.
For BOL see `treesit-simple-indent-rules'."
(when c-ts-mode-emacs-sources-support
(save-excursion
(goto-char bol)
(forward-line -1)
(skip-chars-forward " \t")
(looking-at c-ts-mode--for-each-tail-regexp))))