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: Tue, 8 Oct 2019 11:36:44 +0200 Message-ID: Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_B90F51FF-B081-438E-9859-64846A71F9D1" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="66620"; 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 Tue Oct 08 11:37:15 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 1iHlve-000H8Z-GL for geb-bug-gnu-emacs@m.gmane.org; Tue, 08 Oct 2019 11:37:15 +0200 Original-Received: from localhost ([::1]:52982 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHlvd-0004vD-7t for geb-bug-gnu-emacs@m.gmane.org; Tue, 08 Oct 2019 05:37:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37500) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHlvT-0004ui-Bh for bug-gnu-emacs@gnu.org; Tue, 08 Oct 2019 05:37:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iHlvS-0001sJ-53 for bug-gnu-emacs@gnu.org; Tue, 08 Oct 2019 05:37:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40764) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iHlvS-0001sE-0p for bug-gnu-emacs@gnu.org; Tue, 08 Oct 2019 05:37:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iHlvR-0002yF-TH for bug-gnu-emacs@gnu.org; Tue, 08 Oct 2019 05:37:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 Oct 2019 09:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 37659 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.157052741711407 (code B ref -1); Tue, 08 Oct 2019 09:37:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 8 Oct 2019 09:36:57 +0000 Original-Received: from localhost ([127.0.0.1]:49585 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iHlvM-0002xu-Sk for submit@debbugs.gnu.org; Tue, 08 Oct 2019 05:36:57 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:39283) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iHlvK-0002xm-JV for submit@debbugs.gnu.org; Tue, 08 Oct 2019 05:36:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37473) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHlvJ-0004tD-6q for bug-gnu-emacs@gnu.org; Tue, 08 Oct 2019 05:36:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iHlvI-0001nK-0N for bug-gnu-emacs@gnu.org; Tue, 08 Oct 2019 05:36:52 -0400 Original-Received: from mail214c50.megamailservers.eu ([91.136.10.224]:40234 helo=mail193c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iHlvH-0001m0-A1 for bug-gnu-emacs@gnu.org; Tue, 08 Oct 2019 05:36:51 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1570527408; bh=zONrw5173hEmfGIqpfRHyBdUqcbly9I916GlHKhc+Y4=; h=From:Subject:Date:To:From; b=BsptC+ZurLVk+phdYoKPBtTCequOQKDXXyUZ3F+1saW6yv9RLGIWb6Ud2/fbryjPA 9sjKwkYlHNN2+9taprzrWjxYGGFrVfEmJq9wOqGNZNgi1TazMAFNEjH+MAdnp0oWXz 7CRpDfaEHbf5LVA0R95qbEBElNi9+XZ5/H3kiIy0= 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 mail193c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id x989ajQs002249 for ; Tue, 8 Oct 2019 09:36:47 +0000 X-Mailer: Apple Mail (2.3445.104.11) X-CTCH-RefID: str=0001.0A0B0212.5D9C58B0.0006, 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=b7vMHeOx c=1 sm=1 tr=0 a=M+GU/qJco4WXjv8D6jB2IA==:117 a=M+GU/qJco4WXjv8D6jB2IA==:17 a=M51BFTxLslgA:10 a=9lzXkryqxNDBGJw50dcA:9 a=CjuIK1q_8ugA:10 a=Tu2DVULvuFSytnuRUwkA:9 a=B2y7HmGcmWMA:10 a=6CYVNyq5QJvP7n3JsKEA:9 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] 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:168628 Archived-At: --Apple-Mail=_B90F51FF-B081-438E-9859-64846A71F9D1 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Three minor rx additions follow: * Add `anychar' as an alias for `anything': the latter suggests an = expression that can match any string, while in reality it only matches a = single character. The documentation now uses `anychar' as the preferred = name. (`any-char' would also be possible, but is longer.) * Add `unmatchable' for a never-match regexp. This follows the = previously introduced variable `regexp-unmatchable'. * Add `unordered-or' as a variant of `or' without the left-to-right = match order guarantee. It allows unconditional regexp-opt optimisations, = and is particularly useful for matching sets of keywords. With rx-let = and rx-define, it also has the potential for better compositionality, = allowing expressions to be put together from smaller parts. Abstractly: while `or' is associative, `unordered-or' is also = commutative. The name `unordered-or' is descriptive but phonetically (and lexically) = somewhat weak. Strong alternatives welcome. --Apple-Mail=_B90F51FF-B081-438E-9859-64846A71F9D1 Content-Disposition: attachment; filename=0001-Add-anychar-as-alias-to-anything-in-rx.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Add-anychar-as-alias-to-anything-in-rx.patch" Content-Transfer-Encoding: quoted-printable =46rom=200b79693cdace549a8d6edda58cea20232d82faec=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Mon,=207=20Oct=202019=2018:07:16=20+0200=0A= Subject:=20[PATCH=201/3]=20Add=20`anychar'=20as=20alias=20to=20= `anything'=20in=20rx=0A=0A*=20lisp/emacs-lisp/rx.el=20= (rx--translate-symbol,=20rx--builtin-symbols,=20rx):=0A*=20= test/lisp/emacs-lisp/rx-tests.el=20(rx-atoms):=0A*=20= doc/lispref/searching.texi=20(Rx=20Constructs):=0A*=20etc/NEWS:=0AAdd=20= `anychar',=20an=20alias=20for=20`anything'.=20=20Since=20`anychar'=20is=20= more=0Adescriptive=20(and=20slightly=20shorter),=20treat=20it=20as=20the=20= preferred=20name.=0A---=0A=20doc/lispref/searching.texi=20=20=20=20=20=20= =20|=203=20++-=0A=20etc/NEWS=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20|=204=20++++=0A=20lisp/emacs-lisp/rx.el=20=20= =20=20=20=20=20=20=20=20=20=20|=207=20+++----=0A=20= test/lisp/emacs-lisp/rx-tests.el=20|=204=20++--=0A=204=20files=20= changed,=2011=20insertions(+),=207=20deletions(-)=0A=0Adiff=20--git=20= a/doc/lispref/searching.texi=20b/doc/lispref/searching.texi=0Aindex=20= a4b6533412..2274bab002=20100644=0A---=20a/doc/lispref/searching.texi=0A= +++=20b/doc/lispref/searching.texi=0A@@=20-1220,7=20+1220,8=20@@=20Rx=20= Constructs=0A=20Match=20any=20character=20except=20a=20newline.@*=0A=20= Corresponding=20string=20regexp:=20@samp{.}=20(dot)=0A=20=0A-@item=20= @code{anything}=0A+@item=20@code{anychar},=20@code{anything}=0A+@cindex=20= @code{anychar}=20in=20rx=0A=20@cindex=20@code{anything}=20in=20rx=0A=20= Match=20any=20character.@*=0A=20Corresponding=20string=20regexp:=20= @samp{.\|\n}=20(for=20example)=0Adiff=20--git=20a/etc/NEWS=20b/etc/NEWS=0A= index=20906dc912d6..0fea5164a7=20100644=0A---=20a/etc/NEWS=0A+++=20= b/etc/NEWS=0A@@=20-1795,6=20+1795,10=20@@=20at=20run=20time,=20instead=20= of=20a=20constant=20string.=0A=20***=20New=20rx=20extension=20mechanism:=20= 'rx-define',=20'rx-let',=20'rx-let-eval'.=0A=20These=20macros=20add=20= new=20forms=20to=20the=20rx=20notation.=0A=20=0A++++=0A+***=20'anychar'=20= is=20now=20an=20alias=20for=20'anything'=0A+Both=20match=20any=20single=20= character;=20'anychar'=20is=20more=20descriptive.=0A+=0A=20**=20Frames=0A= =20=0A=20+++=0Adiff=20--git=20a/lisp/emacs-lisp/rx.el=20= b/lisp/emacs-lisp/rx.el=0Aindex=2045fec796cc..6c0b206930=20100644=0A---=20= a/lisp/emacs-lisp/rx.el=0A+++=20b/lisp/emacs-lisp/rx.el=0A@@=20-126,7=20= +126,6=20@@=20rx--lookup-def=0A=20=20=20=20=20=20=20(get=20name=20= 'rx-definition)))=0A=20=0A=20;;=20TODO:=20Additions=20to=20consider:=0A= -;;=20-=20A=20better=20name=20for=20`anything',=20like=20`any-char'=20or=20= `anychar'.=0A=20;;=20-=20A=20name=20for=20(or),=20maybe=20`unmatchable'.=0A= =20;;=20-=20A=20construct=20like=20`or'=20but=20without=20the=20match=20= order=20guarantee,=0A=20;;=20=20=20maybe=20`unordered-or'.=20=20Useful=20= for=20composition=20or=20generation=20of=0A@@=20-138,7=20+137,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('anything=20=20=20=20=20=20=20=20=20=20=20=20=20=20=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(rx--translate-form=20'(or=20nonl=20= "\n")))=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))=0A=20=20=20=20=20= ((or=20'bos=20'string-start=20'bot=20'buffer-start)=20(cons=20(list=20= "\\`")=20t))=0A@@=20-913,7=20+912,7=20@@=20rx--builtin-forms=0A=20=20=20= "List=20of=20built-in=20rx=20function-like=20symbols.")=0A=20=0A=20= (defconst=20rx--builtin-symbols=0A-=20=20(append=20'(nonl=20not-newline=20= any=20anything=0A+=20=20(append=20'(nonl=20not-newline=20any=20anychar=20= anything=0A=20=20=20=20=20=20=20=20=20=20=20=20=20bol=20eol=20line-start=20= line-end=0A=20=20=20=20=20=20=20=20=20=20=20=20=20bos=20eos=20= string-start=20string-end=0A=20=20=20=20=20=20=20=20=20=20=20=20=20bow=20= eow=20word-start=20word-end=0A@@=20-1016,7=20+1015,7=20@@=20rx=0A=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20can=20be=20(any=20...),=20= (syntax=20...),=20(category=20...),=0A=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20or=20a=20character=20class.=0A=20not-newline=20=20=20=20=20= Match=20any=20character=20except=20a=20newline.=20=20Alias:=20nonl.=0A= -anything=20=20=20=20=20=20=20=20Match=20any=20character.=0A+anychar=20=20= =20=20=20=20=20=20=20Match=20any=20character.=20=20Alias:=20anything.=0A=20= =0A=20CHARCLASS=20=20=20=20=20=20=20Match=20a=20character=20from=20a=20= character=20class.=20=20One=20of:=0A=20=20alpha,=20alphabetic,=20letter=20= =20=20Alphabetic=20characters=20(defined=20by=20Unicode).=0Adiff=20--git=20= a/test/lisp/emacs-lisp/rx-tests.el=20b/test/lisp/emacs-lisp/rx-tests.el=0A= index=2076dcf41942..d4524e5a25=20100644=0A---=20= a/test/lisp/emacs-lisp/rx-tests.el=0A+++=20= b/test/lisp/emacs-lisp/rx-tests.el=0A@@=20-184,8=20+184,8=20@@=20= rx-repeat=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= "ab")))=0A=20=0A=20(ert-deftest=20rx-atoms=20()=0A-=20=20(should=20= (equal=20(rx=20anything)=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20".\\|\n"))=0A+=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(should=20(equal=20(rx=20= line-start=20not-newline=20nonl=20any=20line-end)=0A=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20"^...$"))=0A=20=20=20(should=20(equal=20= (rx=20bol=20string-start=20string-end=20buffer-start=20buffer-end=0A--=20= =0A2.21.0=20(Apple=20Git-122)=0A=0A= --Apple-Mail=_B90F51FF-B081-438E-9859-64846A71F9D1 Content-Disposition: attachment; filename=0002-Add-unmatchable-as-alias-for-or-in-rx.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0002-Add-unmatchable-as-alias-for-or-in-rx.patch" Content-Transfer-Encoding: quoted-printable =46rom=206ad34bf9aa86aee6539851366c5267fa8a72d929=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Mon,=207=20Oct=202019=2018:28:18=20+0200=0A= Subject:=20[PATCH=202/3]=20Add=20`unmatchable'=20as=20alias=20for=20(or)=20= in=20rx=0A=0A*=20lisp/emacs-lisp/rx.el=20(rx--translate-symbol,=20= rx--builtin-symbols,=20rx):=0A*=20test/lisp/emacs-lisp/rx-tests.el=20= (rx-atoms):=0A*=20doc/lispref/searching.texi=20(Rx=20Constructs):=0A*=20= etc/NEWS:=0AAdd=20`unmatchable',=20more=20descriptive=20than=20(or),=20= and=20corresponding=20to=0Athe=20variable=20`regexp-unmatchable'.=0A---=0A= =20doc/lispref/searching.texi=20=20=20=20=20=20=20|=206=20++++++=0A=20= etc/NEWS=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20|=201=20+=0A=20lisp/emacs-lisp/rx.el=20=20=20=20=20=20=20=20=20=20= =20=20|=205=20+++--=0A=20test/lisp/emacs-lisp/rx-tests.el=20|=202=20++=0A= =204=20files=20changed,=2012=20insertions(+),=202=20deletions(-)=0A=0A= diff=20--git=20a/doc/lispref/searching.texi=20= b/doc/lispref/searching.texi=0Aindex=202274bab002..a6c6bf2d4a=20100644=0A= ---=20a/doc/lispref/searching.texi=0A+++=20b/doc/lispref/searching.texi=0A= @@=20-1083,6=20+1083,11=20@@=20Rx=20Constructs=0A=20Match=20exactly=20= one=20of=20the=20@var{rx}s,=20trying=20from=20left=20to=20right.=0A=20= Without=20arguments,=20the=20expression=20will=20not=20match=20anything=20= at=20all.@*=0A=20Corresponding=20string=20regexp:=20= @samp{@var{A}\|@var{B}\|@dots{}}.=0A+=0A+@item=20@code{unmatchable}=0A= +@cindex=20@code{unmatchable}=20in=20rx=0A+Refuse=20any=20match.=20=20= Equivalent=20to=20@code{(or)}.=0A+@xref{regexp-unmatchable}.=0A=20@end=20= table=0A=20=0A=20@subsubheading=20Repetition=0A@@=20-1806,6=20+1811,7=20= @@=20Regexp=20Functions=0A=20=0A=20@c=20Internal=20functions:=20= regexp-opt-group=0A=20=0A+@anchor{regexp-unmatchable}=0A=20@defvar=20= regexp-unmatchable=0A=20This=20variable=20contains=20a=20regexp=20that=20= is=20guaranteed=20not=20to=20match=20any=0A=20string=20at=20all.=20=20It=20= is=20particularly=20useful=20as=20default=20value=20for=0Adiff=20--git=20= a/etc/NEWS=20b/etc/NEWS=0Aindex=200fea5164a7..96c26c6623=20100644=0A---=20= a/etc/NEWS=0A+++=20b/etc/NEWS=0A@@=20-1785,6=20+1785,7=20@@=20the=20= 128...255=20range,=20as=20expected.=0A=20matches=20the=20empty=20string,=20= each=20being=20an=20identity=20for=20the=20operation.=0A=20This=20also=20= works=20for=20their=20aliases:=20'|'=20for=20'or';=20':',=20'and'=20and=0A= =20'sequence'=20for=20'seq'.=0A+The=20symbol=20'unmatchable'=20can=20be=20= used=20as=20an=20alternative=20to=20(or).=0A=20=0A=20---=0A=20***=20= 'regexp'=20and=20new=20'literal'=20accept=20arbitrary=20lisp=20as=20= arguments.=0Adiff=20--git=20a/lisp/emacs-lisp/rx.el=20= b/lisp/emacs-lisp/rx.el=0Aindex=206c0b206930..cf02df239f=20100644=0A---=20= a/lisp/emacs-lisp/rx.el=0A+++=20b/lisp/emacs-lisp/rx.el=0A@@=20-126,7=20= +126,6=20@@=20rx--lookup-def=0A=20=20=20=20=20=20=20(get=20name=20= 'rx-definition)))=0A=20=0A=20;;=20TODO:=20Additions=20to=20consider:=0A= -;;=20-=20A=20name=20for=20(or),=20maybe=20`unmatchable'.=0A=20;;=20-=20= A=20construct=20like=20`or'=20but=20without=20the=20match=20order=20= guarantee,=0A=20;;=20=20=20maybe=20`unordered-or'.=20=20Useful=20for=20= composition=20or=20generation=20of=0A=20;;=20=20=20alternatives;=20= permits=20more=20effective=20use=20of=20regexp-opt.=0A@@=20-138,6=20= +137,7=20@@=20rx--translate-symbol=0A=20=20=20=20=20;;=20since=20the=20= return=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=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('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))=0A=20=20=20=20=20((or=20'bos=20'string-start=20'bot=20= 'buffer-start)=20(cons=20(list=20"\\`")=20t))=0A@@=20-912,7=20+912,7=20= @@=20rx--builtin-forms=0A=20=20=20"List=20of=20built-in=20rx=20= function-like=20symbols.")=0A=20=0A=20(defconst=20rx--builtin-symbols=0A= -=20=20(append=20'(nonl=20not-newline=20any=20anychar=20anything=0A+=20=20= (append=20'(nonl=20not-newline=20any=20anychar=20anything=20unmatchable=0A= =20=20=20=20=20=20=20=20=20=20=20=20=20bol=20eol=20line-start=20line-end=0A= =20=20=20=20=20=20=20=20=20=20=20=20=20bos=20eos=20string-start=20= string-end=0A=20=20=20=20=20=20=20=20=20=20=20=20=20bow=20eow=20= word-start=20word-end=0A@@=20-1016,6=20+1016,7=20@@=20rx=0A=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20or=20a=20character=20class.=0A=20= not-newline=20=20=20=20=20Match=20any=20character=20except=20a=20= newline.=20=20Alias:=20nonl.=0A=20anychar=20=20=20=20=20=20=20=20=20= Match=20any=20character.=20=20Alias:=20anything.=0A+unmatchable=20=20=20=20= =20Never=20match=20anything=20at=20all.=0A=20=0A=20CHARCLASS=20=20=20=20=20= =20=20Match=20a=20character=20from=20a=20character=20class.=20=20One=20= of:=0A=20=20alpha,=20alphabetic,=20letter=20=20=20Alphabetic=20= characters=20(defined=20by=20Unicode).=0Adiff=20--git=20= a/test/lisp/emacs-lisp/rx-tests.el=20b/test/lisp/emacs-lisp/rx-tests.el=0A= index=20d4524e5a25..903b191c98=20100644=0A---=20= a/test/lisp/emacs-lisp/rx-tests.el=0A+++=20= b/test/lisp/emacs-lisp/rx-tests.el=0A@@=20-186,6=20+186,8=20@@=20= rx-repeat=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=20"\\(?:.\\|\n\\)\\(?:.\\|\n\\)"))=0A+=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= "\\`a\\`"))=0A=20=20=20(should=20(equal=20(rx=20line-start=20not-newline=20= nonl=20any=20line-end)=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20"^...$"))=0A=20=20=20(should=20(equal=20(rx=20bol=20string-start=20= string-end=20buffer-start=20buffer-end=0A--=20=0A2.21.0=20(Apple=20= Git-122)=0A=0A= --Apple-Mail=_B90F51FF-B081-438E-9859-64846A71F9D1 Content-Disposition: attachment; filename=0003-Add-rx-unordered-or-construct.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0003-Add-rx-unordered-or-construct.patch" Content-Transfer-Encoding: quoted-printable =46rom=2055bbcccf26e95bcb69a27431d72a802b7e457a75=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Mon,=207=20Oct=202019=2019:39:08=20+0200=0A= Subject:=20[PATCH=203/3]=20Add=20rx=20`unordered-or'=20construct=0A=0A*=20= lisp/emacs-lisp/rx.el=20(rx--translate-or,=20rx--translate-form)=0A= (rx--builting-forms,=20rx):=0A*=20test/lisp/emacs-lisp/rx-tests.el=20= (rx-unordered-or):=0A*=20doc/lispref/searching.texi=20(Rx=20Constructs):=0A= *=20etc/NEWS:=0AAdd=20`unordered-or',=20like=20`or'=20but=20with=20= unconstrained=20matching=20order.=0A---=0A=20doc/lispref/searching.texi=20= =20=20=20=20=20=20|=20=208=20++++++++=0A=20etc/NEWS=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20|=20=205=20+++++=0A=20= lisp/emacs-lisp/rx.el=20=20=20=20=20=20=20=20=20=20=20=20|=2016=20= +++++++---------=0A=20test/lisp/emacs-lisp/rx-tests.el=20|=20=208=20= ++++++++=0A=204=20files=20changed,=2028=20insertions(+),=209=20= deletions(-)=0A=0Adiff=20--git=20a/doc/lispref/searching.texi=20= b/doc/lispref/searching.texi=0Aindex=20a6c6bf2d4a..faeedc5978=20100644=0A= ---=20a/doc/lispref/searching.texi=0A+++=20b/doc/lispref/searching.texi=0A= @@=20-1084,6=20+1084,13=20@@=20Rx=20Constructs=0A=20Without=20arguments,=20= the=20expression=20will=20not=20match=20anything=20at=20all.@*=0A=20= Corresponding=20string=20regexp:=20@samp{@var{A}\|@var{B}\|@dots{}}.=0A=20= =0A+@item=20@code{(unordered-or=20@var{rx}@dots{})}=0A+@cindex=20= @code{unordered-or}=20in=20rx=0A+Like=20@code{or},=20but=20with=20= unspecified=20matching=20order.=0A+This=20may=20be=20more=20efficient=20= when=20the=20order=20doesn't=20matter,=0A+in=20particular=20if=20all=20= subforms=20are=20string=20literals.=0A+@xref{regexp-opt}.=0A+=0A=20@item=20= @code{unmatchable}=0A=20@cindex=20@code{unmatchable}=20in=20rx=0A=20= Refuse=20any=20match.=20=20Equivalent=20to=20@code{(or)}.=0A@@=20-1728,6=20= +1735,7=20@@=20Regexp=20Functions=0A=20any=20special=20characters.=0A=20= @end=20defun=0A=20=0A+@anchor{regexp-opt}=0A=20@cindex=20optimize=20= regexp=0A=20@defun=20regexp-opt=20strings=20&optional=20paren=20= keep-order=0A=20This=20function=20returns=20an=20efficient=20regular=20= expression=20that=20will=20match=0Adiff=20--git=20a/etc/NEWS=20= b/etc/NEWS=0Aindex=2096c26c6623..cf3ef8183b=20100644=0A---=20a/etc/NEWS=0A= +++=20b/etc/NEWS=0A@@=20-1800,6=20+1800,11=20@@=20These=20macros=20add=20= new=20forms=20to=20the=20rx=20notation.=0A=20***=20'anychar'=20is=20now=20= an=20alias=20for=20'anything'=0A=20Both=20match=20any=20single=20= character;=20'anychar'=20is=20more=20descriptive.=0A=20=0A++++=0A+***=20= New=20'unordered-or'=20rx=20construct=0A+It=20works=20like=20'or',=20but=20= with=20unspecified=20matching=20order.=20=20It=20may=20be=0A+faster=20in=20= some=20cases,=20especially=20when=20the=20clauses=20are=20string=20= literals.=0A+=0A=20**=20Frames=0A=20=0A=20+++=0Adiff=20--git=20= a/lisp/emacs-lisp/rx.el=20b/lisp/emacs-lisp/rx.el=0Aindex=20= cf02df239f..0b14144698=20100644=0A---=20a/lisp/emacs-lisp/rx.el=0A+++=20= b/lisp/emacs-lisp/rx.el=0A@@=20-125,11=20+125,6=20@@=20rx--lookup-def=0A=20= =20=20(or=20(cdr=20(assq=20name=20rx--local-definitions))=0A=20=20=20=20=20= =20=20(get=20name=20'rx-definition)))=0A=20=0A-;;=20TODO:=20Additions=20= to=20consider:=0A-;;=20-=20A=20construct=20like=20`or'=20but=20without=20= the=20match=20order=20guarantee,=0A-;;=20=20=20maybe=20`unordered-or'.=20= =20Useful=20for=20composition=20or=20generation=20of=0A-;;=20=20=20= alternatives;=20permits=20more=20effective=20use=20of=20regexp-opt.=0A-=0A= =20(defun=20rx--translate-symbol=20(sym)=0A=20=20=20"Translate=20an=20rx=20= symbol.=20=20Return=20(REGEXP=20.=20PRECEDENCE)."=0A=20=20=20(pcase=20= sym=0A@@=20-230,8=20+225,9=20@@=20rx--every=0A=20=20=20=20=20(setq=20= list=20(cdr=20list)))=0A=20=20=20(null=20list))=0A=20=0A-(defun=20= rx--translate-or=20(body)=0A+(defun=20rx--translate-or=20(body=20= unordered)=0A=20=20=20"Translate=20an=20or-pattern=20of=20one=20of=20= more=20rx=20items.=0A+If=20UNORDERED,=20then=20matching=20order=20is=20= unspecified.=0A=20Return=20(REGEXP=20.=20PRECEDENCE)."=0A=20=20=20;;=20= FIXME:=20Possible=20improvements:=0A=20=20=20;;=0A@@=20-268,7=20+264,7=20= @@=20rx--translate-or=0A=20=20=20=20((null=20(cdr=20body))=20=20=20=20=20= =20=20=20=20=20=20=20=20=20;=20Single=20item.=0A=20=20=20=20=20= (rx--translate=20(car=20body)))=0A=20=20=20=20((rx--every=20#'stringp=20= body)=20=20=20=20=20;=20All=20strings.=0A-=20=20=20=20(cons=20(list=20= (regexp-opt=20body=20nil=20t))=0A+=20=20=20=20(cons=20(list=20= (regexp-opt=20body=20nil=20(not=20unordered)))=0A=20=20=20=20=20=20=20=20= =20=20=20t))=0A=20=20=20=20(t=0A=20=20=20=20=20(cons=20(append=20(car=20= (rx--translate=20(car=20body)))=0A@@=20-835,7=20+831,8=20@@=20= rx--translate-form=0A=20=20=20(let=20((body=20(cdr=20form)))=0A=20=20=20=20= =20(pcase=20(car=20form)=0A=20=20=20=20=20=20=20((or=20'seq=20:=20'and=20= 'sequence)=20(rx--translate-seq=20body))=0A-=20=20=20=20=20=20((or=20'or=20= '|)=20=20=20=20=20=20=20=20=20=20=20=20=20=20(rx--translate-or=20body))=0A= +=20=20=20=20=20=20((or=20'or=20'|)=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(rx--translate-or=20body=20nil))=0A+=20=20=20=20=20=20((or=20= 'unordered-or)=20=20=20=20=20=20=20(rx--translate-or=20body=20t))=0A=20=20= =20=20=20=20=20((or=20'any=20'in=20'char)=20=20=20=20=20=20= (rx--translate-any=20nil=20body))=0A=20=20=20=20=20=20=20('not-char=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20(rx--translate-any=20t=20= body))=0A=20=20=20=20=20=20=20('not=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20(rx--translate-not=20nil=20body))=0A@@=20-899,7=20= +896,7=20@@=20rx--translate-form=0A=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(error=20"Unknown=20rx=20form=20`%s'"=20op)))))))))=0A=20=0A=20= (defconst=20rx--builtin-forms=0A-=20=20'(seq=20sequence=20:=20and=20or=20= |=20any=20in=20char=20not-char=20not=0A+=20=20'(seq=20sequence=20:=20and=20= or=20|=20unordered-or=20any=20in=20char=20not-char=20not=0A=20=20=20=20=20= repeat=20=3D=20>=3D=20**=0A=20=20=20=20=20zero-or-more=200+=20*=0A=20=20=20= =20=20one-or-more=201+=20+=0A@@=20-990,6=20+987,7=20@@=20rx=0A=20=0A=20= (seq=20RX...)=20=20=20=20Match=20the=20RXs=20in=20sequence.=20=20Alias:=20= :,=20sequence,=20and.=0A=20(or=20RX...)=20=20=20=20=20Match=20one=20of=20= the=20RXs.=20=20Alias:=20|.=0A+(unordered-or=20RX...)=20Match=20one=20of=20= the=20RXs,=20in=20unspecified=20order.=0A=20=0A=20(zero-or-more=20RX...)=20= Match=20RXs=20zero=20or=20more=20times.=20=20Alias:=200+.=0A=20= (one-or-more=20RX...)=20=20Match=20RXs=20one=20or=20more=20times.=20=20= Alias:=201+.=0Adiff=20--git=20a/test/lisp/emacs-lisp/rx-tests.el=20= b/test/lisp/emacs-lisp/rx-tests.el=0Aindex=20903b191c98..bced74569f=20= 100644=0A---=20a/test/lisp/emacs-lisp/rx-tests.el=0A+++=20= b/test/lisp/emacs-lisp/rx-tests.el=0A@@=20-49,6=20+49,14=20@@=20rx-or=0A=20= =20=20(should=20(equal=20(rx=20(|))=0A=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20"\\`a\\`")))=0A=20=0A+(ert-deftest=20rx-unordered-or=20= ()=0A+=20=20(should=20(equal=20(rx=20(unordered-or=20"ab"=20nonl=20= "cd"))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= "ab\\|.\\|cd"))=0A+=20=20(should=20(equal=20(rx=20(unordered-or=20"ab"=20= "abc"=20"a"))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= "\\(?:a\\(?:bc?\\)?\\)"))=0A+=20=20(should=20(equal=20(rx=20= (unordered-or))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= "\\`a\\`")))=0A+=0A=20(ert-deftest=20rx-char-any=20()=0A=20=20=20"Test=20= character=20alternatives=20with=20`]'=20and=20`-'=20(Bug#25123)."=0A=20=20= =20(should=20(equal=0A--=20=0A2.21.0=20(Apple=20Git-122)=0A=0A= --Apple-Mail=_B90F51FF-B081-438E-9859-64846A71F9D1--