branch: elpa/julia-mode
commit 2b15d768afcba972b54abe52902736cf0d769725
Author: nverno <[email protected]>
Commit: nverno <[email protected]>
bol
---
julia-mode-tests.el | 15 +++++++++++++++
julia-mode.el | 2 +-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/julia-mode-tests.el b/julia-mode-tests.el
index 61d1d31..92c4568 100644
--- a/julia-mode-tests.el
+++ b/julia-mode-tests.el
@@ -54,6 +54,16 @@
(should (equal (buffer-substring-no-properties (point-min) (point-max))
,to)))))
+(defmacro julia--should-font-lock (text pos face)
+ "Assert that TEXT at position POS gets font-locked with FACE in
`julia-mode'."
+ `(with-temp-buffer
+ (julia-mode)
+ (insert ,text)
+ (if (fboundp 'font-lock-ensure)
+ (font-lock-ensure (point-min) (point-max))
+ (with-no-warnings
+ (font-lock-fontify-buffer)))
+ (should (eq ,face (get-text-property ,pos 'face)))))
(ert-deftest julia--test-indent-if ()
"We should indent inside if bodies."
@@ -350,6 +360,11 @@ using Foo: bar ,
quux
notpartofit"))
+(ert-deftest julia--test-symbol-font-locking-at-bol ()
+ "Symbols get font-locked at beginning or line."
+ (julia--should-font-lock
+ ":a in keys(Dict(:a=>1))" 1 'julia-quoted-symbol-face))
+
(defun julia--run-tests ()
(interactive)
(if (featurep 'ert)
diff --git a/julia-mode.el b/julia-mode.el
index 09c302f..6f204d1 100644
--- a/julia-mode.el
+++ b/julia-mode.el
@@ -291,7 +291,7 @@ This function provides equivalent functionality, but makes
no efforts to optimis
(defconst julia-quoted-symbol-regex
;; :foo and :foo2 are valid, but :123 is not.
- (rx (or whitespace "(" "[" "," "=")
+ (rx (or bol whitespace "(" "[" "," "=")
(group ":" (or letter (syntax symbol)) (0+ (or word (syntax symbol))))))
(defconst julia-font-lock-keywords