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

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

[nongnu] elpa/raku-mode 385ed1d54a 155/253: pull regexes up into documen


From: ELPA Syncer
Subject: [nongnu] elpa/raku-mode 385ed1d54a 155/253: pull regexes up into documents variables, add index of classes, update regexes a bit (no longer show sub signatures)
Date: Sat, 29 Jan 2022 08:28:52 -0500 (EST)

branch: elpa/raku-mode
commit 385ed1d54ac6fe1cc75e163cefab271cb369d510
Author: Tom Browder <tom.browder@gmail.com>
Commit: Tom Browder <tom.browder@gmail.com>

    pull regexes up into documents variables, add index of classes, update 
regexes a bit (no longer show sub signatures)
---
 perl6-imenu.el | 46 +++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 41 insertions(+), 5 deletions(-)

diff --git a/perl6-imenu.el b/perl6-imenu.el
index 55a9477afe..9681820e56 100644
--- a/perl6-imenu.el
+++ b/perl6-imenu.el
@@ -1,12 +1,48 @@
 ;;; perl6-imenu.el --- Imenu support Perl 6 -*- lexical-binding: t; -*-
 
 ;; Imenu functions and variables are defined here.
+
+;; TODO: tighten regexes to distinguish correct naming for Perl 6
+;; vs. NQP (make a minor mode?)
+
+;; Regex definitions:
+(defvar perl6-vars-regex
+  (concat
+   "^\\s-*"                      ; leading ws allowed
+   "\\(?:my\\|our\\)\\s-+"       ; scope of var, followed by mandatory ws
+   "\\("                         ; start capture group 1 for the var name
+        "\\(?:\\$\\|@\\|%\\)"    ;   sigil for type of var
+        "\\(?:[-_[:alnum:]]+\\)" ;   the var name ends with ws
+   "\\)"                         ; end of capture group 1
+   ))
+
+(defvar perl6-subs-regex
+  (concat
+    "^\\s-*"                      ; leading ws allowed
+    "\\(?:my\\s-+\\|our\\s-+\\)?" ; optional specific scope followed by at 
least one space
+        ; must have one of the five type identifiers followed by at least one 
space:
+    
"\\(?:multi\\s-+sub\\|multi\\s-+method\\|sub\\|method\\|multi\\|proto\\)\\s-+"
+    "\\([-_[:alnum:]]+\\)"        ; the capture group of the sub name
+   ))
+
+(defvar perl6-classes-regex
+  (concat
+    "^\\s-*"                      ; leading ws allowed
+        ; must have one of the four type identifiers followed by at least one 
space:
+    "class\\s-+"
+    "\\([-_[:alnum:]]+\\)"                   ; the capture group of the sub 
name
+    ;"[\\n\\s\\-{]+"             ; ended by whitespace or an opening curly 
brace'
+   ))
+
 (defvar perl6-imenu-generic-expression
-      '(
-        ;; the names are in reverse desired order since they are evaluated 
here last first
-        ("Variables" 
"^\\s-*\\(?:my\\|our\\)\\s-+\\(\\(?:\\$\\|@\\|%\\)\\(?:[_[:alnum:]]+\\)\\)" 1)
-        ("Subs/Methods" 
"^\\s-*\\(?:my\\s-+\\|our\\s-+\\)?\\(?:multi\\s-+sub\\|multi\\s-+method\\|sub\\|method\\|multi\\)\\s-+\\(.+)\\)"
 1)
-        )
+  `(
+    ;; the names are in reverse desired order since they are evaluated here 
last first
+    ;("Variables" 
"^\\s-*\\(?:my\\|our\\)\\s-+\\(\\(?:\\$\\|@\\|%\\)\\(?:[_[:alnum:]]+\\)\\)" 1)
+    ("Classes" ,perl6-classes-regex 1)
+    ("Variables" ,perl6-vars-regex 1)
+    ;;("Subs/Methods" 
"^\\s-*\\(?:my\\s-+\\|our\\s-+\\)?\\(?:multi\\s-+sub\\|multi\\s-+method\\|sub\\|method\\|multi\\)\\s-+\\(.+)\\)"
 1)
+    ("Subs/Methods" ,perl6-subs-regex 1)
+    )
       "Define interesting points in the Perl 6 buffer for `imenu'.
 
 This is used to set `imenu-generic-expression' when Perl 6 mode is



reply via email to

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