From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Pierre Neidhardt Newsgroups: gmane.emacs.devel Subject: Re: rx.el sexp regexp syntax Date: Mon, 28 May 2018 18:36:28 +0200 Message-ID: <874lirpwj7.fsf@gmail.com> References: <87h8mw3yoc.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Trace: blaine.gmane.org 1527525312 31239 195.159.176.226 (28 May 2018 16:35:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 28 May 2018 16:35:12 +0000 (UTC) User-Agent: mu4e 1.0; emacs 26.1 Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 28 18:35:08 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fNL6y-00082W-Eg for ged-emacs-devel@m.gmane.org; Mon, 28 May 2018 18:35:08 +0200 Original-Received: from localhost ([::1]:57151 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNL95-0008Pq-Jw for ged-emacs-devel@m.gmane.org; Mon, 28 May 2018 12:37:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50495) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNL8O-0008PX-Jr for emacs-devel@gnu.org; Mon, 28 May 2018 12:36:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fNL8J-000644-LW for emacs-devel@gnu.org; Mon, 28 May 2018 12:36:36 -0400 Original-Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]:35627) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fNL8J-00063U-Av for emacs-devel@gnu.org; Mon, 28 May 2018 12:36:31 -0400 Original-Received: by mail-wm0-x22d.google.com with SMTP id o78-v6so33612124wmg.0 for ; Mon, 28 May 2018 09:36:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=9lzHpPqd82Dq8dT5EQFx67gmgRRXMNqyNWK8PtFCVhE=; b=uQt+WUpKp97Ir1/WN5eHPX+D0Y2skXaBc6+oEmN4kg1SqgzXKN2ZR9qbbiTk8FbBbC Kkd0PPb2VlLHC+SVWnY4YRm3pLs2dmAPA3HbRCuAOSTfoMFuLu6ST0gAaFlYhaIAQkWb M/4RMerN5eiG5ReEqyuWpbonsypQKEgtIx+M1AcCXE04AOxjHaOcDi4Mf8cz6gHPZd02 U5bhyynAvOt1HsR9FWL/V3WFkJGJ3SxGfB+3NbGpWFfkh3ld6pgc5NtdeoLxbte5iI+4 IE88BIpnkHCOF4y/YdyjJeb6shjSSP/DPbO+mUbzAOXV9QnrGvv4dpJm1/t8Gaj3b24I 2BEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=9lzHpPqd82Dq8dT5EQFx67gmgRRXMNqyNWK8PtFCVhE=; b=OVSLQX5Qb5gYg0pbFTXeYyoKE3n5n7bGXSA5C49yDW1zMlABwZ14z1CKvDlsisICzA PH1OSCkmVjOaapTpHwMtlChvddJ4lfHvjHL6k2LC8TjzT8Kg3LSnqp3USStzPyznBkqn VB5oSosaH88NL+I0Bg3OTQi+um6MO8laTVzW4HXAS8K3DGHHpJ7h1TUvZ89nBMkh19hy NKv47zI4CoX7/jpjn8eGLNEwEYqZ2gwrqWpaF45M5rTVnOLvpsdLE/1xhUjoapjt6kid /LVn3ROvlawzq9r6XMO3bwhKsY6efHuzHih2IHduEJyNrIes6n5kYmlzskzHpYAFfonQ ICtw== X-Gm-Message-State: ALKqPweoJZ4DI1oMF2aEo8jPCS6hn3Mm1Fw7rPjb4x9i6QwHuc/Ao8xV xWU4vPloNcjxaaYdVrPrPVZ4pg== X-Google-Smtp-Source: ADUXVKLB1T0oPQgQBb7GkezviaER+s1joxY4OnsthIStQZm9VJeU3ZGJRGrQn55L6VxE1qiYYHE1FQ== X-Received: by 2002:a1c:a104:: with SMTP id k4-v6mr8964714wme.106.1527525389914; Mon, 28 May 2018 09:36:29 -0700 (PDT) Original-Received: from mimimi (87-89-234-173.abo.bbox.fr. [87.89.234.173]) by smtp.gmail.com with ESMTPSA id 44-v6sm72457574wrv.47.2018.05.28.09.36.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 May 2018 09:36:29 -0700 (PDT) In-reply-to: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::22d 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:225776 Archived-At: --=-=-= Content-Type: text/plain Stefan Monnier writes: > FWIW, I find it's cumbersome in RX to define regexps piecewise. > E.g. with strings I can do things like: > > (let* ((word-re "\\(?:\\sw\\|s_\\)+") > (spc-re "[ \t\n]*") > (re1 (concat spc-re "\\(" word-re "\\)" spc-re)) > (re2 (concat spc-re "\\(" word-re "\\)(" word-re)))) > > but do the same with RX you need something like: > > (let* ((word-re (rx ...)) > (spc-re (rx ...)) > (re1 (rx-to-string `(... ,spc-re ... ,word-re ...))) > (re2 (rx-to-string `(... ,spc-re ... ,word-re ...)))) > > I think `rx` would benefit from allowing to refer to variables. Not sure what you are trying to do, but doesn't it work with (rx (... (eval VARIABLE) ...)) ? -- Pierre Neidhardt --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAlsMMAwACgkQm9z0l6S7 zH+8YAf/a7WrsRVtgMY/Huyg1Mjbv5IaXTBUcwz9JKCRB9QqkzD2hKG/Ig2Vg8YB oVlV0rQCSKDa85ZFIVlCRnAiw3kThFDuc85yUtI9RaeqyjkQ4/AiIb0TUm7ImmNO etHo5UL7hqVaBvELlCLQQZdY2lRKlI43jsO1FiQ/q7C5v3pChZAdp95uMBasF39Q KVrLJFpmvX70JNLPkXwMW1lmhqx+jam/p20fOZL543rVtNVK5IF9ksXcw87IbDOm 09lQxHzmC3ZQUBdZnYrrwF0oT53HBl0H/TFcer+f+RTFj5oQNb0H4KaNCNpAWPpy zZYtW5WyU8BJmqzKngk2ykRCUarV4g== =hD2r -----END PGP SIGNATURE----- --=-=-=--