threads / patch / 25526

patchuserdiff.c: Improve builtin csharp regex patterns.

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

## tl;dr

One message between Oct 22, 2010 and Oct 22, 2010. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Tor Arvid Lund· Oct 22, 2010, 16:31 UTC · lore
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(-)
Show changes to userdiff.c +2 −0
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

← back to recent threads