[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master c5de861: * lisp/emacs-lisp/smie.el (smie-next-sexp): Fix bug#3825

From: Stefan Monnier
Subject: master c5de861: * lisp/emacs-lisp/smie.el (smie-next-sexp): Fix bug#38255
Date: Thu, 21 Nov 2019 18:25:04 -0500 (EST)

branch: master
commit c5de861af1da697b4481133e4f5f966e6a3fc859
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * lisp/emacs-lisp/smie.el (smie-next-sexp): Fix bug#38255
    Handle the case where the token is not in `smie-grammar`, either because
    the caller is making an error, or because it's a paren-like token that's
    not handled in the grammar but directly via the syntax tables.
 lisp/emacs-lisp/smie.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el
index f2163b2..2c2898a 100644
--- a/lisp/emacs-lisp/smie.el
+++ b/lisp/emacs-lisp/smie.el
@@ -702,7 +702,11 @@ Possible return values:
   (catch 'return
     (let ((levels
            (if (stringp halfsexp)
-               (prog1 (list (cdr (assoc halfsexp smie-grammar)))
+               (prog1 (list (or (cdr (assoc halfsexp smie-grammar))
+                                (when (string-match "\\`\\s(\\|\\s)\\(\\)\\'"
+                                                    halfsexp)
+                                  (if (match-end 1) '(0 nil) '(nil 0)))
+                                (error "Unknown token: %S" halfsexp)))
                  (setq halfsexp nil)))))
           (let* ((pos (point))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]