From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ilya Zakharevich Newsgroups: gmane.emacs.help Subject: Re: will we ever have zero width assertions in regexps? Date: Fri, 28 Jan 2011 23:49:57 +0000 (UTC) Organization: U.C. Berkeley Math. Department. Message-ID: References: NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1296261639 3389 80.91.229.12 (29 Jan 2011 00:40:39 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 29 Jan 2011 00:40:39 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jan 29 01:40:35 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Piyri-00054B-JP for geh-help-gnu-emacs@m.gmane.org; Sat, 29 Jan 2011 01:40:34 +0100 Original-Received: from localhost ([127.0.0.1]:46086 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Piyrh-0003CJ-JM for geh-help-gnu-emacs@m.gmane.org; Fri, 28 Jan 2011 19:40:33 -0500 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!news2.euro.net!xlned.com!feeder3.xlned.com!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 30 Injection-Date: Fri, 28 Jan 2011 23:49:57 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="LlLjF8LevGdIZWbTvv+SXA"; logging-data="666"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+kmjgK1I2WO+LwL1wt9P6Y" User-Agent: slrn/0.9.8.1pl1 (Linux) Cancel-Lock: sha1:WIMPJEGOQFl43g0E8OIbRVCDbFc= Original-Xref: usenet.stanford.edu gnu.emacs.help:184664 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:78819 Archived-At: On 2011-01-27, Stefan Monnier wrote: >>> similar to Lua's Lpeg. I myself would also be more interested in >>> replacing the backtracking matcher with a non-backtracking one (for the >>> cases where backtracking is not required by backrefs). >> What for? [After my final round of backtracking-optimizations for >> Perl REx engine, I do not recollect people (loudly) wanting anything >> like this for Perl anymore...] > > To get rid of the occasional pathological case where matching takes > forever and Emacs appears to be frozen. Programmers who are used to > backtracking matchers will usually intuitively stay away from regexps > that can show such behaviors, but not all programmers do, and even if > you're careful there are cases that are hard to avoid. Did you try it with Perl recently (last 10 years or so)? As I said, I put some optimizations which in most (AFAIK) practical senses remove such pathologies. (The underlying problems remain; the optimizations are only "heuristic"; but one needs to be extra inventive to circumvent the optimizations.) > Another minor reason is that it can be handy to have an incremental > matching primitive, so you can match over a long string one chunk at > a time. I'm not sure how often this would be useful, but I've come > across a few cases where it seemed like it could be put to good use > (tho, for lack of experience with it, I can't sweat that it would turn > out to be a good idea). Do not know what you mean by this... Ilya