[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/csharp-mode e22eb34 210/459: imenu: support nested gene
From: |
ELPA Syncer |
Subject: |
[elpa] externals/csharp-mode e22eb34 210/459: imenu: support nested generic return-types. |
Date: |
Sun, 22 Aug 2021 13:59:29 -0400 (EDT) |
branch: externals/csharp-mode
commit e22eb3416fbbe241855f3e228dd0168d65cb7239
Author: Jostein Kjønigsen <jostein@kjonigsen.net>
Commit: Jostein Kjønigsen <jostein@kjonigsen.net>
imenu: support nested generic return-types.
This limitation was found while working with object and collection
initializers.
Added test-cases.
---
csharp-mode-tests.el | 3 +-
csharp-mode.el | 63 ++++++++++++++++++++++-------------------
test-files/imenu-method-test.cs | 5 ++++
3 files changed, 41 insertions(+), 30 deletions(-)
diff --git a/csharp-mode-tests.el b/csharp-mode-tests.el
index 29635c3..53a94ae 100644
--- a/csharp-mode-tests.el
+++ b/csharp-mode-tests.el
@@ -236,7 +236,8 @@
"(method) AbstractMethod("
"(method) UnsafeCopy("
"(method) GenericMethod1<T>"
- "(method) GenericMethod2<T1,T2>")
+ "(method) GenericMethod2<T1,T2>"
+ "(method) NestedGeneric")
(def-imenutest imenu-parsing-supports-delegates
"./test-files/imenu-delegate-test.cs"
diff --git a/csharp-mode.el b/csharp-mode.el
index cc6cbb0..be249ad 100644
--- a/csharp-mode.el
+++ b/csharp-mode.el
@@ -1774,29 +1774,37 @@ to the beginning of the prior namespace.
"abstract" "async" "new" "unsafe")))
;; this will allow syntactically invalid combinations of modifiers
;; but that's a compiler problem, not a imenu-problem
- (access-modifier-list (concat "\\(?:" access-modifier space "\\)"))
+ (access-modifier-list (concat "\\(?:" access-modifier space
"\\)"))
(access-modifiers (concat access-modifier-list "*"))
- (return-type "\\(?:[[:alpha:]_][^
=\t\(\n\r\f\v]*\\)")
- (identifier "[[:alpha:]_][[:alnum:]_]*")
- (interface-prefix (concat "\\(?:" identifier "\\.\\)"))
- (generic-identifier (concat identifier
- ;; optional generic arguments
- "\\(?:<" optional-space identifier
- "\\(?:" "," optional-space identifier
optional-space "\\)*"
- ">\\)?"
- ))
+ (basic-type (concat
+ ;; typename
+ "\\(?:[A-Za-z_][[:alnum:]]*\\.\\)*"
+ "[A-Za-z_][[:alnum:]]*"
+ ))
+ (type (concat
+ basic-type
+ ;; simplified, optional generic
constraint.
+ ;; handles generic sub-types.
+ ;; { is optional because otherwise
initializers with
+ ;; bracket on same line will indent
wrongly.
+ "\\(?:<[[:alnum:], <>]+>[
\t\n\f\v\r]*{?\\)?"))
+ (return-type (concat
+ type
+ ;; optional array-specifier
+ "\\(?:\\[\\]\\)?"))
+ (interface-prefix (concat "\\(?:" type "\\.\\)"))
;; param-list with parens
(parameter-list "\\(?:\([^!\)]*\)\\)")
(inheritance-clause (concat "\\(?:"
optional-space
":"
- optional-space generic-identifier
- "\\(?:" optional-space "," optional-space
generic-identifier "\\)*"
+ optional-space type
+ "\\(?:" optional-space "," optional-space
type "\\)*"
"\\)?")))
(list (list "namespace"
(concat bol "namespace" space
- "\\(" identifier "\\)") 1)
+ "\\(" basic-type "\\)") 1)
;; not all these are classes, but they can hold other
;; members, so they are treated uniformly.
(list "class"
@@ -1804,19 +1812,19 @@ to the beginning of the prior namespace.
access-modifiers
"\\("
(regexp-opt '("class" "struct" "interface")) space
- generic-identifier inheritance-clause "\\)") 1)
+ type inheritance-clause "\\)") 1)
(list "enum"
(concat bol
access-modifiers
"\\(" "enum" space
- identifier "\\)") 1)
+ basic-type "\\)") 1)
(list "ctor"
(concat bol
;; ctor MUST have access modifiers, or else we pick
;; every if statement in the file...
access-modifier-list "+"
"\\("
- identifier
+ basic-type
optional-space
parameter-list
"\\)"
@@ -1837,7 +1845,7 @@ to the beginning of the prior namespace.
access-modifier-list "+"
return-type space
"\\("
- generic-identifier
+ type
optional-space
parameter-list
"\\)"
@@ -1850,7 +1858,7 @@ to the beginning of the prior namespace.
return-type space
"\\("
interface-prefix
- generic-identifier
+ type
optional-space
parameter-list
"\\)"
@@ -1864,7 +1872,7 @@ to the beginning of the prior namespace.
(regexp-opt '("extern" "abstract")) space
return-type space
"\\("
- generic-identifier
+ type
optional-space
parameter-list
"\\)"
@@ -1874,14 +1882,11 @@ to the beginning of the prior namespace.
;; delegates are almost like abstract methods, so pick them up here
(list "delegate"
(concat bol
- ;; we MUST require modifiers, or else we cannot
reliably
- ;; identify declarations, without also dragging in
lots of
- ;; if statements and what not.
- access-modifier-list "+"
+ access-modifiers
"delegate" space
return-type space
"\\("
- generic-identifier
+ type
"\\)"
optional-space
parameter-list
@@ -1895,7 +1900,7 @@ to the beginning of the prior namespace.
access-modifiers
return-type space
"\\("
- generic-identifier
+ type
"\\)"
optional-space "{" optional-space
;; unless we are super-specific and expect the
accesors,
@@ -1908,7 +1913,7 @@ to the beginning of the prior namespace.
return-type space
"\\("
interface-prefix
- generic-identifier
+ type
"\\)"
optional-space "{" optional-space
;; unless we are super-specific and expect the
accesors,
@@ -1924,7 +1929,7 @@ to the beginning of the prior namespace.
"\\(?:" (regexp-opt '("readonly" "const" "volatile"))
space "\\)?"
return-type space
"\\("
- generic-identifier
+ type
"\\)"
optional-space
;; optional assignment
@@ -1940,7 +1945,7 @@ to the beginning of the prior namespace.
"\\[" optional-space
;; type
"\\([^\]]+\\)" optional-space
- identifier
+ type
;; closing brackets
"\\]"
"\\)"
@@ -1955,7 +1960,7 @@ to the beginning of the prior namespace.
optional-space "event" optional-space
"\\("
return-type space
- generic-identifier
+ type
"\\)"
optional-space
";") 1))))
diff --git a/test-files/imenu-method-test.cs b/test-files/imenu-method-test.cs
index 9119149..c561fcc 100644
--- a/test-files/imenu-method-test.cs
+++ b/test-files/imenu-method-test.cs
@@ -34,6 +34,11 @@ public class MethodTest
}
+ private Dictionary<string,Func<int, bool>> NestedGeneric()
+ {
+
+ }
+
public abstract string AbstractMethod();
public unsafe static void UnsafeCopy(byte[] src, byte[] dst, int count)
- [elpa] externals/csharp-mode 5b89db2 088/459: Imenu: Correctly handle default-values in param-lists., (continued)
- [elpa] externals/csharp-mode 5b89db2 088/459: Imenu: Correctly handle default-values in param-lists., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 8ccafbc 092/459: remove unused rule and documentation, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 0e333c3 090/459: fontify else, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode f96cf8b 089/459: remove fontification of accessors and constructors, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode c097a34 093/459: add async as a function modifier, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode dd6c930 102/459: Merge pull request #43 from wasamasa/fix-major-mode-definition, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 55fe188 101/459: Use `define-derived-mode`, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 3c6a4ea 096/459: Add info about customization to readme., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode f80eace 098/459: Revert "Fix runtime warnings about obsolete Emacs-functions.", ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 43e7120 095/459: Merge remote-tracking branch 'less-colors', ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode e22eb34 210/459: imenu: support nested generic return-types.,
ELPA Syncer <=
- [elpa] externals/csharp-mode 1d2ef53 212/459: Fix imenu-indexing of members with underscore in name., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 33fb05c 213/459: imenu: Fix indexing of fields with _ in name., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 14bc3c6 215/459: Fix broken syntax-propertize., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 2275dda 218/459: Properly document workaround for syntax-properties, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 0183fc4 221/459: Prepare changelog for future bugs :), ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 0cd0b2c 226/459: Fix fontification of using-statements., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 0d35431 228/459: Fix fontification of namespaces to match using-statement rules., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 3c989a8 230/459: using: Don't mess up alnums in indentifier-fontification., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 5787aef 233/459: Update changelog., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 14e0327 235/459: Bump version and updated-date., ELPA Syncer, 2021/08/22