From b98247a43d879e44442950721dbcbdc32eecbaff Mon Sep 17 00:00:00 2001 From: Brandon Frohs <bfrohs@gmail.com> Date: Sun, 2 Sep 2012 22:53:30 -0400 Subject: [PATCH] [clojure mode] Check if +/- is immediately followed by digit before marking as leading sign Closes #782 Correct highlighting for the following code snippet should highlight the + as an operator, and each 2 as a number (taken from http://clojuredocs.org/clojure_core/1.2.0/clojure.test/deftest) (is (= 4 (+ 2 2))) --- mode/clojure/clojure.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mode/clojure/clojure.js b/mode/clojure/clojure.js index ce389927..84f6073f 100644 --- a/mode/clojure/clojure.js +++ b/mode/clojure/clojure.js @@ -70,7 +70,7 @@ CodeMirror.defineMode("clojure", function (config, mode) { } // leading sign - if ( ch == '+' || ch == '-' ) { + if ( ( ch == '+' || ch == '-' ) && ( tests.digit.test(stream.peek()) ) ) { stream.eat(tests.sign); ch = stream.next(); } -- GitLab