GNU bug report logs - #6384
Teach rx explicitly numbered submatches

Previous Next

Package: emacs;

Reported by: Lennart Borgman <lennart.borgman <at> gmail.com>

Date: Wed, 9 Jun 2010 17:25:02 UTC

Severity: wishlist

Tags: patch

Merged with 8776

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

Full log


Message #17 received at 6384 <at> debbugs.gnu.org (full text, mbox):

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Juri Linkov <juri <at> jurta.org>
Cc: 6384 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#6384: Teach rx explicitly numbered submatches
Date: Thu, 10 Jun 2010 18:21:36 +0200
On Thu, Jun 10, 2010 at 5:51 PM, Juri Linkov <juri <at> jurta.org> wrote:
>>      (submatch                . (rx-submatch 1 nil)) ; SRE
>> +    (submatch-n              . (rx-submatch-n 2 nil))
>
> I think better would be to allow the existing subform `submatch'
> to support numbered groups, i.e. in addition to the current form
> `(submatch SEXP1 SEXP2 ...)' also support
> `(submatch N SEXP1 SEXP2 ...)' because the number is a parameter
> of normal groups.
>
> There are already subforms that support different number of integer
> arguments like `(repeat N SEXP)' and `(repeat N M SEXP)'.  So the same
> could be done for `submatch' too.


I thought of that, but currently you can do

  (rx (submatch 1 "str"))

Should perhaps 1 etc be disallowed as SEXP:s in rx? (I do not know how
to do it because I believe rx uses `read'.)




This bug report was last modified 14 years and 11 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.