Function: smie--opener/closer-at-point
smie--opener/closer-at-point is a byte-compiled function defined in
smie.el.gz.
Signature
(smie--opener/closer-at-point)
Documentation
Return (OPENER TOKEN START END) or nil.
OPENER is non-nil if TOKEN is an opener and nil if it's a closer.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/smie.el.gz
(defun smie--opener/closer-at-point ()
"Return (OPENER TOKEN START END) or nil.
OPENER is non-nil if TOKEN is an opener and nil if it's a closer."
(let* ((start (point))
;; Move to a previous position outside of a token.
(_ (funcall smie-backward-token-function))
;; Move to the end of the token before point.
(btok (funcall smie-forward-token-function))
(bend (point)))
(cond
;; Token before point is a closer?
((and (>= bend start) (rassoc btok smie-closer-alist))
(funcall smie-backward-token-function)
(when (< (point) start)
(prog1 (list nil btok (point) bend)
(goto-char bend))))
;; Token around point is an opener?
((and (> bend start) (assoc btok smie-closer-alist))
(funcall smie-backward-token-function)
(when (<= (point) start) (list t btok (point) bend)))
((<= bend start)
(let ((atok (funcall smie-forward-token-function))
(aend (point)))
(cond
((< aend start) nil) ;Hopefully shouldn't happen.
;; Token after point is a closer?
((assoc atok smie-closer-alist)
(funcall smie-backward-token-function)
(when (<= (point) start)
(list t atok (point) aend)))))))))