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

Re: [PATCH] userdiff: remove empty subexpression from elixir regex

From
Jeff King <peff@peff.net>
Date
Dec 13, 2019, 17:45 UTC
Message-ID
<20191213174542.GB117158@coredump.intra.peff.net>
In-Reply-To
<20191213173902.71541-1-emaste@FreeBSD.org>
On Fri, Dec 13, 2019 at 05:39:02PM +0000, Ed Maste wrote:
Show 13 quoted lines
> diff --git a/userdiff.c b/userdiff.c
> index 324916f20f..165d7e8653 100644
> --- a/userdiff.c
> +++ b/userdiff.c
> @@ -35,7 +35,7 @@ PATTERNS("dts",
>  PATTERNS("elixir",
>  	 "^[ \t]*((def(macro|module|impl|protocol|p)?|test)[ \t].*)$",
>  	 /* Atoms, names, and module attributes */
> -	 "|[@:]?[a-zA-Z0-9@_?!]+"
> +	 "[@:]?[a-zA-Z0-9@_?!]+"
>  	 /* Numbers with specific base */
>  	 "|[-+]?0[xob][0-9a-fA-F]+"
>  	 /* Numbers */

It took me a minute to see why this was different than the similar "Numbers" line below. The issue is the comma at the end of the previous line; this is starting a new string, whereas the "Numbers" line is pasting to the existing string.

And that is the right thing, since these strings are the funcname and word_regex patterns, respectively.

So I think this is the correct fix. Many of the other regexes in this list use "/* -- */" to seperate the two for readability. Maybe worth doing here, too?

-Peff
Previous: Ed MasteNext: Ed Maste
Message 2 of 10 in “userdiff: remove empty subexpression from elixir regex”
  1. userdiff: remove empty subexpression from elixir regexEd Maste, Dec 13, 2019
  2. Jeff KingDec 13, 2019
  3. Ed MasteDec 13, 2019
  4. userdiff: remove empty subexpression from elixir regexEd Maste, Dec 13, 2019
  5. Jeff KingDec 13, 2019
  6. Johannes SixtDec 13, 2019
  7. Ed MasteDec 13, 2019
  8. Junio C HamanoDec 13, 2019
  9. Numbers with specific base (was: [PATCH] userdiff: remove empty subexpression from elixir regex)Achim Gratz, Dec 13, 2019
  10. Junio C HamanoDec 13, 2019

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.