git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Tor Arvid Lund <torarvid@gmail.com>
Date
Oct 22, 2010, 16:31 UTC
Message-ID
<1287765103-3778-1-git-send-email-torarvid@gmail.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
Message 1 of 1 in “userdiff.c: Improve builtin csharp regex patterns.”
  1. userdiff.c: Improve builtin csharp regex patterns.Tor Arvid Lund, Oct 22, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.