branch: elpa/d-mode
commit 24fffad9b7c82bafcf5ab21645bfab39020a6a3e
Author: Vladimir Panteleev <[email protected]>
Commit: Vladimir Panteleev <[email protected]>
Fix parsing of declarations after "static else"
---
d-mode.el | 5 ++++-
tests/imenu.d | 4 +++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/d-mode.el b/d-mode.el
index 874102f..5ba21c9 100644
--- a/d-mode.el
+++ b/d-mode.el
@@ -428,7 +428,8 @@ The expression is added to `compilation-error-regexp-alist'
and
d nil)
(c-lang-defconst c-other-decl-kwds
- d (c-lang-const d-storage-class-kwds))
+ d (append (list "else")
+ (c-lang-const d-storage-class-kwds)))
(c-lang-defconst c-other-kwds
;; Keywords not accounted for by any other `*-kwds' language constant.
@@ -594,6 +595,8 @@ Each list item should be a regexp matching a single
identifier."
(c-forward-syntactic-ws)
(char-after)))
(kind (cond
+ ((equal id-prev-token "else")
+ nil) ; false positive after else
((equal id-prev-token "enum")
"Enums")
((equal id-prev-token "class")
diff --git a/tests/imenu.d b/tests/imenu.d
index e2f8408..f2e6875 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 75 78 81 84
87 89 93 94 96 97 99 104 109)
+// #out: (4 6 11 14 17 19 22 25 33 34 37 40 43 46 49 52 54 56 67 75 78 81 84
87 89 93 94 96 97 99 104 109 111)
void foo(int x) {}
@@ -107,3 +107,5 @@ alias
static if (false)
int fun();
+else
+ int gun();