git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Johnson <ajohnson@redneon.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>
Subject: Re: [PATCH v2] userdiff: update Ada patterns
Date: Wed, 05 Feb 2014 21:14:29 +1030	[thread overview]
Message-ID: <52F2160D.1040006@redneon.com> (raw)
In-Reply-To: <xmqqppn4dl0k.fsf@gitster.dls.corp.google.com>

On 04/02/14 06:30, Junio C Hamano wrote:
> Adrian Johnson <ajohnson@redneon.com> writes:
> 
>> - Allow extra space in "is new" and "is separate"
>> - Fix bug in word regex for numbers
>>
>> Signed-off-by: Adrian Johnson <ajohnson@redneon.com>
>> ---
>>  t/t4034/ada/expect | 2 +-
>>  userdiff.c         | 4 ++--
>>  2 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/t/t4034/ada/expect b/t/t4034/ada/expect
>> index be2376e..a682d28 100644
>> --- a/t/t4034/ada/expect
>> +++ b/t/t4034/ada/expect
>> @@ -4,7 +4,7 @@
>>  <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>'
>> +1 <RED>1e-10<RESET><GREEN>1e10<RESET> 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>
>> diff --git a/userdiff.c b/userdiff.c
>> index ea43a03..10b61ec 100644
>> --- a/userdiff.c
>> +++ b/userdiff.c
>> @@ -15,13 +15,13 @@ static int drivers_alloc;
>>  	  word_regex "|[^[:space:]]|[\xc0-\xff][\x80-\xbf]+" }
>>  static struct userdiff_driver builtin_drivers[] = {
>>  IPATTERN("ada",
>> -	 "!^(.*[ \t])?(is new|renames|is separate)([ \t].*)?$\n"
>> +	 "!^(.*[ \t])?(is[ \t]+new|renames|is[ \t]+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]"
>> +	 "|[-+]?[0-9][0-9#_.aAbBcCdDeEfF]*([eE][+-]?[0-9_]+)?"
> 
> This would match a lot wider than what I read you said you wanted to
> match in your previous message.  Does "-04##4_3_2Ee-9" count as a
> number, for example, or can we just ignore such syntactically
> incorrect sequence?

Maybe I am misunderstanding the purpose of the word diff regexes. I
thought the purpose of the word regex is to split lines into words, not
determine what is syntactically correct.

For example decimal number regex for pascal is: [-+0-9.e]+
and for cpp: [-+0-9.e]+[fFlL]?

These will obviously match stuff that is not a number.

> 
>>  	 "|=>|\\.\\.|\\*\\*|:=|/=|>=|<=|<<|>>|<>"),
>>  IPATTERN("fortran",
>>  	 "!^([C*]|[ \t]*!)\n"
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  reply	other threads:[~2014-02-05 10:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-02 10:51 [PATCH] userdiff: update Ada patterns Adrian Johnson
2014-02-02 23:35 ` Jeff King
2014-02-03 11:30   ` Adrian Johnson
2014-02-03 11:33   ` [PATCH v2] " Adrian Johnson
2014-02-03 20:00     ` Junio C Hamano
2014-02-05 10:44       ` Adrian Johnson [this message]
2014-02-05 17:17         ` Junio C Hamano
2014-02-05 17:28           ` Jeff King
  -- strict thread matches above, loose matches on Subject: below --
2014-02-03 18:33 George Spelvin
2014-02-03 20:05 ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52F2160D.1040006@redneon.com \
    --to=ajohnson@redneon.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).