From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel 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 Message-ID: References: <20180616204650.8423.73499@vcs0.savannah.gnu.org> <20180616204653.86AFC203CB@vcs0.savannah.gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1529260859 28529 195.159.176.226 (17 Jun 2018 18:40:59 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 17 Jun 2018 18:40:59 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Daniel Colascione To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jun 17 20:40:55 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fUcbf-0007KN-BU for ged-emacs-devel@m.gmane.org; Sun, 17 Jun 2018 20:40:55 +0200 Original-Received: from localhost ([::1]:56070 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUcdm-0005QY-Kq for ged-emacs-devel@m.gmane.org; Sun, 17 Jun 2018 14:43:06 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUcdE-0005QS-Kz for emacs-devel@gnu.org; Sun, 17 Jun 2018 14:42:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fUcdB-0004x1-Gz for emacs-devel@gnu.org; Sun, 17 Jun 2018 14:42:32 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:59384) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUcdB-0004we-CN for emacs-devel@gnu.org; Sun, 17 Jun 2018 14:42:29 -0400 Original-Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id w5HIgQFe019865; Sun, 17 Jun 2018 14:42:26 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id D65BF656ED; Sun, 17 Jun 2018 14:42:25 -0400 (EDT) In-Reply-To: <20180616204653.86AFC203CB@vcs0.savannah.gnu.org> (Daniel Colascione's message of "Sat, 16 Jun 2018 16:46:53 -0400 (EDT)") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV6309=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6309> : inlines <6702> : streams <1789969> : uri <2659819> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.22 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:226417 Archived-At: > (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