{"thread":{"id":"35782","subject":"[PATCH] userdiff: update Ada patterns","startedAt":"2014-02-02T10:51:56Z","lastAt":"2014-02-05T17:28:44Z","messageCount":8,"participants":["Adrian Johnson","Jeff King","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"234033","messageId":"52EE234C.1060002@redneon.com","threadId":"35782","inReplyTo":null,"subject":"[PATCH] userdiff: update Ada patterns","fromName":"Adrian Johnson","fromEmail":"ajohnson@redneon.com","sentAt":"2014-02-02T10:51:56Z","receivedAt":"2014-02-02T10:51:56Z","isPatch":true,"sender":{"key":"ajohnson@redneon.com","avatar":"https://avatars.githubusercontent.com/u/3437729?v=4"},"body":"- Allow extra space in \"is new\" and \"is separate\"\n- Fix bug in word regex for numbers\n\nSigned-off-by: Adrian Johnson <ajohnson@redneon.com>\n---\n t/t4034/ada/expect | 2 +-\n userdiff.c         | 4 ++--\n 2 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t4034/ada/expect b/t/t4034/ada/expect\nindex be2376e..a682d28 100644\n--- a/t/t4034/ada/expect\n+++ b/t/t4034/ada/expect\n@@ -4,7 +4,7 @@\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+1 <RED>1e-10<RESET><GREEN>1e10<RESET> 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>\ndiff --git a/userdiff.c b/userdiff.c\nindex ea43a03..e8915bf 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -15,13 +15,13 @@ static int drivers_alloc;\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])?(is[ \\t]+new|renames|is[ \\t]+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 \"|[-+0-9#_.eE]+\"\n \t \"|=>|\\\\.\\\\.|\\\\*\\\\*|:=|/=|>=|<=|<<|>>|<>\"),\n IPATTERN(\"fortran\",\n \t \"!^([C*]|[ \\t]*!)\\n\"\n-- \n1.8.3.2\n"},{"id":"234067","messageId":"20140202233531.GE16196@sigill.intra.peff.net","threadId":"35782","inReplyTo":"52EE234C.1060002@redneon.com","subject":"Re: [PATCH] userdiff: update Ada patterns","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-02-02T23:35:31Z","receivedAt":"2014-02-02T23:35:31Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Feb 02, 2014 at 09:21:56PM +1030, Adrian Johnson wrote:\n\n> - Allow extra space in \"is new\" and \"is separate\"\n> [...]\n> -\t \"!^(.*[ \\t])?(is new|renames|is separate)([ \\t].*)?$\\n\"\n> +\t \"!^(.*[ \\t])?(is[ \\t]+new|renames|is[ \\t]+separate)([ \\t].*)?$\\n\"\n\nI do not know anything about Ada syntax, but this change looks obviously\nsensible.\n\n> - Fix bug in word regex for numbers\n> -\t \"|[0-9][-+0-9#_.eE]\"\n> +\t \"|[-+0-9#_.eE]+\"\n\nThis makes \"E\" or \"_\" a number. Is that right?\n\nI think the intent of the original was \"starts with a digit, and then\nhas one or more of these other things after it\". You do not describe the\nbug, but I guess it would be that it does not match obvious things like\n\"5\". Should it be \"zero or more\" instead, like:\n\n  [0-9][-+0-9#_.eE]*\n\n? Also, should -/+ be hoisted to the front?\n\n  [-+]?[0-9][0-9#_.eE]*\n\nAgain, I am just guessing, as I am not familiar enough with Ada.\n\n-Peff\n"},{"id":"234100","messageId":"52EF7DC4.8060200@redneon.com","threadId":"35782","inReplyTo":"20140202233531.GE16196@sigill.intra.peff.net","subject":"Re: [PATCH] userdiff: update Ada patterns","fromName":"Adrian Johnson","fromEmail":"ajohnson@redneon.com","sentAt":"2014-02-03T11:30:12Z","receivedAt":"2014-02-03T11:30:12Z","isPatch":true,"sender":{"key":"ajohnson@redneon.com","avatar":"https://avatars.githubusercontent.com/u/3437729?v=4"},"body":"On 03/02/14 10:05, Jeff King wrote:\n> On Sun, Feb 02, 2014 at 09:21:56PM +1030, Adrian Johnson wrote:\n>> - Fix bug in word regex for numbers\n>> -\t \"|[0-9][-+0-9#_.eE]\"\n>> +\t \"|[-+0-9#_.eE]+\"\n> \n> This makes \"E\" or \"_\" a number. Is that right?\n> \n> I think the intent of the original was \"starts with a digit, and then\n> has one or more of these other things after it\". You do not describe the\n> bug, but I guess it would be that it does not match obvious things like\n> \"5\". Should it be \"zero or more\" instead, like:\n> \n>   [0-9][-+0-9#_.eE]*\n\nYes, the original was missing the '*' at the end. \n\nI changed it to be similar to the number regexes used by the other builtin\npatterns which are of the form '[-+0-9#_.eE]+'.\n\n> \n> ? Also, should -/+ be hoisted to the front?\n> \n>   [-+]?[0-9][0-9#_.eE]*\n\nThe other builtins don't do this. But it is probably better to have\n[-+]?[0-9] at the front.\n\n> Again, I am just guessing, as I am not familiar enough with Ada.\n\nAda numbers have the form:\n\n- integers and reals eg 123, 1.23, 1e-2 ('.' can not be first)\n- a '_' may be used between digits to improve readability eg 123_456\n- base n (2 <= n <= 16) is of the form n#digits# eg 16#FFEF#\n- base n numbers can include a radix point and/or an exponent\n  eg 16#FF12.8#e-2\n- Ada is case insensitive\n\nAfter having another look I noticed it was missing the hex characters.\nThe new number regex I am proposing is:\n\n[-+]?[0-9][0-9#_.aAbBcCdDeEfF]*([eE][+-]?[0-9_]+)?\n\nI kept exponents containing a +/- sign separate from the digits\nto prevent things like '1+2' from matching. I'll send an updated patch.\n\n> \n> -Peff\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":"234101","messageId":"52EF7E7C.3070504@redneon.com","threadId":"35782","inReplyTo":"20140202233531.GE16196@sigill.intra.peff.net","subject":"[PATCH v2] userdiff: update Ada patterns","fromName":"Adrian Johnson","fromEmail":"ajohnson@redneon.com","sentAt":"2014-02-03T11:33:16Z","receivedAt":"2014-02-03T11:33:16Z","isPatch":true,"sender":{"key":"ajohnson@redneon.com","avatar":"https://avatars.githubusercontent.com/u/3437729?v=4"},"body":"- Allow extra space in \"is new\" and \"is separate\"\n- Fix bug in word regex for numbers\n\nSigned-off-by: Adrian Johnson <ajohnson@redneon.com>\n---\n t/t4034/ada/expect | 2 +-\n userdiff.c         | 4 ++--\n 2 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t4034/ada/expect b/t/t4034/ada/expect\nindex be2376e..a682d28 100644\n--- a/t/t4034/ada/expect\n+++ b/t/t4034/ada/expect\n@@ -4,7 +4,7 @@\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+1 <RED>1e-10<RESET><GREEN>1e10<RESET> 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>\ndiff --git a/userdiff.c b/userdiff.c\nindex ea43a03..10b61ec 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -15,13 +15,13 @@ static int drivers_alloc;\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])?(is[ \\t]+new|renames|is[ \\t]+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 \"|[-+]?[0-9][0-9#_.aAbBcCdDeEfF]*([eE][+-]?[0-9_]+)?\"\n \t \"|=>|\\\\.\\\\.|\\\\*\\\\*|:=|/=|>=|<=|<<|>>|<>\"),\n IPATTERN(\"fortran\",\n \t \"!^([C*]|[ \\t]*!)\\n\"\n-- \n1.8.3.2\n"},{"id":"234143","messageId":"xmqqppn4dl0k.fsf@gitster.dls.corp.google.com","threadId":"35782","inReplyTo":"52EF7E7C.3070504@redneon.com","subject":"Re: [PATCH v2] userdiff: update Ada patterns","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-02-03T20:00:27Z","receivedAt":"2014-02-03T20:00:27Z","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> - Allow extra space in \"is new\" and \"is separate\"\n> - Fix bug in word regex for numbers\n>\n> Signed-off-by: Adrian Johnson <ajohnson@redneon.com>\n> ---\n>  t/t4034/ada/expect | 2 +-\n>  userdiff.c         | 4 ++--\n>  2 files changed, 3 insertions(+), 3 deletions(-)\n>\n> diff --git a/t/t4034/ada/expect b/t/t4034/ada/expect\n> index be2376e..a682d28 100644\n> --- a/t/t4034/ada/expect\n> +++ b/t/t4034/ada/expect\n> @@ -4,7 +4,7 @@\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> +1 <RED>1e-10<RESET><GREEN>1e10<RESET> 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> diff --git a/userdiff.c b/userdiff.c\n> index ea43a03..10b61ec 100644\n> --- a/userdiff.c\n> +++ b/userdiff.c\n> @@ -15,13 +15,13 @@ static int drivers_alloc;\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])?(is[ \\t]+new|renames|is[ \\t]+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 \"|[-+]?[0-9][0-9#_.aAbBcCdDeEfF]*([eE][+-]?[0-9_]+)?\"\n\nThis would match a lot wider than what I read you said you wanted to\nmatch in your previous message.  Does \"-04##4_3_2Ee-9\" count as a\nnumber, for example, or can we just ignore such syntactically\nincorrect sequence?\n\n>  \t \"|=>|\\\\.\\\\.|\\\\*\\\\*|:=|/=|>=|<=|<<|>>|<>\"),\n>  IPATTERN(\"fortran\",\n>  \t \"!^([C*]|[ \\t]*!)\\n\"\n"},{"id":"234277","messageId":"52F2160D.1040006@redneon.com","threadId":"35782","inReplyTo":"xmqqppn4dl0k.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v2] userdiff: update Ada patterns","fromName":"Adrian Johnson","fromEmail":"ajohnson@redneon.com","sentAt":"2014-02-05T10:44:29Z","receivedAt":"2014-02-05T10:44:29Z","isPatch":true,"sender":{"key":"ajohnson@redneon.com","avatar":"https://avatars.githubusercontent.com/u/3437729?v=4"},"body":"On 04/02/14 06:30, Junio C Hamano wrote:\n> Adrian Johnson <ajohnson@redneon.com> writes:\n> \n>> - Allow extra space in \"is new\" and \"is separate\"\n>> - Fix bug in word regex for numbers\n>>\n>> Signed-off-by: Adrian Johnson <ajohnson@redneon.com>\n>> ---\n>>  t/t4034/ada/expect | 2 +-\n>>  userdiff.c         | 4 ++--\n>>  2 files changed, 3 insertions(+), 3 deletions(-)\n>>\n>> diff --git a/t/t4034/ada/expect b/t/t4034/ada/expect\n>> index be2376e..a682d28 100644\n>> --- a/t/t4034/ada/expect\n>> +++ b/t/t4034/ada/expect\n>> @@ -4,7 +4,7 @@\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>> +1 <RED>1e-10<RESET><GREEN>1e10<RESET> 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>> diff --git a/userdiff.c b/userdiff.c\n>> index ea43a03..10b61ec 100644\n>> --- a/userdiff.c\n>> +++ b/userdiff.c\n>> @@ -15,13 +15,13 @@ static int drivers_alloc;\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])?(is[ \\t]+new|renames|is[ \\t]+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 \"|[-+]?[0-9][0-9#_.aAbBcCdDeEfF]*([eE][+-]?[0-9_]+)?\"\n> \n> This would match a lot wider than what I read you said you wanted to\n> match in your previous message.  Does \"-04##4_3_2Ee-9\" count as a\n> number, for example, or can we just ignore such syntactically\n> incorrect sequence?\n\nMaybe I am misunderstanding the purpose of the word diff regexes. I\nthought the purpose of the word regex is to split lines into words, not\ndetermine what is syntactically correct.\n\nFor example decimal number regex for pascal is: [-+0-9.e]+\nand for cpp: [-+0-9.e]+[fFlL]?\n\nThese will obviously match stuff that is not a number.\n\n> \n>>  \t \"|=>|\\\\.\\\\.|\\\\*\\\\*|:=|/=|>=|<=|<<|>>|<>\"),\n>>  IPATTERN(\"fortran\",\n>>  \t \"!^([C*]|[ \\t]*!)\\n\"\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":"234287","messageId":"xmqqk3d95vic.fsf@gitster.dls.corp.google.com","threadId":"35782","inReplyTo":"52F2160D.1040006@redneon.com","subject":"Re: [PATCH v2] userdiff: update Ada patterns","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-02-05T17:17:47Z","receivedAt":"2014-02-05T17:17:47Z","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>>> -\t \"|[0-9][-+0-9#_.eE]\"\n>>> +\t \"|[-+]?[0-9][0-9#_.aAbBcCdDeEfF]*([eE][+-]?[0-9_]+)?\"\n>> \n>> This would match a lot wider than what I read you said you wanted to\n>> match in your previous message.  Does \"-04##4_3_2Ee-9\" count as a\n>> number, for example, or can we just ignore such syntactically\n>> incorrect sequence?\n>\n> Maybe I am misunderstanding the purpose of the word diff regexes. I\n> thought the purpose of the word regex is to split lines into words, not\n> determine what is syntactically correct.\n\nI agree that the purpose is former---So you could have just said\n\"the latter\" ;-).\n\nAny other nitpick, anybody?  Otherwise I'll queue this version.\n"},{"id":"234291","messageId":"20140205172844.GD7268@sigill.intra.peff.net","threadId":"35782","inReplyTo":"xmqqk3d95vic.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v2] userdiff: update Ada patterns","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-02-05T17:28:44Z","receivedAt":"2014-02-05T17:28:44Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Feb 05, 2014 at 09:17:47AM -0800, Junio C Hamano wrote:\n\n> Adrian Johnson <ajohnson@redneon.com> writes:\n> \n> >>> -\t \"|[0-9][-+0-9#_.eE]\"\n> >>> +\t \"|[-+]?[0-9][0-9#_.aAbBcCdDeEfF]*([eE][+-]?[0-9_]+)?\"\n> >> \n> >> This would match a lot wider than what I read you said you wanted to\n> >> match in your previous message.  Does \"-04##4_3_2Ee-9\" count as a\n> >> number, for example, or can we just ignore such syntactically\n> >> incorrect sequence?\n> >\n> > Maybe I am misunderstanding the purpose of the word diff regexes. I\n> > thought the purpose of the word regex is to split lines into words, not\n> > determine what is syntactically correct.\n> \n> I agree that the purpose is former---So you could have just said\n> \"the latter\" ;-).\n> \n> Any other nitpick, anybody?  Otherwise I'll queue this version.\n\nNo nitpick here, I had the same thought as Adrian while reading the\nthread (and if somebody comes up with a real case where the output looks\nbad, we can iterate on it).\n\n-Peff\n"}]}