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

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

Re: `looking-back' strange warning


From: Stefan Monnier
Subject: Re: `looking-back' strange warning
Date: Sat, 03 Oct 2015 14:11:08 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

>> It could be made faster
> Oh yes.

BTW, one easyish way to make a "fast looking-back" would be the
following:
- take GNU ELPA's "lex" package.
- add function that reverses a lex regexp (these are rx.el style sexps,
  so such a reversal should be very easy to do).
- copy "lex-match-buffer" into a new "lex-match-buffer-backward"
  reversing the operations to go backward (we're talking about 30 lines
  of code only).
- put it all together "lex-parse-re -> mylex-reverse ->
  lex-compile -> lex-match-buffer-backward".

The result should be reasonably fast, assuming all the steps until
lex-compile can be done at compile-time (in my tests lex-match-buffer
was reasonably competitive with the regexp.c engine, even tho it's
written in Elisp).

Of course it won't be 100% compatible with looking-back.   E.g. lex.el
doesn't support backreferences and you can't extract the submatches.

        Stefan




reply via email to

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