GNU bug report logs - #6984
rx generates wrong regular expression for class

Previous Next

Package: emacs;

Reported by: Daniel Colascione <dan.colascione <at> gmail.com>

Date: Sat, 4 Sep 2010 23:03:01 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6984 in the body.
You can then email your comments to 6984 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6984; Package emacs. (Sat, 04 Sep 2010 23:03:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Daniel Colascione <dan.colascione <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 04 Sep 2010 23:03:02 GMT) Full text and rfc822 format available.

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

From: Daniel Colascione <dan.colascione <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: rx generates wrong regular expression for class
Date: Sat, 04 Sep 2010 16:04:06 -0700
(rx (in (?0 . ?3) ?, ?-))

generates

"[,-0-3]"

but it should generate
"[,0-3-]"

More generally, if "-" occurs in a class, it
should always go *last*.




Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Sun, 05 Sep 2010 13:35:03 GMT) Full text and rfc822 format available.

Notification sent to Daniel Colascione <dan.colascione <at> gmail.com>:
bug acknowledged by developer. (Sun, 05 Sep 2010 13:35:03 GMT) Full text and rfc822 format available.

Message #10 received at 6984-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Daniel Colascione <dan.colascione <at> gmail.com>
Subject: Re: bug#6984: rx generates wrong regular expression for class
Date: Sun, 05 Sep 2010 11:44:42 +0200
>>>>> "Daniel" == Daniel Colascione <dan.colascione <at> 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)))





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 04 Oct 2010 11:24:04 GMT) Full text and rfc822 format available.

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

Previous Next


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