emacs-devel
[Top][All Lists]
Advanced

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

Re: [Emacs-diffs] master 938d252 4/4: Make regex matching reentrant; upd


From: Stefan Monnier
Subject: Re: [Emacs-diffs] master 938d252 4/4: Make regex matching reentrant; update syntax during match
Date: Sun, 17 Jun 2018 14:42:25 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>     (unfreeze_pattern, freeze_pattern): New functions.
>     (compile_pattern): Return a regexp_cache pointer instead of the
>     re_pattern_buffer, allowing callers to use `freeze_pattern' if
>     needed.  Do not consider busy patterns as cache hit candidates;
>     error if we run out of non-busy cache entries.

IIRC the main/only reason why you can't use a compiled pattern in
a reentrant way is because the \{N,M\} repetitions use a counter that's
stored directly within the compiled pattern.

But these are fairly rare.

So we could easily change the code to add a boolean stating whether there
is such a repetition-counter in the pattern, and if there isn't then
"freeze" can just do nothing because we can freely use that pattern
multiple times at the same time.


        Stefan



reply via email to

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