Function: dune-smie-rules

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

Signature

(dune-smie-rules KIND TOKEN)

Documentation

Rules for smie-setup.

See smie-rules-function for the meaning of KIND and TOKEN.

Source Code

;; Defined in /nix/store/ai4i12v8z13z6l9irpjcha90driqcxbb-emacs-packages-deps/share/emacs/site-lisp/elpa/dune-20260803.1048/dune.el
(defun dune-smie-rules (kind token)
  "Rules for `smie-setup'.
See `smie-rules-function' for the meaning of KIND and TOKEN."
  (cond
   ((eq kind :close-all) '(column . 0))
   ((and (eq kind :after) (equal token ")"))
    (save-excursion
      (goto-char (cadr (smie-indent--parent)))
      (if (looking-at-p dune-stanzas-regex)
          '(column . 0)
        1)))
   ((eq kind :before)
    (if (smie-rule-parent-p "(")
        (save-excursion
          (goto-char (cadr (smie-indent--parent)))
          (cond
           ((looking-at-p dune-stanzas-regex) 1)
           ((looking-at-p dune-fields-regex)
            (smie-rule-parent 0))
           ((smie-rule-sibling-p) (cons 'column (current-column)))
           (t (cons 'column (current-column)))))
      '(column . 0)))
   ((eq kind :list-intro)
    nil)
   (t 1)))