For example, (any digit digit) should produce "[[:digit:]]",
not "[[:digit:][:digit:]]".
* lisp/emacs-lisp/rx.el (rx--translate-any): Deduplicate character classes.
* test/lisp/emacs-lisp/rx-tests.el (rx-any): Add test case.
(push (cons arg arg) conses))
((and (symbolp arg)
(let ((class (cdr (assq arg rx--char-classes))))
- (and class (push class classes)))))
+ (and class
+ (or (memq class classes)
+ (push class classes))))))
(t (error "Invalid rx `any' argument: %s" arg))))
(let ((items
;; Translate strings and conses into nonoverlapping intervals,
(should (equal (rx (any) (not (any)))
"\\`a\\`[^z-a]"))
(should (equal (rx (any "") (not (any "")))
- "\\`a\\`[^z-a]")))
+ "\\`a\\`[^z-a]"))
+ (should (equal (rx (any space ?a digit space))
+ "[a[:space:][:digit:]]")))
(ert-deftest rx-pcase ()
(should (equal (pcase "a 1 2 3 1 1 b"