[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/d-mode e809bd1 181/346: Fix imenu with conditional non-fun
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/d-mode e809bd1 181/346: Fix imenu with conditional non-function declarations |
Date: |
Sun, 29 Aug 2021 11:00:25 -0400 (EDT) |
branch: elpa/d-mode
commit e809bd14d24fd897c7abe6db8890521169095ef2
Author: Vladimir Panteleev <git@thecybershadow.net>
Commit: Vladimir Panteleev <git@thecybershadow.net>
Fix imenu with conditional non-function declarations
---
d-mode.el | 55 +++++++++++++++++++++++++++----------------------------
tests/imenu.d | 5 ++++-
2 files changed, 31 insertions(+), 29 deletions(-)
diff --git a/d-mode.el b/d-mode.el
index df72b8d..38ae8f0 100644
--- a/d-mode.el
+++ b/d-mode.el
@@ -7,7 +7,7 @@
;; Maintainer: Russel Winder <russel@winder.org.uk>
;; Vladimir Panteleev <vladimir@thecybershadow.net>
;; Created: March 2007
-;; Version: 201908262243
+;; Version: 201908262253
;; Keywords: D programming language emacs cc-mode
;; Package-Requires: ((emacs "24.3"))
@@ -475,25 +475,29 @@ Each list item should be a regexp matching a single
identifier."
(easy-menu-define d-menu d-mode-map "D Mode Commands"
(cons "D" (c-lang-const c-mode-menu d)))
+(defconst d--imenu-rx-def-start
+ '(seq
+ ;; Whitespace
+ bol
+ (zero-or-more space)
+
+ ;; Conditionals
+ (zero-or-one
+ "else"
+ (zero-or-more space))
+ (zero-or-one
+ "version"
+ (zero-or-more space)
+ "("
+ (zero-or-more space)
+ (one-or-more (any "a-zA-Z0-9_"))
+ (zero-or-more space)
+ ")"
+ (zero-or-more space))))
+
(defconst d-imenu-method-name-pattern
(rx
- ;; Whitespace
- bol
- (zero-or-more space)
-
- ;; Conditionals
- (zero-or-one
- "else"
- (zero-or-more space))
- (zero-or-one
- "version"
- (zero-or-more space)
- "("
- (zero-or-more space)
- (one-or-more (any "a-zA-Z0-9_"))
- (zero-or-more space)
- ")"
- (zero-or-more space))
+ (eval d--imenu-rx-def-start)
;; Qualifiers
(zero-or-more
@@ -574,8 +578,7 @@ Each list item should be a regexp matching a single
identifier."
(defvar d-imenu-generic-expression
`(("*Classes*"
,(rx
- line-start
- (zero-or-more (syntax whitespace))
+ (eval d--imenu-rx-def-start)
(zero-or-more
(or "final" "abstract" "private" "package" "protected" "public"
"export" "static")
(one-or-more (syntax whitespace)))
@@ -591,8 +594,7 @@ Each list item should be a regexp matching a single
identifier."
1)
("*Interfaces*"
,(rx
- line-start
- (zero-or-more (syntax whitespace))
+ (eval d--imenu-rx-def-start)
word-start
"interface"
(one-or-more (syntax whitespace))
@@ -605,8 +607,7 @@ Each list item should be a regexp matching a single
identifier."
1)
("*Structs*"
,(rx
- line-start
- (zero-or-more (syntax whitespace))
+ (eval d--imenu-rx-def-start)
(zero-or-more
(or "private" "package" "protected" "public" "export" "static")
(one-or-more (syntax whitespace)))
@@ -622,8 +623,7 @@ Each list item should be a regexp matching a single
identifier."
1)
("*Templates*"
,(rx
- line-start
- (zero-or-more (syntax whitespace))
+ (eval d--imenu-rx-def-start)
(zero-or-one
"mixin"
(one-or-more (syntax whitespace)))
@@ -639,8 +639,7 @@ Each list item should be a regexp matching a single
identifier."
1)
("*Enums*"
,(rx
- line-start
- (zero-or-more (syntax whitespace))
+ (eval d--imenu-rx-def-start)
word-start
"enum"
(one-or-more (syntax whitespace))
diff --git a/tests/imenu.d b/tests/imenu.d
index 9559331..b61d0f3 100644
--- a/tests/imenu.d
+++ b/tests/imenu.d
@@ -1,5 +1,5 @@
// #run: (d-test-get-imenu-lines)
-// #out: (4 6 11 14 17 19 22 25 33 34 37 40 43 46 49 52 54 56 67)
+// #out: (4 6 11 14 17 19 22 25 33 34 37 40 43 46 49 52 54 56 67 75)
void foo(int x) {}
@@ -70,3 +70,6 @@ Entry getLog()
return foo(x);
}
}
+
+// Conditional declarations
+version(CoreDdoc) enum ClockType {}
- [nongnu] elpa/d-mode 6db43b2 153/346: tests: Add additional tests for #30, (continued)
- [nongnu] elpa/d-mode 6db43b2 153/346: tests: Add additional tests for #30, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode c9e0b97 154/346: tests: Improve imenu test machinery, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode e26260c 156/346: Fix imenu for functions with multiple tail qualifiers, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode fda6318 165/346: Fix imenu for structs/classes with protection specifiers, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode d7f46a2 166/346: Add aliases to imenu, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 98af62e 167/346: tests: Add test for #26 variant with compile- and run-time argument lists, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode a97c92c 168/346: d-mode: Remove 'bit' from keyword list., ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 398f185 171/346: Merge pull request #85 from MartinNowak/fix49, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 8cf1ec5 174/346: Work around Emacs bug #18845, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode f384327 179/346: Fix imenu with typename ending with keyword, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode e809bd1 181/346: Fix imenu with conditional non-function declarations,
ELPA Syncer <=
- [nongnu] elpa/d-mode 5e08129 192/346: Fix indentation of function out contracts, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 06fb0ff 189/346: Fix indentation of enums with a base type, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 1afddc7 190/346: Fix a typo in a regex, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 382a677 195/346: Use c-major-mode-is, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 9edcfbd 197/346: Remove unused bits from d-in-knr-argdecl, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 175c6e5 193/346: Fix indentation of function constraints/contracts?, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 5fdba4e 202/346: Add pragma keyword, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode 51b1af1 203/346: Fix K&R region detection and body-less function declarations, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode b5fb492 204/346: Fix fontification of manifest (enum) constants, ELPA Syncer, 2021/08/29
- [nongnu] elpa/d-mode e52434e 218/346: d-mode-test.el: Save actual result to file in case of mismatch, ELPA Syncer, 2021/08/29