help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How are regexen implemented in Emacs?


From: Stefan Monnier
Subject: Re: How are regexen implemented in Emacs?
Date: Mon, 12 Dec 2022 16:19:19 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

> The linked article sounded a bit like "only idiots implement regexen
> in the naive way", and I was pretty sure Emacs devs are not idiots - but
> now I understand the reasons better.

I fully agree that it doesn't make sense to *start* with
a backtracking implementation, yes.
But once you've invested in one, it's harder to move to
something better.

This said, it *would* be better.  Not only in terms of eliminating the
pathological blow ups, but it also offers opportunity to get new
functionality, such as the ability to capture the state of a regexp
match at a specific buffer position (so you can perform a multiline
regexp match one line at a time).  It could also make it much more
reasonable to add the possibility to run ELisp code from within the
regexp match engine (e.g. add a \p(NAME) entry which calls the NAME
ELisp function).


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]