Function: c-ts-mode--else-heuristic

c-ts-mode--else-heuristic is a byte-compiled function defined in c-ts-mode.el.gz.

Signature

(c-ts-mode--else-heuristic NODE PARENT BOL &rest _)

Documentation

Heuristic matcher for when "else" is followed by a closing bracket.

PARENT is NODE's parent, BOL is the beginning of non-whitespace characters of the current line.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/c-ts-mode.el.gz
(defun c-ts-mode--else-heuristic (node parent bol &rest _)
  "Heuristic matcher for when \"else\" is followed by a closing bracket.
PARENT is NODE's parent, BOL is the beginning of non-whitespace
characters of the current line."
  (and (null node)
       (save-excursion
         (forward-line -1)
         (looking-at (rx (* whitespace) "else" (* whitespace) eol)))
       (let ((next-node (treesit-node-first-child-for-pos parent bol)))
         (equal (treesit-node-type next-node) "}"))))