# [PATCH] userdiff.c: Improve builtin csharp regex patterns.

1 messages from 2010-10-22 to 2010-10-22. Participants: Tor Arvid Lund.
Thread: https://gitlist.dev/t/25526

## Tor Arvid Lund, 2010-10-22 16:31

Subject: [PATCH] userdiff.c: Improve builtin csharp regex patterns.
Message-ID: <1287765103-3778-1-git-send-email-torarvid@gmail.com>
URL: https://gitlist.dev/e/1287765103-3778-1-git-send-email-torarvid%40gmail.com

```
This fixes the case where you have a c# method on the form:

public Dictionary<int, string> GetSomeMap()

The previous regex did not support generic syntax with more than one
type parameter. This patch basically copies the regex used for methods, and
adds the requirement that it has a MethodName<.*> pattern where the .* can
contain Comma, Space and Tab.

Signed-off-by: Tor Arvid Lund <torarvid@gmail.com>
---
Maybe someone can optimize this, or merge it with the "Methods and
constructors" pattern in a nice way. It seemed to solve my itch, at least...

 userdiff.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/userdiff.c b/userdiff.c
index f9e05b5..06d8077 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -103,6 +103,8 @@ PATTERNS("csharp",
 	 "!^[ \t]*(do|while|for|if|else|instanceof|new|return|switch|case|throw|catch|using)\n"
 	 /* Methods and constructors */
 	 "^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[<>@._[:alnum:]]+[ \t]*\\(.*\\))[ \t]*$\n"
+	 /* Generic methods */
+	 "^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \t]+)*[][@._[:alnum:]]+<[<>@., \t[:alnum:]]+>[ \t]+[@._[:alnum:]]+(<[<>@., \t[:alnum:]]+>)?[ \t]*\\(.*\\))[ \t]*$\n"
 	 /* Properties */
 	 "^[ \t]*(((static|public|internal|private|protected|new|virtual|sealed|override|unsafe)[ \t]+)*[][<>@.~_[:alnum:]]+[ \t]+[@._[:alnum:]]+)[ \t]*$\n"
 	 /* Type definitions */
-- 
1.7.3.GIT

```
