Check validity of rx submatch-n number
* lisp/emacs-lisp/rx.el (rx-submatch): Type and range check (Bug#34373).
This commit is contained in:
parent
866f527ddf
commit
2eafb4af55
1 changed files with 2 additions and 0 deletions
|
@ -725,6 +725,8 @@ FORM is either `(repeat N FORM1)' or `(repeat N M FORMS...)'."
|
|||
(defun rx-submatch-n (form)
|
||||
"Parse and produce code from FORM, which is `(submatch-n N ...)'."
|
||||
(let ((n (nth 1 form)))
|
||||
(unless (and (integerp n) (> n 0))
|
||||
(error "rx `submatch-n' argument must be positive"))
|
||||
(concat "\\(?" (number-to-string n) ":"
|
||||
(if (= 3 (length form))
|
||||
;; Only one sub-form.
|
||||
|
|
Loading…
Add table
Reference in a new issue