From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.devel Subject: Re: rx.el sexp regexp syntax Date: Thu, 31 May 2018 10:57:03 +0200 Message-ID: <871sds19uo.fsf@gmail.com> References: <87h8mw3yoc.fsf@gmail.com> <20180525155126.GA4096@ACM> <87lgc7hebk.fsf@gmail.com> <87r2lzd375.fsf@ericabrahamsen.net> <8736ybpwhh.fsf@gmail.com> <87y3g1a9kv.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1527756947 3258 195.159.176.226 (31 May 2018 08:55:47 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 31 May 2018 08:55:47 +0000 (UTC) Cc: emacs-devel@gnu.org To: Richard Stallman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 31 10:55:43 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 1fOJN1-0000lJ-Af for ged-emacs-devel@m.gmane.org; Thu, 31 May 2018 10:55:43 +0200 Original-Received: from localhost ([::1]:42689 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOJP8-0007ix-J1 for ged-emacs-devel@m.gmane.org; Thu, 31 May 2018 04:57:54 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46303) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOJOW-0007ie-77 for emacs-devel@gnu.org; Thu, 31 May 2018 04:57:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fOJOR-0007C4-Bf for emacs-devel@gnu.org; Thu, 31 May 2018 04:57:16 -0400 Original-Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:52362) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fOJOR-0007BY-6C; Thu, 31 May 2018 04:57:11 -0400 Original-Received: by mail-wm0-x241.google.com with SMTP id 18-v6so47014306wml.2; Thu, 31 May 2018 01:57:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:mail-followup-to:mail-copies-to :gmane-reply-to-list:date:in-reply-to:message-id:mime-version :content-transfer-encoding; bh=J66j8S2psXBfNZyZowbM5T0dtWZG9+2g4vsJxle+ic4=; b=PLjF+Lv9x8mfnP1O3qJeox5HTAPHlbgPmD+10N2DTUGGNoabu546X1q8fbhLhXpDPe qjmqB0Fl5/2fnAladYkhfcbDyxOgB4CSGeuhiZA/YkXuM120hA0BZyXpGJi/JogKbJQK Pe7DX7nwKC+5Y97kBVI9RFAZIRJ2XdJMHW3avJAy4hovIde3a7uT9BYKSRrLvJTaOg3n 5kf1zFQ1AjbBTGlBqqGPA7JjG6WtePnvbBzLh9Wo5/oyrKV2Ds3RX1lwkgW5kNllXo7N oNioX3c6OYuKUOWSdx4Ey1QcK8W0IA81sySihUsoqVZNjh3ZH33T9aO51mugcFT5JjmO 4Cng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:mail-followup-to :mail-copies-to:gmane-reply-to-list:date:in-reply-to:message-id :mime-version:content-transfer-encoding; bh=J66j8S2psXBfNZyZowbM5T0dtWZG9+2g4vsJxle+ic4=; b=bazRwGkLYdiaOAmsnpRyxdBHxBvnHsA1lHoyEzdhKA0Yd3DH07mLceiAtAZd9Fe0gZ +MyLikcf1c6HF57Jm+5g0K3qzh5H1j+y+E4dHhPNbfkiX0ObSFaZeAsqCiGoAbYkUkHE 0DuVRkePT4EdASTSoxGGX8YhxkIUfu5lWICuvJQwqLy/Frheod2qI0R2c/YycXGg6xuA Yx7vdFd4I9/Hd3hXijRBGeCaVu0rp/DZTfcu9hwwC5jQFaWF9Ku8yk5xdiHluyo1QVt+ 48RYGKhEiqkkBug64ivI0KFYQDoVPF0QwHGGoZGSz6WFbOWukh5jQDUsq5GVpZfQQEeJ 1XTA== X-Gm-Message-State: APt69E1wElQogY2ksusmREPsKz+MZ/1IOHbXDEKNQKMpnIsc7PSyg1RJ je0dPFi+bl2oZ/E1IDPPL/wBZJ8k X-Google-Smtp-Source: ADUXVKLN5RjCXJmt2J9ITXEYVjbHd/Mq+meKxPcTDZIaxhMuUvBHOu+PRihPog8l4I30ZYxH94+msQ== X-Received: by 2002:a1c:8cc8:: with SMTP id o191-v6mr3735313wmd.75.1527757029594; Thu, 31 May 2018 01:57:09 -0700 (PDT) Original-Received: from rpluim ([149.5.228.1]) by smtp.gmail.com with ESMTPSA id b204-v6sm410547wmh.22.2018.05.31.01.57.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 31 May 2018 01:57:08 -0700 (PDT) Mail-Followup-To: emacs-devel@gnu.org Mail-Copies-To: never Gmane-Reply-To-List: yes In-Reply-To: (Richard Stallman's message of "Wed, 30 May 2018 23:53:16 -0400") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 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:225842 Archived-At: Richard Stallman writes: > [[[ To any NSA and FBI agents reading my email: please consider ]]] > [[[ whether defending the US Constitution against all enemies, ]]] > [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > > > > The clearer representation of structure is not the same thing as > > > verbosity. rx does both, but they are not the same thing. We could > > > envision making the structure more or less equally clear without > > > making the patterns so long. > > > It's not clear to me how you'd do that.=20 > > I don't see a specific way either, but someone might come up with a way. > I'm suggesting this as a topic of investigation. > > > and frankly being able to write 'bos' rather than remembering '\\`' or > > 'symbol-start' rather than '\\_<' is a net win in my eyes. > > I agree, as regards those. On the other hand, those strings might not > be the best. Maybe 'text<' and 'sym<' would be better. We could > have a series of keywords, XYZ< and XYZ>, which would be as systematic > as now or more so, and shorter too. What we have now is [be]o[lstw], which covers lines, strings, and words. The only thing missing is symbols, which is easily fixed like so [1]: diff --git i/lisp/emacs-lisp/rx.el w/lisp/emacs-lisp/rx.el index 8059bf2a6e..833321cd7b 100644 --- i/lisp/emacs-lisp/rx.el +++ w/lisp/emacs-lisp/rx.el @@ -170,7 +170,9 @@ rx-constituents (word-boundary . "\\b") (not-word-boundary . "\\B") ; sregex (symbol-start . "\\_<") + (boS . "\\_<") (symbol-end . "\\_>") + (eoS . "\\_>") (syntax . (rx-syntax 1 1)) (not-syntax . (rx-not-syntax 1 1)) ; sregex (category . (rx-category 1 1 rx-check-category)) Footnotes:=20 [1] I=CA=BCm only half joking