[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master f9399ea 5/9: Fix unfinished expression infinite loop.
From: |
Jackson Ray Hamilton |
Subject: |
[elpa] master f9399ea 5/9: Fix unfinished expression infinite loop. |
Date: |
Fri, 13 Nov 2015 05:39:53 +0000 |
branch: master
commit f9399eab1a78d6d309176d6bf2eff9d928feb7d2
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
Fix unfinished expression infinite loop.
---
context-coloring.el | 52 +++++++++++++++++++++++++++----------------------
test/fixtures/let.el | 2 +
2 files changed, 31 insertions(+), 23 deletions(-)
diff --git a/context-coloring.el b/context-coloring.el
index 55d57ee..3148c2d 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -493,6 +493,29 @@ For instance, the current file could be a Node.js program."
;;; Emacs Lisp colorization
+(defconst context-coloring-WORD-CODE 2)
+(defconst context-coloring-SYMBOL-CODE 3)
+(defconst context-coloring-OPEN-PARENTHESIS-CODE 4)
+(defconst context-coloring-CLOSE-PARENTHESIS-CODE 5)
+(defconst context-coloring-EXPRESSION-PREFIX-CODE 6)
+(defconst context-coloring-STRING-QUOTE-CODE 7)
+(defconst context-coloring-ESCAPE-CODE 9)
+(defconst context-coloring-COMMENT-START-CODE 11)
+(defconst context-coloring-COMMENT-END-CODE 12)
+
+(defconst context-coloring-OCTOTHORPE-CHAR (string-to-char "#"))
+(defconst context-coloring-APOSTROPHE-CHAR (string-to-char "'"))
+(defconst context-coloring-OPEN-PARENTHESIS-CHAR (string-to-char "("))
+(defconst context-coloring-COMMA-CHAR (string-to-char ","))
+(defconst context-coloring-AT-CHAR (string-to-char "@"))
+(defconst context-coloring-BACKTICK-CHAR (string-to-char "`"))
+
+(defsubst context-coloring-get-syntax-code ()
+ "Get the syntax code at point."
+ (syntax-class
+ ;; Faster version of `syntax-after':
+ (aref (syntax-table) (char-after (point)))))
+
(defsubst context-coloring-forward-sws ()
"Move forward through whitespace and comments."
(while (forward-comment 1)))
@@ -506,18 +529,18 @@ For instance, the current file could be a Node.js
program."
(defsubst context-coloring-elisp-forward-sexp ()
"Skip/ignore missing sexps, coloring comments and strings."
(let ((start (point)))
+ (when (= (context-coloring-get-syntax-code)
+ context-coloring-EXPRESSION-PREFIX-CODE)
+ ;; `forward-sexp' does not skip an unfinished expression (e.g. when the
+ ;; name of a symbol or the parentheses of a list do not follow a single
+ ;; quote).
+ (forward-char))
(condition-case nil
(forward-sexp)
(scan-error (context-coloring-forward-sws)))
(context-coloring-elisp-colorize-comments-and-strings-in-region
start (point))))
-(defsubst context-coloring-get-syntax-code ()
- "Get the syntax code at point."
- (syntax-class
- ;; Faster version of `syntax-after':
- (aref (syntax-table) (char-after (point)))))
-
(defsubst context-coloring-exact-regexp (word)
"Create a regexp matching exactly WORD."
(concat "\\`" (regexp-quote word) "\\'"))
@@ -535,23 +558,6 @@ For instance, the current file could be a Node.js program."
"\\|")
"Match symbols that can't be bound as variables.")
-(defconst context-coloring-WORD-CODE 2)
-(defconst context-coloring-SYMBOL-CODE 3)
-(defconst context-coloring-OPEN-PARENTHESIS-CODE 4)
-(defconst context-coloring-CLOSE-PARENTHESIS-CODE 5)
-(defconst context-coloring-EXPRESSION-PREFIX-CODE 6)
-(defconst context-coloring-STRING-QUOTE-CODE 7)
-(defconst context-coloring-ESCAPE-CODE 9)
-(defconst context-coloring-COMMENT-START-CODE 11)
-(defconst context-coloring-COMMENT-END-CODE 12)
-
-(defconst context-coloring-OCTOTHORPE-CHAR (string-to-char "#"))
-(defconst context-coloring-APOSTROPHE-CHAR (string-to-char "'"))
-(defconst context-coloring-OPEN-PARENTHESIS-CHAR (string-to-char "("))
-(defconst context-coloring-COMMA-CHAR (string-to-char ","))
-(defconst context-coloring-AT-CHAR (string-to-char "@"))
-(defconst context-coloring-BACKTICK-CHAR (string-to-char "`"))
-
(defsubst context-coloring-elisp-identifier-p (syntax-code)
"Check if SYNTAX-CODE is an elisp identifier constituent."
(or (= syntax-code context-coloring-WORD-CODE)
diff --git a/test/fixtures/let.el b/test/fixtures/let.el
index 04fc039..49edb50 100644
--- a/test/fixtures/let.el
+++ b/test/fixtures/let.el
@@ -9,3 +9,5 @@
(let ;; comment
("s"))
+
+(let (a '))
- [elpa] master updated (6bb5fee -> cf250b3), Jackson Ray Hamilton, 2015/11/13
- [elpa] master 52e3d07 1/9: Fix bug where empty varlists weren't parsed., Jackson Ray Hamilton, 2015/11/13
- [elpa] master f4e3f36 3/9: Add gv-letplace support., Jackson Ray Hamilton, 2015/11/13
- [elpa] master f29f06c 6/9: Use containers on Travis., Jackson Ray Hamilton, 2015/11/13
- [elpa] master de6b508 7/9: Fix bugs where spaces messed up varlists., Jackson Ray Hamilton, 2015/11/13
- [elpa] master f9399ea 5/9: Fix unfinished expression infinite loop.,
Jackson Ray Hamilton <=
- [elpa] master 4d381cb 4/9: Add macroexp-let2 support., Jackson Ray Hamilton, 2015/11/13
- [elpa] master 1a7c480 8/9: Version 7.2.0., Jackson Ray Hamilton, 2015/11/13
- [elpa] master 6bbbfff 2/9: Add license., Jackson Ray Hamilton, 2015/11/13
- [elpa] master cf250b3 9/9: Merge commit '1a7c480d1e15133b942201f5964fda5e7d74919f' from context-coloring, Jackson Ray Hamilton, 2015/11/13