Function: smie-debug--prec2-cycle
smie-debug--prec2-cycle is a byte-compiled function defined in
smie.el.gz.
Signature
(smie-debug--prec2-cycle CSTS)
Documentation
Return a cycle in CSTS, assuming there's one.
CSTS is a list of pairs representing arcs in a graph.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/smie.el.gz
(defun smie-debug--prec2-cycle (csts)
"Return a cycle in CSTS, assuming there's one.
CSTS is a list of pairs representing arcs in a graph."
;; A PATH is of the form (START . REST) where REST is a reverse
;; list of nodes through which the path goes.
(let ((paths (mapcar (lambda (pair) (list (car pair) (cdr pair))) csts))
(cycle nil))
(while (null cycle)
(dolist (path (prog1 paths (setq paths nil)))
(dolist (cst csts)
(when (eq (car cst) (nth 1 path))
(if (eq (cdr cst) (car path))
(setq cycle path)
(push (cons (car path) (cons (cdr cst) (cdr path)))
paths))))))
(cons (car cycle) (nreverse (cdr cycle)))))