All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Sixt <j6t@kdbg.org>
To: Ryan Zoeller <rtzoeller@rtzoeller.com>
Cc: Ryan Zoeller via GitGitGadget <gitgitgadget@gmail.com>,
	"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH] userdiff: add Julia to supported userdiff languages
Date: Fri, 10 Jan 2020 21:14:36 +0100	[thread overview]
Message-ID: <cf486cb7-0ea5-92e8-1454-5059ea009ddf@kdbg.org> (raw)
In-Reply-To: <YqXJB_En1hjDpzUmawtrEYBztOGh_1uSmwxsQyQ646RtwGnYppq-xg26rwM0x5pu6E8PMVq22HwfSSFXN9aaD9BowSUH1YfztHRUomhOe6E=@rtzoeller.com>

Am 10.01.20 um 19:15 schrieb Ryan Zoeller:
> On Friday, January 10, 2020 11:43 AM, Johannes Sixt <j6t@kdbg.org> wrote:
>> Am 10.01.20 um 04:10 schrieb Ryan Zoeller via GitGitGadget:
>>> -   /* Real and complex literals */
>>> -   "|[-+0-9.e_(im)]+"
>>
>> I am curious: is '(1+2i)' a single literal -- including the parentheses?
>> The expression would also mistake the character sequence '-1)+(2+' as a
>> single word; is it intended?
> 
> This part of the regular expression has a pretty major mistake due
> to me misunderstanding how the parentheses were being interpreted.
> It should be something along the lines of `([-+0-9.e_]|im)+`.
> 
> Julia uses `im` as the designation for an imaginary value; this regex
> was intended to admit e.g. 1+2im, in addition other numeric values
> such as 1_000_000 and 1e10.
I see. I suggest to treat 1+2im as three words '1', '+', and '2im', and
to model numbers in this way:

	|[0-9][0-9_.]*(e[-+]?[0-9_]*)?(im)?

In particular, require a digit at the begin, and do not allow '-' and
'+' an arbitrary number of times, because it would catch 1+2+3+4 as a
single word.

-- Hannes

      reply	other threads:[~2020-01-10 20:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-10  3:10 [PATCH] userdiff: add Julia to supported userdiff languages Ryan Zoeller via GitGitGadget
2020-01-10 13:51 ` Johannes Schindelin
2020-01-10 17:43 ` Johannes Sixt
2020-01-10 18:15   ` Ryan Zoeller
2020-01-10 20:14     ` Johannes Sixt [this message]

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=cf486cb7-0ea5-92e8-1454-5059ea009ddf@kdbg.org \
    --to=j6t@kdbg.org \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=rtzoeller@rtzoeller.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.