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