[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/julia-mode c9e35bdb85 1/3: Fix const definition regex to m
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/julia-mode c9e35bdb85 1/3: Fix const definition regex to match symbols with underscores etc. |
Date: |
Wed, 12 Jul 2023 13:00:09 -0400 (EDT) |
branch: elpa/julia-mode
commit c9e35bdb85daa013ae1fec4b1ffa6d376c22e986
Author: Adam Beckmeyer <adam_gpg@thebeckmeyers.xyz>
Commit: Adam Beckmeyer <adam_gpg@thebeckmeyers.xyz>
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..305c16e6a2 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 anychar) symbol-end)))
+ (zero-or-more space)
+ "="))
(defconst julia-type-annotation-regex
(rx "::" (0+ space) (group (1+ (or word (syntax symbol))))))