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

Re: [PATCH v2 2/2] merge with Scheme regexp; fix bugs

From
Scott L. Burson <scott@sympoiesis.com>
Date
Jan 14, 2026, 06:18 UTC
Message-ID
<CAF5LJ4DrKkJpCfOkkEsYvDH7qF1Bx-v75GryxUbr6UgmJq05cw@mail.gmail.com>
In-Reply-To
<7c642644-09a5-4a50-931b-a630d459932d@kdbg.org>
On Tue, Dec 2, 2025 at 2:27 AM Johannes Sixt <j6t@kdbg.org> wrote:
Show 23 quoted lines
>
> Am 27.11.25 um 17:09 schrieb Johannes Sixt:
> > Am 27.11.25 um 03:38 schrieb Scott L. Burson via GitGitGadget:
> >>       /*
> >> -      * R7RS valid identifiers include any sequence enclosed
> >> -      * within vertical lines having no backslashes
> >> +      * The union of R7RS and Common Lisp symbol syntax: allows arbitrary
> >> +      * strings between vertical bars, including escaped backslashes and
> >> +      * vertical bars.
> >>        */
> >> -     "\\|([^\\\\]*)\\|"
> >> +     "\\|([^\\\\]|\\\\\\\\|\\\\\\|)*\\|"
> >
> > Without the C quoting we have
> >
> >       \|([^\\]|\\\\|\\\|)*\|
> >
> > So, this is everthing from | up to the next |, except that \| does not
> > stop scanning and \\ is also considered so that \\| is not regarded as \
> > followed by \|. Good.
>
> Actually, no. Regular expressions don't choose the first match if a
> different alternative gives a longer match in total.
Ah, good catch.

I noticed another bug. At least in Common Lisp, and I expect also in Scheme, while backslash and vertical bar are the only characters that must be escaped to be included, in fact any character _may_ be escaped. (This came to my attention when Emacs Paredit escaped a double-quote for me, between vertical bars, unnecessarily. Of course, in a string, double-quote would need to be escaped.)

So the correct regexp, with both of these bugs fixed, is
    "\\|([^|\\\\]|\\\\.)*\\|"
Or, without the C quoting:
    \|([^|\\]|\\.)*\|
For example, for
Show 14 quoted lines
> the change
>
> -  (let ((|one two| |three four|)))
> +  (let ((|1 two| |three four|)))
>
> we get to see the word diff
>
>   (let (([-|one two| |three four|-]{+|1 two| |three four|+})))
>
> but the desired result is
>
>   (let (([-|one two|-]{+|1 two|+} |three four|)))
>
> I think it helps to include | in the bracket expression.
Done.
> It may be worth its own patch that also adds a test in t/t4034/scheme/.

I updated the existing test to check for both of these bugs (and verified that it did so by reintroducing them). It's all in this one patch.

The branch now contains two commits, yours and mine. Do I just do /submit at this point, or do I need to submit them separately?

Previous: Johannes SixtNext: Johannes Sixt
Message 16 of 27 in “diff: "lisp" userdiff_driver”
  1. diff: "lisp" userdiff_driverScott L. Burson via GitGitGadget, Nov 15, 2025
  2. Johannes SixtNov 15, 2025
  3. Scott L. BursonNov 15, 2025
  4. D. Ben KnobleNov 20, 2025
  5. Scott L. BursonNov 27, 2025
  6. Junio C HamanoNov 16, 2025
  7. Scott L. BursonNov 17, 2025
  8. Junio C HamanoNov 18, 2025
  9. 0/2 userdiff: extend Scheme support to cover other Lisp dialectsScott L. Burson via GitGitGadget, Nov 27, 2025
  10. 1/2 diff: "lisp" userdiff_driverScott L. Burson via GitGitGadget, Nov 27, 2025
  11. Scott L. BursonNov 27, 2025
  12. Johannes SixtNov 27, 2025
  13. 2/2 merge with Scheme regexp; fix bugsScott L. Burson via GitGitGadget, Nov 27, 2025
  14. Johannes SixtNov 27, 2025
  15. Johannes SixtDec 2, 2025
  16. Scott L. BursonJan 14, 2026
  17. Johannes SixtJan 14, 2026
  18. 0/2 userdiff: extend Scheme support to cover other Lisp dialectsScott L. Burson via GitGitGadget, Jan 15, 2026
  19. 1/2 userdiff: tighten word-diff test case of the scheme driverJohannes Sixt via GitGitGadget, Jan 15, 2026
  20. 2/2 userdiff: extend Scheme support to cover other Lisp dialectsScott L. Burson via GitGitGadget, Jan 15, 2026
  21. Johannes SixtJan 16, 2026
  22. Scott L. BursonJan 17, 2026
  23. Johannes SixtJan 17, 2026
  24. 0/2 userdiff: extend Scheme support to cover other Lisp dialectsScott L. Burson via GitGitGadget, Apr 15, 2026
  25. 1/2 userdiff: tighten word-diff test case of the scheme driverJohannes Sixt via GitGitGadget, Apr 15, 2026
  26. 2/2 userdiff: extend Scheme support to cover other Lisp dialectsScott L. Burson via GitGitGadget, Apr 15, 2026
  27. Johannes SixtApr 15, 2026

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.