Subject: Re: bug#76731: C-style comment regexp example in (info "(elisp)Rx Notation") is not correct

From: Mattias Engdegård <[email-masked]>
Date: Tue, 20 May 2025 13:48:45 +0200

20 maj 2025 kl. 00.42 skrev Stefan Monnier <[email-masked]>:

> Our regexp engine lacks to "switch" kind of operation needed for that.
> After a series of `*` we have two mutually exclusive paths, depending on whether
> the next char is a `/` or something else, but we don't have a "look
> ahead" so we have to push a backtrack-point before we try to match the
> next char with `/`.

All true but we do have the ad-hoc non-backtracking optimisation. Right now it's only used for 'simple' patterns as in

(: (* "a") "b")

but there shouldn't be any reason not to use it for, say,

(: (* "a" ARBITRARY-PATTERN) "b")

should it? Except for ease of implementation, of course.