Fix rx error with ? and ??
The ? and ?? rx operators are special in that they can be written as characters (space and '?' respectively). This confused the definition look-up mechanism in rare cases. * lisp/emacs-lisp/rx.el (rx--expand-def): Don't look up non-symbols. * test/lisp/emacs-lisp/rx-tests.el (rx-charset-or): Test.
This commit is contained in:
parent
40fb20061e
commit
1814c7e158
2 changed files with 4 additions and 2 deletions
|
@ -134,7 +134,7 @@ Each entry is:
|
|||
(if (cdr def)
|
||||
(error "Not an `rx' symbol definition: %s" form)
|
||||
(car def)))))
|
||||
((consp form)
|
||||
((and (consp form) (symbolp (car form)))
|
||||
(let* ((op (car form))
|
||||
(def (rx--lookup-def op)))
|
||||
(and def
|
||||
|
|
|
@ -316,7 +316,9 @@
|
|||
(should (equal (rx (not (or (in "abc") (char "bcd"))))
|
||||
"[^a-d]"))
|
||||
(should (equal (rx (or (not (in "abc")) (not (char "bcd"))))
|
||||
"[^bc]")))
|
||||
"[^bc]"))
|
||||
(should (equal (rx (or "x" (? "yz")))
|
||||
"x\\|\\(?:yz\\)?")))
|
||||
|
||||
(ert-deftest rx-def-in-charset-or ()
|
||||
(rx-let ((a (any "badc"))
|
||||
|
|
Loading…
Add table
Reference in a new issue