Function: ruby-ts--statement-ancestor

ruby-ts--statement-ancestor is a byte-compiled function defined in ruby-ts-mode.el.gz.

Signature

(ruby-ts--statement-ancestor NODE &rest _)

Documentation

Return the statement ancestor of NODE if any.

A statement is defined as a child of a statement container where a statement container is a node that matches ruby-ts--statement-container-regexp.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/ruby-ts-mode.el.gz
(defun ruby-ts--statement-ancestor (node &rest _)
  "Return the statement ancestor of NODE if any.
A statement is defined as a child of a statement container where
a statement container is a node that matches
`ruby-ts--statement-container-regexp'."
  (let* ((statement node)
         (parent (treesit-node-parent statement)))
    (while (and parent
                statement
                (not (string-match-p ruby-ts--statement-container-regexp
                                     (treesit-node-type parent))))
      (setq statement parent
            parent (treesit-node-parent parent)))
    statement))