Add userdiff patterns for Ada
PATCH v2 1/1 Add userdiff patterns for Ada
Add Ada xfuncname and wordRegex patterns to the list of builtin patterns.
Signed-off-by Adrian Johnson <[email protected]>
---
Quoted 4 lines · Junio C Hamano
You could add test vectors to check if the built-in xfuncname catches beginning of functions in Ada correctly if you wanted to, but I think observing what appears on @@ lines in t4034 test vector would be a sufficient test.
I've added additional Ada code to the t4034 test to test xfuncname.
Documentation/gitattributes.txt | 2 ++ t/t4018-diff-funcname.sh | 2 +- t/t4034-diff-words.sh | 1 + t/t4034/ada/expect | 56 ++++++++++++++++++++++++++++++++++++++ t/t4034/ada/post | 59 +++++++++++++++++++++++++++++++++++++++++ t/t4034/ada/pre | 59 +++++++++++++++++++++++++++++++++++++++++ userdiff.c | 9 +++++++ 7 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 t/t4034/ada/expect create mode 100644 t/t4034/ada/post create mode 100644 t/t4034/ada/pre
Documentation/gitattributes.txt +2 -0
@@ -511,6 +511,8 @@ configuration file (you still need to enable this with the attribute mechanism, via `.gitattributes`). The following built in patterns are available: +- `ada` suitable for source code in the Ada language. + - `bibtex` suitable for files with BibTeX coded references. - `cpp` suitable for source code in the C and C++ languages.
t/t4018-diff-funcname.sh +1 -1
@@ -105,7 +105,7 @@ test_expect_funcname () { grep "^@@.*@@ $1" diff } -for p in bibtex cpp csharp fortran html java matlab objc pascal perl php python ruby tex +for p in ada bibtex cpp csharp fortran html java matlab objc pascal perl php python ruby tex do test_expect_success "builtin $p pattern compiles" ' echo "*.java diff=$p" >.gitattributes &&
t/t4034-diff-words.sh +1 -0
@@ -298,6 +298,7 @@ test_expect_success 'unset default driver' ' test_unconfig diff.wordregex ' +test_language_driver ada test_language_driver bibtex test_language_driver cpp test_language_driver csharp
t/t4034/ada/expect new file +56 -0
56 lines not on this page · raw message
t/t4034/ada/post new file +59 -0
59 lines not on this page · raw message
t/t4034/ada/pre new file +59 -0
59 lines not on this page · raw message
userdiff.c +9 -0
@@ -14,6 +14,15 @@ static int drivers_alloc; { name, NULL, -1, { pattern, REG_EXTENDED | REG_ICASE }, \ word_regex "|[^[:space:]]|[\xc0-\xff][\x80-\xbf]+" }static struct userdiff_driver builtin_drivers[] = { +IPATTERN ("ada" , +"!^(.*[ \t])?(is new|renames|is separate)([ \t].*)?$\n" +"!^[ \t]*with[ \t].*$\n" +"^[ \t]*((procedure|function)[ \t]+.*)$\n" +"^[ \t]*((package|protected|task)[ \t]+.*)$" , +/* -- */ +"[a-zA-Z][a-zA-Z0-9_]*" +"|[0-9][-+0-9#_.eE]" +"|=>|\\.\\.|\\*\\*|:=|/=|>=|<=|<<|>>|<>" ), IPATTERN("fortran", "!^([C*]|[ \t]*!)\n" "!^[ \t]*MODULE[ \t]+PROCEDURE[ \t]\n"
Signature · 1 line
1.7.12.465.g03a9b82