branch: elpa/julia-mode commit 6e9e60b2c75b68d379428a45b129c86de0967a2e Author: Adam B <adam_...@thebeckmeyers.xyz> Commit: GitHub <nore...@github.com>
Fix forloop matching on == instead of = (#105) Fix #104 --- julia-mode-tests.el | 8 +++++++- julia-mode.el | 9 +++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/julia-mode-tests.el b/julia-mode-tests.el index 09b8e13..9187731 100644 --- a/julia-mode-tests.el +++ b/julia-mode-tests.el @@ -490,7 +490,13 @@ end") (julia--should-font-lock string 10 font-lock-keyword-face)) (let ((string "(i for i in 1:10)")) (julia--should-font-lock string 4 font-lock-keyword-face) - (julia--should-font-lock string 10 font-lock-keyword-face))) + (julia--should-font-lock string 10 font-lock-keyword-face)) + (let ((string "[i for i ∈ 1:15 if w(i) == 15]")) + (julia--should-font-lock string 4 font-lock-keyword-face) + (julia--should-font-lock string 10 font-lock-keyword-face) + (julia--should-font-lock string 17 font-lock-keyword-face) + (julia--should-font-lock string 25 nil) + (julia--should-font-lock string 26 nil))) ;;; Movement (ert-deftest julia--test-beginning-of-defun-assn-1 () diff --git a/julia-mode.el b/julia-mode.el index 9f7234d..57c2874 100644 --- a/julia-mode.el +++ b/julia-mode.el @@ -200,8 +200,13 @@ ].* \\(in\\)\\(\\s-\\|$\\)+") (defconst julia--forloop-=-regex - "for +.*[^ -].*\\(=\\|∈\\)") + (rx "for" + (1+ ? ) + ;; expression can't end and no newline before = portion of forloop. + (1+ (not (any ?\n ?\; ?=))) + (group (any ?= ?∈)) + ;; don't want to match on == expression instead of =. + (not (any ?=)))) (defconst julia-ternary-regex " +\\(\\?\\)[