branch: master
commit f870598f1c7400e8f0fe37e5c83cd9e7f3d6580b
Author: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com>
Commit: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com>

    Fix infinite loop when parsing let.
---
 context-coloring.el           |    5 ++++-
 test/context-coloring-test.el |    7 ++++---
 test/fixtures/let.el          |    5 +++--
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/context-coloring.el b/context-coloring.el
index ffed467..753f4ca 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -555,7 +555,10 @@ after its own initializer is parsed."
             (= syntax-code context-coloring-SYMBOL-CODE))
         (context-coloring-elisp-parse-bindable
          (lambda (var)
-           (push var varlist)))))
+           (push var varlist))))
+       (t
+        ;; Ignore artifacts.
+        (context-coloring-elisp-forward-sexp)))
       (when (eq type 'let*)
         (context-coloring-elisp-add-variable (pop varlist)))
       (context-coloring-elisp-forward-sws))
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index bd37b3b..500f57e 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -1128,15 +1128,16 @@ ssssssssssss0"))
   (lambda ()
     (context-coloring-test-assert-coloring "
 1111 11
-      cccccccccc
-      11 sss1
       11 01
       11 00001
       11 2222 22
                22 02
                22 000022
            2222 2 2 2 00002211
-  1111 1 1 1 000011")))
+  1111 1 1 1 000011
+
+1111 cc ccccccc
+    111 sss11")))
 
 (context-coloring-test-deftest-emacs-lisp let*
   (lambda ()
diff --git a/test/fixtures/let.el b/test/fixtures/let.el
index ac3de2d..85bf90e 100644
--- a/test/fixtures/let.el
+++ b/test/fixtures/let.el
@@ -1,6 +1,4 @@
 (let (a
-      ;; comment
-      (s "s")
       (b a)
       (c free)
       (d (let (a
@@ -8,3 +6,6 @@
                (c free))
            (and a b c free))))
   (and a b c free))
+
+(let ;; comment
+    (_a "s"))

Reply via email to