From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.devel Subject: Re: modern regexes in emacs Date: Wed, 27 Feb 2019 13:09:23 +0100 Message-ID: <8BB38367-5864-4A62-8349-5420B51BBA94@acm.org> References: <20180616123704.7123f6d7@jabberwock.cb.piermont.com> <87po0qs6re.fsf@gmail.com> <83r2c9m8yj.fsf@gnu.org> <17581DA9-7DCA-432E-A2E8-E5184DFA8B4B@acm.org> <20190215114728.0785e891@jabberwock.cb.piermont.com> <20190215175405.GA5438@ACM> <83lg2gnbky.fsf@gnu.org> <3D5EA6AB-F0DA-4B66-8592-A111C906B3AE@acm.org> <83k1i0n88i.fsf@gnu.org> <4a830d51-526c-5e31-82e6-abf6b8d192a5@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="107603"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Troy Hinckley , Lars Ingebrigtsen , emacs-devel@gnu.org To: Andreas Schwab Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 27 14:52:52 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gyzdi-000RrV-TH for ged-emacs-devel@m.gmane.org; Wed, 27 Feb 2019 14:52:51 +0100 Original-Received: from localhost ([127.0.0.1]:44122 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyzdf-0003y0-CA for ged-emacs-devel@m.gmane.org; Wed, 27 Feb 2019 08:52:47 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:50921) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyzTa-000502-8y for emacs-devel@gnu.org; Wed, 27 Feb 2019 08:42:23 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gyzRx-00013b-5h for emacs-devel@gnu.org; Wed, 27 Feb 2019 08:40:43 -0500 Original-Received: from mail176c50.megamailservers.eu ([91.136.10.186]:60842 helo=mail37c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gyzRq-0000bA-Hn for emacs-devel@gnu.org; Wed, 27 Feb 2019 08:40:39 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1551269366; bh=huyPsFRpw/G+p0G3KmN+4tqVvlhdTgVOQOnLUy3Hvuc=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=QXKj8GogOxEDVOzWMXBY1mN3ey1cGPdMlRM4xiChd9hFJ4L4VkN/DN0aS5KNh6p7s x3Ka4Gq/1xxoVnPej6eUesCd6PlL/HP9/vsZUGdln9YsOCmFXGHMD2GscREwYZsww2 4aEQ4qNNQ2RKLWXohpax8LLFIWWhju0zrX+G/xqw= 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 mail37c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id x1RC9NGd021068; Wed, 27 Feb 2019 12:09:25 +0000 In-Reply-To: X-Mailer: Apple Mail (2.3445.102.3) X-CTCH-RefID: str=0001.0A0B0215.5C767DF6.0077, 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=J+uEEjvS c=1 sm=1 tr=0 a=M+GU/qJco4WXjv8D6jB2IA==:117 a=M+GU/qJco4WXjv8D6jB2IA==:17 a=kj9zAlcOel0A:10 a=J2scaHIjqqBXdV3NSvIA:9 a=CjuIK1q_8ugA:10 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 91.136.10.186 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:233644 Archived-At: 26 feb. 2019 kl. 15.33 skrev Andreas Schwab : >=20 > If you want to byte-compile a form that contains a regexp object, a > proper read syntax is required. >=20 > The object types without read syntax are rather ephemeral, unlikely to > occur in byte-compiled forms. Thanks for pointing that out. I'm not sure how it would work -- please = bear with me. Suppose we want to write (looking-at (pcre "a(b|c)")). Then `pcre' is a macro returning a mutable object with the regexp in = some canonical form -- a traditional Emacs regexp, perhaps, or = normalised rx or something else. The object also has space for the = internal compiled pattern, roughly struct re_pattern_buffer today. As Richard pointed out, it is polite to make the object human-readable = (for debugging, if nothing else). This means that we are either = satisfied with the readability of the canonical form, or the original = pattern is included around for this purpose. Then (pcre "a(b|c)") might produce #s(regexp "a\\(b\\|c\\)" nil), which = can be serialised and read, even by humans. After its first use, the last slot would have become something like = #, but that would not occur in byte-compiled = elisp code.