Fix rx charset generation

* lisp/emacs-lisp/rx.el (rx--charset-p): Don't overquote.
(rx--generate-alt): Generate '.' for negated newline.
* test/lisp/emacs-lisp/rx-tests.el (rx-any, rx-charset-or): Test.
This commit is contained in:
Mattias Engdegård 2020-02-29 10:12:10 +01:00
parent 9908b5a614
commit d424195905
2 changed files with 14 additions and 3 deletions

View file

@ -305,7 +305,7 @@ Return (REGEXP . PRECEDENCE)."
"Whether FORM looks like a charset, only consisting of character intervals
and set operations."
(or (and (consp form)
(or (and (memq (car form) '(any 'in 'char))
(or (and (memq (car form) '(any in char))
(rx--every (lambda (x) (not (symbolp x))) (cdr form)))
(and (memq (car form) '(not or | intersection))
(rx--every #'rx--charset-p (cdr form)))))
@ -450,6 +450,10 @@ classes."
(not negated))
(cons (list (regexp-quote (char-to-string (caar items))))
t))
;; Negated newline.
((and (equal items '((?\n . ?\n)))
negated)
(rx--translate-symbol 'nonl))
;; At least one character or class, possibly negated.
(t
(cons