emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/julia-mode 7a8c868e0d 3/3: Merge pull request #197 from no


From: ELPA Syncer
Subject: [nongnu] elpa/julia-mode 7a8c868e0d 3/3: Merge pull request #197 from non-Jedi/fix-const-regexp
Date: Wed, 12 Jul 2023 13:00:09 -0400 (EDT)

branch: elpa/julia-mode
commit 7a8c868e0d3e51ba4a2c621ee22ca9599e0e4bbb
Merge: 89e5e005b6 5370850474
Author: Tamas K. Papp <tkpapp@gmail.com>
Commit: GitHub <noreply@github.com>

    Merge pull request #197 from non-Jedi/fix-const-regexp
    
    Fix const definition regex to match symbols with underscores etc.
---
 julia-mode-tests.el | 10 ++++++++++
 julia-mode.el       |  8 ++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/julia-mode-tests.el b/julia-mode-tests.el
index 5c4d8832f9..3ec60c8c52 100644
--- a/julia-mode-tests.el
+++ b/julia-mode-tests.el
@@ -758,6 +758,16 @@ var = func(begin
     (julia--should-font-lock string 11 nil) ; =
     ))
 
+(ert-deftest julia--test-const-def-font-lock-underscores ()
+  (let ((string "@macro const foo_bar = \"bar\""))
+    (julia--should-font-lock string 8 font-lock-keyword-face) ; const
+    (julia--should-font-lock string 12 font-lock-keyword-face) ; const
+    (julia--should-font-lock string 14 font-lock-variable-name-face) ; foo
+    (julia--should-font-lock string 17 font-lock-variable-name-face) ; _
+    (julia--should-font-lock string 20 font-lock-variable-name-face) ; bar
+    (julia--should-font-lock string 22 nil) ; =
+    ))
+
 ;;; Movement
 (ert-deftest julia--test-beginning-of-defun-assn-1 ()
   "Point moves to beginning of single-line assignment function."
diff --git a/julia-mode.el b/julia-mode.el
index 47c325e2d4..7e65daa096 100644
--- a/julia-mode.el
+++ b/julia-mode.el
@@ -290,10 +290,10 @@ partial match for LaTeX completion, or `nil' when not 
applicable."
 
 (defconst julia-const-def-regex
   (rx
-   bol (zero-or-more space)
-   "const" space
-   (group (one-or-more alnum)) (zero-or-more space)
-   "=" (not (any "="))))
+   symbol-start "const" (1+ space)
+   (group (minimal-match (seq symbol-start (one-or-more anything) symbol-end)))
+   (zero-or-more space)
+   "="))
 
 (defconst julia-type-annotation-regex
   (rx "::" (0+ space) (group (1+ (or word (syntax symbol))))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]