Re: [GSoC][RFC/PATCH] userdiff: added support for diffing shell scripts
- From
Thomas Gummerer <t.gummerer@gmail.com>
- Date
- Mar 28, 2019, 21:30 UTC
- Message-ID
- <20190328213010.GI32487@hank.intra.tgummerer.com>
- In-Reply-To
- <CAMknYENJ+U4urtSEtwDSLpdwGe=x=uq_HdSs-cT9Z+PT5ZQiLg@mail.gmail.com>
On 03/24, Kapil Jain wrote:
Show 10 quoted lines
> On Sun, Mar 24, 2019 at 2:49 PM Christian Couder > <christian.couder@gmail.com> wrote: > > > > The test_language_driver() function used to test the regexps is > > ... > > GIT_TEST_CMP which is usually either "diff -u" or "diff -c". > > Thanks. > > please provide some insights on the regex mentioned below:
I had previously mentioned that this project was attempted already in my email at [*1*]. Did you take a look at the thread I linked to there, and the regex used? I still feel like that previous experience is something you could learn from.
But that said, I think your assumption in the other email that the output should be
[-$TEST_DIRECTORY-] {+$TEST_DIR+}
might not be correct. The tests are using 'git diff --word-diff=color', rather than 'git diff --word-diff=plain'. Only the latter would add the [- -] and {+ +} around the changed words, while the former adds the color, which the tests are testing for.
*1*: https://public-inbox.org/git/20190315230515.GJ16414@hank.intra.tgummerer.com/
Show 11 quoted lines
> +
> +PATTERNS("shell",
> + /* Function Names */
> + "([A-Za-z_][A-Za-z0-9_]*)[[:space:]]*\\([[:space:]]*\\)[[:space:]]*\\{",
> + /* Words */
> + "([$#@A-Za-z_\"\'][$#@A-Za-z0-9_\"\']*)"),
> +
>
> reference mail:
> https://public-inbox.org/git/20190324084523.8744-1-jkapil.cs@gmail.com/.
> please let me know if the regex is not self explanatory.