Code

Teach "git diff -p" Pascal/Delphi funcname pattern
authorAvery Pennarun <apenwarr@gmail.com>
Fri, 1 Aug 2008 21:00:15 +0000 (17:00 -0400)
committerJunio C Hamano <gitster@pobox.com>
Sat, 2 Aug 2008 22:39:35 +0000 (15:39 -0700)
Finds classes, records, functions, procedures, and sections.  Most lines
need to start at the first column, or else there's no way to differentiate
a procedure's definition from its declaration.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c

diff --git a/diff.c b/diff.c
index c253015c5d612a6715485031adc840658ffaf9c0..75a8b166429aa6c9967b04152577f3ad0d67b20f 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -1380,6 +1380,12 @@ static struct builtin_funcname_pattern {
                        "^[     ]*\\(\\([       ]*"
                        "[A-Za-z_][A-Za-z_0-9]*\\)\\{2,\\}"
                        "[      ]*([^;]*\\)$" },
+       { "pascal", "^\\(\\(procedure\\|function\\|constructor\\|"
+                       "destructor\\|interface\\|implementation\\|"
+                       "initialization\\|finalization\\)[ \t]*.*\\)$"
+                       "\\|"
+                       "^\\(.*=[ \t]*\\(class\\|record\\).*\\)$"
+                       },
        { "tex", "^\\(\\\\\\(sub\\)*section{.*\\)$" },
        { "ruby", "^\\s*\\(\\(class\\|module\\|def\\)\\s.*\\)$" },
 };