{"thread":{"id":"31545","subject":"[PATCH] Add userdiff patterns for Ada","startedAt":"2012-09-16T03:54:15Z","lastAt":"2012-09-17T04:59:21Z","messageCount":4,"participants":["Adrian Johnson","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"199132","messageId":"50554D67.1020204@redneon.com","threadId":"31545","inReplyTo":null,"subject":"[PATCH] Add userdiff patterns for Ada","fromName":"Adrian Johnson","fromEmail":"ajohnson@redneon.com","sentAt":"2012-09-16T03:54:15Z","receivedAt":"2012-09-16T03:54:15Z","isPatch":true,"sender":{"key":"ajohnson@redneon.com","avatar":"https://avatars.githubusercontent.com/u/3437729?v=4"},"body":"Add Ada xfuncname and wordRegex patterns to the list of builtin\npatterns.\n\nSigned-off-by: Adrian Johnson <ajohnson@redneon.com>\n---\n Documentation/gitattributes.txt |  2 ++\n t/t4018-diff-funcname.sh        |  2 +-\n t/t4034-diff-words.sh           |  1 +\n t/t4034/ada/expect              | 27 +++++++++++++++++++++++++++\n t/t4034/ada/post                | 13 +++++++++++++\n t/t4034/ada/pre                 | 13 +++++++++++++\n userdiff.c                      |  9 +++++++++\n 7 files changed, 66 insertions(+), 1 deletion(-)\n create mode 100644 t/t4034/ada/expect\n create mode 100644 t/t4034/ada/post\n create mode 100644 t/t4034/ada/pre\n\ndiff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\nindex 462b79c..99ed04d 100644\n--- a/Documentation/gitattributes.txt\n+++ b/Documentation/gitattributes.txt\n@@ -511,6 +511,8 @@ configuration file (you still need to enable this with the\n attribute mechanism, via `.gitattributes`).  The following built in\n patterns are available:\n \n+- `ada` suitable for source code in the Ada language.\n+\n - `bibtex` suitable for files with BibTeX coded references.\n \n - `cpp` suitable for source code in the C and C++ languages.\ndiff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh\nindex 4bd2a1c..082d3e8 100755\n--- a/t/t4018-diff-funcname.sh\n+++ b/t/t4018-diff-funcname.sh\n@@ -105,7 +105,7 @@ test_expect_funcname () {\n \tgrep \"^@@.*@@ $1\" diff\n }\n \n-for p in bibtex cpp csharp fortran html java matlab objc pascal perl php python ruby tex\n+for p in ada bibtex cpp csharp fortran html java matlab objc pascal perl php python ruby tex\n do\n \ttest_expect_success \"builtin $p pattern compiles\" '\n \t\techo \"*.java diff=$p\" >.gitattributes &&\ndiff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh\nindex 30d42cb..40ab333 100755\n--- a/t/t4034-diff-words.sh\n+++ b/t/t4034-diff-words.sh\n@@ -298,6 +298,7 @@ test_expect_success 'unset default driver' '\n \ttest_unconfig diff.wordregex\n '\n \n+test_language_driver ada\n test_language_driver bibtex\n test_language_driver cpp\n test_language_driver csharp\ndiff --git a/t/t4034/ada/expect b/t/t4034/ada/expect\nnew file mode 100644\nindex 0000000..be2376e\n--- /dev/null\n+++ b/t/t4034/ada/expect\n@@ -0,0 +1,27 @@\n+<BOLD>diff --git a/pre b/post<RESET>\n+<BOLD>index d96fdd1..df21bb0 100644<RESET>\n+<BOLD>--- a/pre<RESET>\n+<BOLD>+++ b/post<RESET>\n+<CYAN>@@ -1,13 +1,13 @@<RESET>\n+Ada.Text_IO.Put_Line(\"Hello World<RED>!<RESET><GREEN>?<RESET>\");\n+1 1e<RED>-<RESET>10 16#FE12#E2 3.141_592 '<RED>x<RESET><GREEN>y<RESET>'\n+<RED>a<RESET><GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>**<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>(<RED>b<RESET><GREEN>y<RESET>)\n+<RED>a<RESET><GREEN>x<RESET>:=<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>/= <RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<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>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>,<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>=><RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET>..<RED>b<RESET>\n+<RED>a<RESET><GREEN>y<RESET>\n+<GREEN>x<RESET><><RED>b<RESET><GREEN>y<RESET>\ndiff --git a/t/t4034/ada/post b/t/t4034/ada/post\nnew file mode 100644\nindex 0000000..df21bb0\n--- /dev/null\n+++ b/t/t4034/ada/post\n@@ -0,0 +1,13 @@\n+Ada.Text_IO.Put_Line(\"Hello World?\");\n+1 1e10 16#FE12#E2 3.141_592 'y'\n+x+y x-y\n+x*y x/y\n+x**y\n+x(y)\n+x:=y\n+x=y x/= y\n+x<y x<=y x>y x>=y\n+x,y\n+x=>y\n+x..y\n+x<>y\ndiff --git a/t/t4034/ada/pre b/t/t4034/ada/pre\nnew file mode 100644\nindex 0000000..d96fdd1\n--- /dev/null\n+++ b/t/t4034/ada/pre\n@@ -0,0 +1,13 @@\n+Ada.Text_IO.Put_Line(\"Hello World!\");\n+1 1e-10 16#FE12#E2 3.141_592 'x'\n+a+b a-b\n+a*b a/b\n+a**b\n+a(b)\n+a:=b\n+a=b a/= b\n+a<b a<=b a>b a>=b\n+a,b\n+a=>b\n+a..b\n+a<>b\ndiff --git a/userdiff.c b/userdiff.c\nindex 1e7184f..ed958ef 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -14,6 +14,15 @@ static int drivers_alloc;\n \t{ name, NULL, -1, { pattern, REG_EXTENDED | REG_ICASE }, \\\n \t  word_regex \"|[^[:space:]]|[\\xc0-\\xff][\\x80-\\xbf]+\" }\n static struct userdiff_driver builtin_drivers[] = {\n+IPATTERN(\"ada\",\n+\t \"!^(.*[ \\t])?(is new|renames|is separate)([ \\t].*)?$\\n\"\n+\t \"!^[ \\t]*with[ \\t].*$\\n\"\n+\t \"^[ \\t]*((procedure|function)[ \\t]+.*)$\\n\"\n+\t \"^[ \\t]*((package|protected|task)[ \\t]+.*)$\",\n+\t /* -- */\n+\t \"[a-zA-Z][a-zA-Z0-9_]*\"\n+\t \"|[0-9][-+0-9#_.eE]\"\n+\t \"|=>|\\\\.\\\\.|\\\\*\\\\*|:=|/=|>=|<=|<<|>>|<>\"),\n IPATTERN(\"fortran\",\n \t \"!^([C*]|[ \\t]*!)\\n\"\n \t \"!^[ \\t]*MODULE[ \\t]+PROCEDURE[ \\t]\\n\"\n-- \n1.7.12.465.g52d9ccc\n"},{"id":"199135","messageId":"7vboh6zek0.fsf@alter.siamese.dyndns.org","threadId":"31545","inReplyTo":"50554D67.1020204@redneon.com","subject":"Re: [PATCH] Add userdiff patterns for Ada","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-16T06:07:11Z","receivedAt":"2012-09-16T06:07:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Adrian Johnson <ajohnson@redneon.com> writes:\n\n> Add Ada xfuncname and wordRegex patterns to the list of builtin\n> patterns.\n>\n> Signed-off-by: Adrian Johnson <ajohnson@redneon.com>\n> ---\n\nInteresting.  I do not read Ada, but in this \"expect\" file,...\n\n> diff --git a/t/t4034/ada/expect b/t/t4034/ada/expect\n> new file mode 100644\n> index 0000000..be2376e\n> --- /dev/null\n> +++ b/t/t4034/ada/expect\n> @@ -0,0 +1,27 @@\n> +<BOLD>diff --git a/pre b/post<RESET>\n> +<BOLD>index d96fdd1..df21bb0 100644<RESET>\n> +<BOLD>--- a/pre<RESET>\n> +<BOLD>+++ b/post<RESET>\n> +<CYAN>@@ -1,13 +1,13 @@<RESET>\n> +Ada.Text_IO.Put_Line(\"Hello World<RED>!<RESET><GREEN>?<RESET>\");\n> +1 1e<RED>-<RESET>10 16#FE12#E2 3.141_592 '<RED>x<RESET><GREEN>y<RESET>'\n> +<RED>a<RESET><GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>\n> +<RED>a<RESET><GREEN>y<RESET>\n> +<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b<RESET>\n> +<RED>a<RESET><GREEN>y<RESET>\n> +<GREEN>x<RESET>**<RED>b<RESET>\n> +<RED>a<RESET><GREEN>y<RESET>\n> +<GREEN>x<RESET>(<RED>b<RESET><GREEN>y<RESET>)\n> +<RED>a<RESET><GREEN>x<RESET>:=<RED>b<RESET>\n> +<RED>a<RESET><GREEN>y<RESET>\n> +<GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>/= <RED>b<RESET>\n> +<RED>a<RESET><GREEN>y<RESET>\n> +<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>\n> +<RED>a<RESET><GREEN>y<RESET>\n> +<GREEN>x<RESET>,<RED>b<RESET>\n> +<RED>a<RESET><GREEN>y<RESET>\n> +<GREEN>x<RESET>=><RED>b<RESET>\n> +<RED>a<RESET><GREEN>y<RESET>\n> +<GREEN>x<RESET>..<RED>b<RESET>\n> +<RED>a<RESET><GREEN>y<RESET>\n> +<GREEN>x<RESET><><RED>b<RESET><GREEN>y<RESET>\n\nI do not seem to find anything interesting after @@, which means\nthat xfuncname is not tested at all even though the log message\nclaims the patch adds some.\n\nPuzzled...\n"},{"id":"199139","messageId":"50557D72.60205@redneon.com","threadId":"31545","inReplyTo":"7vboh6zek0.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] Add userdiff patterns for Ada","fromName":"Adrian Johnson","fromEmail":"ajohnson@redneon.com","sentAt":"2012-09-16T07:19:14Z","receivedAt":"2012-09-16T07:19:14Z","isPatch":true,"sender":{"key":"ajohnson@redneon.com","avatar":"https://avatars.githubusercontent.com/u/3437729?v=4"},"body":"On 16/09/12 15:37, Junio C Hamano wrote:\n> Adrian Johnson <ajohnson@redneon.com> writes:\n> \n>> Add Ada xfuncname and wordRegex patterns to the list of builtin\n>> patterns.\n>>\n>> Signed-off-by: Adrian Johnson <ajohnson@redneon.com>\n>> ---\n> \n> Interesting.  I do not read Ada, but in this \"expect\" file,...\n> \n>> diff --git a/t/t4034/ada/expect b/t/t4034/ada/expect\n>> new file mode 100644\n>> index 0000000..be2376e\n>> --- /dev/null\n>> +++ b/t/t4034/ada/expect\n>> @@ -0,0 +1,27 @@\n>> +<BOLD>diff --git a/pre b/post<RESET>\n>> +<BOLD>index d96fdd1..df21bb0 100644<RESET>\n>> +<BOLD>--- a/pre<RESET>\n>> +<BOLD>+++ b/post<RESET>\n>> +<CYAN>@@ -1,13 +1,13 @@<RESET>\n>> +Ada.Text_IO.Put_Line(\"Hello World<RED>!<RESET><GREEN>?<RESET>\");\n>> +1 1e<RED>-<RESET>10 16#FE12#E2 3.141_592 '<RED>x<RESET><GREEN>y<RESET>'\n>> +<RED>a<RESET><GREEN>x<RESET>+<RED>b a<RESET><GREEN>y x<RESET>-<RED>b<RESET>\n>> +<RED>a<RESET><GREEN>y<RESET>\n>> +<GREEN>x<RESET>*<RED>b a<RESET><GREEN>y x<RESET>/<RED>b<RESET>\n>> +<RED>a<RESET><GREEN>y<RESET>\n>> +<GREEN>x<RESET>**<RED>b<RESET>\n>> +<RED>a<RESET><GREEN>y<RESET>\n>> +<GREEN>x<RESET>(<RED>b<RESET><GREEN>y<RESET>)\n>> +<RED>a<RESET><GREEN>x<RESET>:=<RED>b<RESET>\n>> +<RED>a<RESET><GREEN>y<RESET>\n>> +<GREEN>x<RESET>=<RED>b a<RESET><GREEN>y x<RESET>/= <RED>b<RESET>\n>> +<RED>a<RESET><GREEN>y<RESET>\n>> +<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>\n>> +<RED>a<RESET><GREEN>y<RESET>\n>> +<GREEN>x<RESET>,<RED>b<RESET>\n>> +<RED>a<RESET><GREEN>y<RESET>\n>> +<GREEN>x<RESET>=><RED>b<RESET>\n>> +<RED>a<RESET><GREEN>y<RESET>\n>> +<GREEN>x<RESET>..<RED>b<RESET>\n>> +<RED>a<RESET><GREEN>y<RESET>\n>> +<GREEN>x<RESET><><RED>b<RESET><GREEN>y<RESET>\n> \n> I do not seem to find anything interesting after @@, which means\n> that xfuncname is not tested at all even though the log message\n> claims the patch adds some.\n\nI probably misunderstood how the tests work. I thought t4034 tested\nwordRegex while t4018 is for xfuncname. I based the Ada tests on the\nPascal tests but changed the operators to Ada operators. I'm not really\nsure what else the test needs.\n\n> \n> Puzzled...\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n> \n"},{"id":"199182","messageId":"7vfw6hxn12.fsf@alter.siamese.dyndns.org","threadId":"31545","inReplyTo":"50557D72.60205@redneon.com","subject":"Re: [PATCH] Add userdiff patterns for Ada","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-17T04:59:21Z","receivedAt":"2012-09-17T04:59:21Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Adrian Johnson <ajohnson@redneon.com> writes:\n\n>> I do not seem to find anything interesting after @@, which means\n>> that xfuncname is not tested at all even though the log message\n>> claims the patch adds some.\n>\n> I probably misunderstood how the tests work. I thought t4034 tested\n> wordRegex while t4018 is for xfuncname. I based the Ada tests on the\n> Pascal tests but changed the operators to Ada operators. I'm not really\n> sure what else the test needs.\n\nThe per-language for-loop you added ada to in t4018 is only to make\nsure there is no regexp syntax error in the built-in xfuncname, and\ndoes not check if the patterns make sense for the language at all.\n\nYou could add test vectors to check if the built-in xfuncname\ncatches beginning of functions in Ada correctly if you wanted to,\nbut I think observing what appears on @@ lines in t4034 test vector\nwould be a sufficient test.\n"}]}