all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Daniel Colascione <dan.colascione@gmail.com>
Subject: bug#6984: rx generates wrong regular expression for class
Date: Sun, 05 Sep 2010 11:44:42 +0200	[thread overview]
Message-ID: <jwvaanwh6jq.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <4C82D066.4090603@gmail.com> (Daniel Colascione's message of "Sat, 04 Sep 2010 16:04:06 -0700")

>>>>> "Daniel" == Daniel Colascione <dan.colascione@gmail.com> writes:

> (rx (in (?0 . ?3) ?, ?-))
> generates

> "[,-0-3]"

Thanks.  I've just installed the patch below in the emacs-23 branch,
which should fix it (in two different ways).


        Stefan


=== modified file 'lisp/emacs-lisp/rx.el'
--- lisp/emacs-lisp/rx.el	2010-06-29 12:09:07 +0000
+++ lisp/emacs-lisp/rx.el	2010-09-05 09:37:06 +0000
@@ -427,7 +427,7 @@
 	    (mapcar (lambda (e)
 		      (cond
 		       ((= (car e) (cdr e)) (list (car e)))
-		       ;; ((= (1+ (car e)) (cdr e)) (list (car e) (cdr e)))
+		       ((= (1+ (car e)) (cdr e)) (list (car e) (cdr e)))
 		       ((list e))))
 		    l))
      (delete-dups str))))
@@ -545,7 +545,10 @@
 			    ((numberp e) (string e))
 			    ((consp e)
 			     (if (and (= (1+ (car e)) (cdr e))
-				      (null (memq (car e) '(?\] ?-))))
+                                      ;; rx-any-condense-range should
+                                      ;; prevent this case from happening.
+				      (null (memq (car e) '(?\] ?-)))
+                                      (null (memq (cdr e) '(?\] ?-))))
 				 (string (car e) (cdr e))
 			       (string (car e) ?- (cdr e))))
 			    (e)))






      reply	other threads:[~2010-09-05  9:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-04 23:04 bug#6984: rx generates wrong regular expression for class Daniel Colascione
2010-09-05  9:44 ` Stefan Monnier [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

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

  git send-email \
    --in-reply-to=jwvaanwh6jq.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=dan.colascione@gmail.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.