bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#6984: rx generates wrong regular expression for class


From: Stefan Monnier
Subject: bug#6984: rx generates wrong regular expression for class
Date: Sun, 05 Sep 2010 11:44:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

>>>>> "Daniel" == Daniel Colascione <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]