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

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

[nongnu] elpa/julia-mode 6b43ca61ed 05/14: imenu regex -> rx


From: ELPA Syncer
Subject: [nongnu] elpa/julia-mode 6b43ca61ed 05/14: imenu regex -> rx
Date: Wed, 12 Jul 2023 04:00:12 -0400 (EDT)

branch: elpa/julia-mode
commit 6b43ca61eda1889bf4701c1dc3a9ce5c6bb50631
Author: Malte Sandstede <malte@sandstede.com>
Commit: GitHub <noreply@github.com>

    imenu regex -> rx
---
 julia-mode.el | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 61 insertions(+), 7 deletions(-)

diff --git a/julia-mode.el b/julia-mode.el
index 3d1fb9aa50..4e994aa746 100644
--- a/julia-mode.el
+++ b/julia-mode.el
@@ -700,15 +700,69 @@ Return nil if point is not in a function, otherwise 
point."
       (end-of-line)
       (point))))
 
+(defconst julia-imenu-private-multiline-fn
+  (rx-to-string
+   '(seq bol
+         (zero-or-more space)
+         (zero-or-one "@" (one-or-more alnum) space)
+         "function"
+         (one-or-more space)
+         (group "_" (minimal-match (zero-or-more anything)))
+         (or (seq (one-or-more space) "end") eol))))
+
+(defconst julia-imenu-public-multiline-fn
+  (rx-to-string
+   '(seq bol
+         (zero-or-more space)
+         (zero-or-one "@" (one-or-more alnum) space)
+         "function"
+         (one-or-more space)
+         (group (not (any "_")) (zero-or-more not-newline)))))
+
+(defconst julia-imenu-private-singleline-fn
+  (rx-to-string
+   '(seq bol
+         (zero-or-more space)
+         (zero-or-one "@" (one-or-more alnum) space)
+         (group "_"
+                (one-or-more (any "!" "." "_" alnum))
+                "(" (minimal-match (zero-or-more not-newline)) ")")
+         (minimal-match (zero-or-more not-newline)) space "=" space)))
+
+(defconst julia-imenu-public-singleline-fn
+  (rx-to-string
+   '(seq line-start
+         (zero-or-more space)
+         (zero-or-one "@" (one-or-more alnum) space)
+         (group (any "!" "." alnum)
+                (zero-or-more (any "!" "." "_" alnum))
+                "(" (minimal-match (zero-or-more not-newline)) ")")
+         (minimal-match (zero-or-more not-newline)) space "=" space)))
+
+(defconst julia-imenu-const
+  (rx-to-string
+   '(seq bol
+         (zero-or-more space)
+         "const"
+         space
+         (group (one-or-more alnum))
+         (zero-or-more space) "=" space)))
+
+(defconst julia-imenu-struct
+  (rx-to-string
+   '(seq bol
+         (zero-or-more space)
+         (group (zero-or-one "mutable" space) "struct" space (one-or-more 
alnum)))))
+
 ;;; IMENU
-(defvar julia-imenu-generic-expression
+(setq julia-imenu-generic-expression
   ;; don't use syntax classes, screws egrep
-  '(("Function (_)" "^[ \t]*\\(@.+ \\)?function[ \t]+\\(_.*?\\)\\( 
+end\\|$\\)" 2)
-    ("Function (_)" "^[ \t]*\\(@.+ \\)?\\(_[!\._a-zA-Z0-9]+\(.*\).*\\) = " 2)
-    ("Function" "^[ \t]*\\(@.+ \\)?function[ \t]+\\([^_].*?\\)\\( +end\\|$\\)" 
2)
-    ("Function" "^[ \t]*\\(@.+ 
\\)?\\([!\.a-zA-Z0-9][!\._a-zA-Z0-9]*\(.*\).*\\) = " 2)
-    ("Const" "^[ \t]*const \\([^ \t\n]*\\) *= " 1)
-    ("Struct" "^[ \t]*\\(\\(mutable \\)*struct [^ \t\n]*\\)" 1)
+  `(("Function" ,julia-imenu-public-multiline-fn 1)
+    ("Function" ,julia-imenu-public-singleline-fn 1)
+    ("Function (_)" ,julia-imenu-private-multiline-fn 1)
+    ("Function (_)" ,julia-imenu-private-singleline-fn 1)
+    ("Const" ,julia-imenu-const 1)
+    ("Struct" ,julia-imenu-struct 1)
     ("Require" " *\\(\\brequire\\)(\\([^ \t\n)]*\\)" 2)
     ("Include" " *\\(\\binclude\\)(\\([^ \t\n)]*\\)" 2)
     ;; ("Classes" "^.*setClass(\\(.*\\)," 1)



reply via email to

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