From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!not-for-mail
From: Stefan Monnier <monnier@iro.umontreal.ca>
Newsgroups: gmane.emacs.devel
Subject: Re: Structural regular expressions
Date: Sun, 12 Sep 2010 15:48:01 +0200
Message-ID: <jwvd3sjxekd.fsf-monnier+emacs@gnu.org>
References: <loom.20100907T212314-566@post.gmane.org>
	<AANLkTimYvE0aqrG-OQxuY6BTca7ngzrfQUa62mOxyV=+@mail.gmail.com>
	<loom.20100907T222143-475@post.gmane.org> <87sk1lt4uf.fsf@gmail.com>
	<jwvsk1kaav2.fsf-monnier+emacs@gnu.org> <pvhphbi0wq0d.fsf@gmx.li>
	<jwvlj7c9ura.fsf-monnier+emacs@gnu.org>
	<46875.130.55.118.19.1284065220.squirrel@webmail.lanl.gov>
	<AANLkTimUS7zL77TGiWoEdS+=nuww=TSABKMZuSiYPaCc@mail.gmail.com>
	<E1Ou5lY-0006Jj-MB@fencepost.gnu.org>
	<AANLkTi=dv8n40x-rTtz@mail.gmail.com>
	<loom.20100910T221237-941@post.gmane.org>
	<E1OuSKz-0004vv-Gp@fencepost.gnu.org>
NNTP-Posting-Host: lo.gmane.org
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: dough.gmane.org 1284299455 21682 80.91.229.12 (12 Sep 2010 13:50:55 GMT)
X-Complaints-To: usenet@dough.gmane.org
NNTP-Posting-Date: Sun, 12 Sep 2010 13:50:55 +0000 (UTC)
Cc: Tom <levelhalom@gmail.com>, emacs-devel@gnu.org
To: rms@gnu.org
Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 12 15:50:54 2010
Return-path: <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>
Envelope-to: ged-emacs-devel@m.gmane.org
Original-Received: from lists.gnu.org ([199.232.76.165])
	by lo.gmane.org with esmtp (Exim 4.69)
	(envelope-from <emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org>)
	id 1OumxK-0000xj-8b
	for ged-emacs-devel@m.gmane.org; Sun, 12 Sep 2010 15:50:54 +0200
Original-Received: from localhost ([127.0.0.1]:57325 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43)
	id 1OumxJ-0001Cy-SP
	for ged-emacs-devel@m.gmane.org; Sun, 12 Sep 2010 09:50:53 -0400
Original-Received: from [140.186.70.92] (port=58892 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Oumub-0008Me-PI
	for emacs-devel@gnu.org; Sun, 12 Sep 2010 09:48:07 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <monnier@iro.umontreal.ca>) id 1Oumua-0001u1-KZ
	for emacs-devel@gnu.org; Sun, 12 Sep 2010 09:48:05 -0400
Original-Received: from impaqm4.telefonica.net ([213.4.138.4]:26215)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <monnier@iro.umontreal.ca>) id 1Oumua-0001tc-Ce
	for emacs-devel@gnu.org; Sun, 12 Sep 2010 09:48:04 -0400
Original-Received: from IMPmailhost6.adm.correo ([10.20.102.127])
	by IMPaqm4.telefonica.net with bizsmtp
	id 5pjZ1f00p2kvMAa3Qpo292; Sun, 12 Sep 2010 15:48:02 +0200
Original-Received: from ceviche.home ([83.61.39.212])
	by IMPmailhost6.adm.correo with BIZ IMP
	id 5po11f0064aeRwb1mpo1N5; Sun, 12 Sep 2010 15:48:02 +0200
X-Brightmail-Tracker: AAAAAA==
X-TE-authinfo: authemail="monnier$movistar.es"
	|auth_email="monnier@movistar.es"
X-TE-AcuTerraCos: auth_cuTerraCos="cosuitnetc01"
Original-Received: by ceviche.home (Postfix, from userid 20848)
	id 2FEEB660D2; Sun, 12 Sep 2010 15:48:01 +0200 (CEST)
In-Reply-To: <E1OuSKz-0004vv-Gp@fencepost.gnu.org> (Richard Stallman's message
	of "Sat, 11 Sep 2010 11:49:57 -0400")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-BeenThere: emacs-devel@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "Emacs development discussions." <emacs-devel.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/emacs-devel>,
	<mailto:emacs-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/emacs-devel>
List-Post: <mailto:emacs-devel@gnu.org>
List-Help: <mailto:emacs-devel-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/emacs-devel>,
	<mailto:emacs-devel-request@gnu.org?subject=subscribe>
Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org
Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org
Xref: news.gmane.org gmane.emacs.devel:130013
Archived-At: <http://permalink.gmane.org/gmane.emacs.devel/130013>

> Thanks for the explanation.  I think the term "structural regular
> expressions" is misleading because its grammatical construction
> implies a different kind of regexp, rather than a different way of
> applying them.

>     V/pattern  select all matches
>     V|pattern  select all lines with match
>     V{scope    select all matching scopes
>     Vatype     select all objects (inclusive)
>     Vttype     select all objects (exclusive)
>     Y/pattern  select everything but matches
>     Y|pattern  select all lines without match
>     Y{scope    select everything but scope
>     Yatype     select everything but objects (inclusive)
>     Yttype     select everything but objects (exclusive)

> Are `V/' etc. literal, or do they stand for some other text?

> Where would this syntax be used?

The term "structural regular expression" is indeed misleading, I think.
They use it to refer to the combination of 2 things:
1- the ability to select particular kinds of elements in the text
   (which we could do in Emacs with non-contiguous regions).  The main
   example being commands that select "all the strings" or "all the
   comments" or that inverts the selection (select everything that
   wasn't selected before).
2- the ability to apply regexp-operations to only those selected parts
   of the text (to the extent that we already have commands that apply
   only to the active region, we already have that, although it would
   probably require several tweaks to make it work right in the face of
   non-contiguous regions).

Together this allows you to do things like apply query-replace to all
non-string non-comment parts of the buffer, which is why they call it
"structural" regexps.


        Stefan