[PATCH] userdiff.c: Improve builtin csharp regex patterns.
From: Tor Arvid Lund <hidden>
Date: 2016-06-15 22:49:51
Subsystem:
the rest · Maintainer:
Linus Torvalds
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 <redacted> --- 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