From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: `looking-back' strange warning Date: Sat, 03 Oct 2015 14:11:08 -0400 Message-ID: References: <560B9C7F.2060301@easy-emacs.de> <560CD7CE.4010404@yandex.ru> <6524c81a-949c-40d1-b990-d214d6ee5b60@default> <560D73DF.8040403@yandex.ru> <560D7A68.8040404@easy-emacs.de> <560D8289.6010409@yandex.ru> <560D8F96.5040200@easy-emacs.de> <87io6pxf55.fsf@tromey.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1443895913 4155 80.91.229.3 (3 Oct 2015 18:11:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 3 Oct 2015 18:11:53 +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 Oct 03 20:11:44 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZiRHX-0001zr-VQ for geh-help-gnu-emacs@m.gmane.org; Sat, 03 Oct 2015 20:11:40 +0200 Original-Received: from localhost ([::1]:39572 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZiRHX-0001JZ-6P for geh-help-gnu-emacs@m.gmane.org; Sat, 03 Oct 2015 14:11:39 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39780) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZiRHK-0001Em-09 for help-gnu-emacs@gnu.org; Sat, 03 Oct 2015 14:11:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZiRHE-0005LR-DE for help-gnu-emacs@gnu.org; Sat, 03 Oct 2015 14:11:25 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:53734) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZiRHE-0005LE-69 for help-gnu-emacs@gnu.org; Sat, 03 Oct 2015 14:11:20 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1ZiRHB-0001ZJ-2I for help-gnu-emacs@gnu.org; Sat, 03 Oct 2015 20:11:17 +0200 Original-Received: from 69-196-161-8.dsl.teksavvy.com ([69.196.161.8]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 03 Oct 2015 20:11:17 +0200 Original-Received: from monnier by 69-196-161-8.dsl.teksavvy.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 03 Oct 2015 20:11:17 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 23 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 69-196-161-8.dsl.teksavvy.com User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:ibNrxFnvo2jIdimb+GtVrc1nN34= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:107498 Archived-At: >> 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