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

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

Re: will we ever have zero width assertions in regexps?


From: Ilya Zakharevich
Subject: Re: will we ever have zero width assertions in regexps?
Date: Fri, 28 Jan 2011 23:49:57 +0000 (UTC)
User-agent: slrn/0.9.8.1pl1 (Linux)

On 2011-01-27, Stefan Monnier <monnier@iro.umontreal.ca> 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


reply via email to

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