Function: meson-smie-rules

meson-smie-rules is a natively compiled function defined in meson-mode.el.

Signature

(meson-smie-rules KIND TOKEN)

Documentation

Indentation rules for the SMIE engine.

See the SMIE documentation for the meaning of KIND and TOKEN arguments.

Source Code

;; Defined in /nix/store/57kn62wrv0z1jads9j9blmagdm8rh132-emacs-packages-deps/share/emacs/site-lisp/elpa/meson-mode-20240601.1647/meson-mode.el
(defun meson-smie-rules (kind token)
  "Indentation rules for the SMIE engine.
See the SMIE documentation for the meaning of KIND and TOKEN
arguments."
  (pcase (cons kind token)
    (`(:elem . basic) meson-indent-basic)
    (`(:elem . args) (- (save-excursion (beginning-of-line-text) (point)) (point)))
    (`(,_ . ",") (smie-rule-separator kind))
    (`(,(or :before :after) . "eol") (if (smie-rule-parent-p "if" "foreach" "elif" "else")
					 (smie-rule-parent meson-indent-basic)
				       (save-excursion
					 (smie-indent-forward-token)
					 (smie-backward-sexp 'halfsexp)
					 (cons 'column (current-column)))))
    (`(:list-intro . ,(or "eol" ":" "")) t) ; "" is actually "[" because that's what lexer returns
    (`(:after . ":") meson-indent-basic)
    (`(:after . ,(or "=" "+=")) meson-indent-basic)
    (`(:before . ,(or "[" "(" "{")) (if (smie-rule-hanging-p)
					(save-excursion
					  (smie-backward-sexp 'halfsexp) ; goto parent
					  (beginning-of-line-text)
					  (cons 'column (current-column)))))
    (`(:after . ,(or "[" "(" "{")) meson-indent-basic)
    (`(:before . "elif") (smie-rule-parent))
    (_ nil)))