; * lisp/emacs-lisp/rx.el (rx--pcase-macroexpander): slight rephrase

This commit is contained in:
Mattias Engdegård 2021-05-28 11:51:32 +02:00
parent 61961903fd
commit 0cbfb7e795

View file

@ -1442,10 +1442,9 @@ following constructs:
introduced by a previous (let REF ...)
construct."
(let* ((rx--pcase-vars nil)
(regexp (rx--to-expr (rx--pcase-transform (cons 'seq regexps))))
(nvars (length rx--pcase-vars)))
(regexp (rx--to-expr (rx--pcase-transform (cons 'seq regexps)))))
`(and (pred stringp)
,(pcase nvars
,(pcase (length rx--pcase-vars)
(0
;; No variables bound: a single predicate suffices.
`(pred (string-match ,regexp)))
@ -1458,7 +1457,7 @@ following constructs:
(match-string 1 s)
0))
(and ,(car rx--pcase-vars) (pred (not numberp)))))
(_
(nvars
;; Pack the submatches into a dotted list which is then
;; immediately destructured into individual variables again.
;; This is of course slightly inefficient.