From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#37659: rx additions: anychar, unmatchable, unordered-or Date: Wed, 9 Oct 2019 10:59:43 +0200 Message-ID: <7926BA83-93AB-47A5-875E-229BE7192874@acm.org> References: Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_3B02A38C-4C65-4D55-81B5-62C49B99F18A" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="217730"; mail-complaints-to="usenet@blaine.gmane.org" To: 37659@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 09 19:01:27 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iIFL4-000uSS-L9 for geb-bug-gnu-emacs@m.gmane.org; Wed, 09 Oct 2019 19:01:27 +0200 Original-Received: from localhost ([::1]:52678 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iIFL2-0002qw-MR for geb-bug-gnu-emacs@m.gmane.org; Wed, 09 Oct 2019 13:01:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49053) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iI7pD-0001Zb-Up for bug-gnu-emacs@gnu.org; Wed, 09 Oct 2019 05:00:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iI7pC-0008AT-Vt for bug-gnu-emacs@gnu.org; Wed, 09 Oct 2019 05:00:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43309) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iI7pC-00089r-JK for bug-gnu-emacs@gnu.org; Wed, 09 Oct 2019 05:00:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iI7pC-0003CE-Hy for bug-gnu-emacs@gnu.org; Wed, 09 Oct 2019 05:00:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 09 Oct 2019 09:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37659 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 37659-submit@debbugs.gnu.org id=B37659.157061159412242 (code B ref 37659); Wed, 09 Oct 2019 09:00:02 +0000 Original-Received: (at 37659) by debbugs.gnu.org; 9 Oct 2019 08:59:54 +0000 Original-Received: from localhost ([127.0.0.1]:52130 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iI7p3-0003BO-N5 for submit@debbugs.gnu.org; Wed, 09 Oct 2019 04:59:53 -0400 Original-Received: from mail239c50.megamailservers.eu ([91.136.10.249]:58508 helo=mail56c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iI7p0-0003BE-PB for 37659@debbugs.gnu.org; Wed, 09 Oct 2019 04:59:52 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1570611588; bh=8OatQhlrNY0RGT7KkegWzZRqEZPO19P6xjPIYlIms7o=; h=From:Subject:Date:To:From; b=JsYxHLDNramIXXtA8Zc3npeiGRbg65nWydmLCHWBf40k+4rKbJbir1zwwgU97gb5N cQngR6AxZQ0ArPuzYeyrEtM/kVZpxqViVFlUwZfcnKLR2/cAE3M56cEAM8S4AM83mz ocM0SmGt20Ml008zosU62Dkmk8MXAAsyTqUZaSTc= Feedback-ID: mattiase@acm.or Original-Received: from [192.168.1.65] (c-e636e253.032-75-73746f71.bbcust.telenor.se [83.226.54.230]) (authenticated bits=0) by mail56c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id x998xh03009167 for <37659@debbugs.gnu.org>; Wed, 9 Oct 2019 08:59:48 +0000 X-Mailer: Apple Mail (2.3445.104.11) X-CTCH-RefID: str=0001.0A0B020C.5D9DA184.005D, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=V9gDLtvi c=1 sm=1 tr=0 a=M+GU/qJco4WXjv8D6jB2IA==:117 a=M+GU/qJco4WXjv8D6jB2IA==:17 a=M51BFTxLslgA:10 a=yfByiC1x32EFdN7T0pwA:9 a=CjuIK1q_8ugA:10 a=NEe33fA4q6k3_J40bDIA:9 a=B2y7HmGcmWMA:10 a=pHzHmUro8NiASowvMSCR:22 a=6VlIyEUom7LUIeUMNQJH:22 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:168720 Archived-At: --Apple-Mail=_3B02A38C-4C65-4D55-81B5-62C49B99F18A Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Also consider changing the rendition of anychar/anything from ".\\|\n" = to "[^z-a]", which is faster and does not allocate stack space. = Previously, (* anything) wouldn't match large strings. --Apple-Mail=_3B02A38C-4C65-4D55-81B5-62C49B99F18A Content-Disposition: attachment; filename=0004-Use-z-a-for-matching-any-character-anychar-anything-.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0004-Use-z-a-for-matching-any-character-anychar-anything-.patch" Content-Transfer-Encoding: quoted-printable =46rom=20c72633774b375eaadd6117eb0b26fb9792fed1bd=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Wed,=209=20Oct=202019=2010:22:10=20+0200=0A= Subject:=20[PATCH=204/4]=20Use=20[^z-a]=20for=20matching=20any=20= character=20(anychar/anything)=0A=20in=20rx=0AMIME-Version:=201.0=0A= Content-Type:=20text/plain;=20charset=3DUTF-8=0A= Content-Transfer-Encoding:=208bit=0A=0A*=20lisp/emacs-lisp/rx.el=20= (rx--translate-symbol):=0A*=20test/lisp/emacs-lisp/rx-tests.el=20= (rx-any,=20rx-atoms):=0AUse=20[^z-a]=20instead=20of=20".\\|\n"=20for=20= anychar.=0A=0AThe=20new=20expression=20is=20faster=20(about=202=C3=97)=20= and=20does=20not=20allocate=20regexp=0Astack=20space.=20=20For=20= example,=20(0+=20anychar)=20now=20matches=20strings=20of=20any=0Asize.=0A= ---=0A=20lisp/emacs-lisp/rx.el=20=20=20=20=20=20=20=20=20=20=20=20|=202=20= +-=0A=20test/lisp/emacs-lisp/rx-tests.el=20|=206=20+++---=0A=202=20files=20= changed,=204=20insertions(+),=204=20deletions(-)=0A=0Adiff=20--git=20= a/lisp/emacs-lisp/rx.el=20b/lisp/emacs-lisp/rx.el=0Aindex=20= 0b14144698..2f58033ffd=20100644=0A---=20a/lisp/emacs-lisp/rx.el=0A+++=20= b/lisp/emacs-lisp/rx.el=0A@@=20-131,7=20+131,7=20@@=20= rx--translate-symbol=0A=20=20=20=20=20;;=20Use=20`list'=20instead=20of=20= a=20quoted=20list=20to=20wrap=20the=20strings=20here,=0A=20=20=20=20=20= ;;=20since=20the=20return=20value=20may=20be=20mutated.=0A=20=20=20=20=20= ((or=20'nonl=20'not-newline=20'any)=20(cons=20(list=20".")=20t))=0A-=20=20= =20=20((or=20'anychar=20'anything)=20=20=20=20=20=20(rx--translate-form=20= '(or=20nonl=20"\n")))=0A+=20=20=20=20((or=20'anychar=20'anything)=20=20=20= =20=20=20(cons=20(list=20"[^z-a]")=20t))=0A=20=20=20=20=20('unmatchable=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(rx--empty))=0A=20=20=20=20= =20((or=20'bol=20'line-start)=20=20=20=20=20=20=20=20(cons=20(list=20= "^")=20'lseq))=0A=20=20=20=20=20((or=20'eol=20'line-end)=20=20=20=20=20=20= =20=20=20=20(cons=20(list=20"$")=20'rseq))=0Adiff=20--git=20= a/test/lisp/emacs-lisp/rx-tests.el=20b/test/lisp/emacs-lisp/rx-tests.el=0A= index=20bced74569f..a098784a85=20100644=0A---=20= a/test/lisp/emacs-lisp/rx-tests.el=0A+++=20= b/test/lisp/emacs-lisp/rx-tests.el=0A@@=20-134,9=20+134,9=20@@=20rx-any=0A= =20=20=20(should=20(equal=20(rx=20(not=20(any=20"!a"=20"0-8"=20digit=20= nonascii)))=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= "[^!0-8a[:digit:][:nonascii:]]"))=0A=20=20=20(should=20(equal=20(rx=20= (any)=20(not=20(any)))=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20"\\`a\\`\\(?:.\\|\n\\)"))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20"\\`a\\`[^z-a]"))=0A=20=20=20(should=20(equal=20(rx=20(any=20= "")=20(not=20(any=20"")))=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20"\\`a\\`\\(?:.\\|\n\\)")))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20"\\`a\\`[^z-a]")))=0A=20=0A=20(ert-deftest=20rx-pcase=20()=0A= =20=20=20(should=20(equal=20(pcase=20"a=201=202=203=201=201=20b"=0A@@=20= -193,7=20+193,7=20@@=20rx-repeat=0A=20=0A=20(ert-deftest=20rx-atoms=20()=0A= =20=20=20(should=20(equal=20(rx=20anychar=20anything)=0A-=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20"\\(?:.\\|\n\\)\\(?:.\\|\n\\)"))=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20"[^z-a][^z-a]"))=0A=20=20=20= (should=20(equal=20(rx=20unmatchable)=0A=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20"\\`a\\`"))=0A=20=20=20(should=20(equal=20(rx=20= line-start=20not-newline=20nonl=20any=20line-end)=0A--=20=0A2.21.0=20= (Apple=20Git-122)=0A=0A= --Apple-Mail=_3B02A38C-4C65-4D55-81B5-62C49B99F18A--