unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lennart Borgman <lennart.borgman@gmail.com>
To: Juri Linkov <juri@jurta.org>
Cc: 6384@debbugs.gnu.org
Subject: bug#6384: Teach rx explicitly numbered submatches
Date: Thu, 10 Jun 2010 18:21:36 +0200	[thread overview]
Message-ID: <AANLkTinL0UP64SY5EYO4QfvFM9TQCSYTJ0XqO-BL6L0_@mail.gmail.com> (raw)
In-Reply-To: <871vce98br.fsf@mail.jurta.org>

On Thu, Jun 10, 2010 at 5:51 PM, Juri Linkov <juri@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'.)





      reply	other threads:[~2010-06-10 16:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-09 17:22 bug#6384: Teach rx explicitly numbered submatches Lennart Borgman
2010-06-09 18:16 ` Stefan Monnier
2010-06-09 18:19   ` Lennart Borgman
2010-06-10 15:51     ` Juri Linkov
2010-06-10 16:21       ` Lennart Borgman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTinL0UP64SY5EYO4QfvFM9TQCSYTJ0XqO-BL6L0_@mail.gmail.com \
    --to=lennart.borgman@gmail.com \
    --cc=6384@debbugs.gnu.org \
    --cc=juri@jurta.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).