* bug#6984: rx generates wrong regular expression for class
@ 2010-09-04 23:04 Daniel Colascione
2010-09-05 9:44 ` Stefan Monnier
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Colascione @ 2010-09-04 23:04 UTC (permalink / raw)
To: 6984
(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*.
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#6984: rx generates wrong regular expression for class
2010-09-04 23:04 bug#6984: rx generates wrong regular expression for class Daniel Colascione
@ 2010-09-05 9:44 ` Stefan Monnier
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2010-09-05 9:44 UTC (permalink / raw)
To: Daniel Colascione
>>>>> "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)))
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-09-05 9:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-04 23:04 bug#6984: rx generates wrong regular expression for class Daniel Colascione
2010-09-05 9:44 ` Stefan Monnier
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).