git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] userdiff: add Julia to supported userdiff languages

From
Johannes Sixt <j6t@kdbg.org>
Date
Jan 10, 2020, 20:14 UTC
Message-ID
<cf486cb7-0ea5-92e8-1454-5059ea009ddf@kdbg.org>
In-Reply-To
<YqXJB_En1hjDpzUmawtrEYBztOGh_1uSmwxsQyQ646RtwGnYppq-xg26rwM0x5pu6E8PMVq22HwfSSFXN9aaD9BowSUH1YfztHRUomhOe6E=@rtzoeller.com>
Am 10.01.20 um 19:15 schrieb Ryan Zoeller:
Show 16 quoted lines
> 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
Previous: Ryan Zoeller
Message 5 of 5 in “userdiff: add Julia to supported userdiff languages”
  1. userdiff: add Julia to supported userdiff languagesRyan Zoeller via GitGitGadget, Jan 10, 2020
  2. Johannes SchindelinJan 10, 2020
  3. Johannes SixtJan 10, 2020
  4. Ryan ZoellerJan 10, 2020
  5. Johannes SixtJan 10, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.