Commit e90d065e authored by Adrian Johnson's avatar Adrian Johnson Committed by Junio C Hamano

Add userdiff patterns for Ada

Add Ada xfuncname and wordRegex patterns to the list of builtin
patterns.
Signed-off-by: Adrian Johnson's avatarAdrian Johnson <[email protected]>
Signed-off-by: default avatarJunio C Hamano <[email protected]>
parent 889d3589
......@@ -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.
......
......@@ -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 &&
......
......@@ -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
......
<BOLD>diff --git a/pre b/post<RESET>
<BOLD>index d96fdd1..df21bb0 100644<RESET>
<BOLD>--- a/pre<RESET>
<BOLD>+++ b/post<RESET>
<CYAN>@@ -1,13 +1,13 @@<RESET>
Ada.Text_IO.Put_Line("Hello World<RED>!<RESET><GREEN>?<RESET>");
1 1e<RED>-<RESET>10 16#FE12#E2 3.141_592 '<RED>x<RESET><GREEN>y<RESET>'
<RED>a<RESET><GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>
<RED>a<RESET><GREEN>y<RESET>
<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b<RESET>
<RED>a<RESET><GREEN>y<RESET>
<GREEN>x<RESET>**<RED>b<RESET>
<RED>a<RESET><GREEN>y<RESET>
<GREEN>x<RESET>(<RED>b<RESET><GREEN>y<RESET>)
<RED>a<RESET><GREEN>x<RESET>:=<RED>b<RESET>
<RED>a<RESET><GREEN>y<RESET>
<GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>/= <RED>b<RESET>
<RED>a<RESET><GREEN>y<RESET>
<GREEN>x<RESET><<RED>b a<RESET><GREEN>y x<RESET><=<RED>b a<RESET><GREEN>y x<RESET>><RED>b a<RESET><GREEN>y x<RESET>>=<RED>b<RESET>
<RED>a<RESET><GREEN>y<RESET>
<GREEN>x<RESET>,<RED>b<RESET>
<RED>a<RESET><GREEN>y<RESET>
<GREEN>x<RESET>=><RED>b<RESET>
<RED>a<RESET><GREEN>y<RESET>
<GREEN>x<RESET>..<RED>b<RESET>
<RED>a<RESET><GREEN>y<RESET>
<GREEN>x<RESET><><RED>b<RESET><GREEN>y<RESET>
Ada.Text_IO.Put_Line("Hello World?");
1 1e10 16#FE12#E2 3.141_592 'y'
x+y x-y
x*y x/y
x**y
x(y)
x:=y
x=y x/= y
x<y x<=y x>y x>=y
x,y
x=>y
x..y
x<>y
Ada.Text_IO.Put_Line("Hello World!");
1 1e-10 16#FE12#E2 3.141_592 'x'
a+b a-b
a*b a/b
a**b
a(b)
a:=b
a=b a/= b
a<b a<=b a>b a>=b
a,b
a=>b
a..b
a<>b
......@@ -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"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment