1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-12 06:41:13 +02:00

* regex.scm (regexp-substitute/global): Handle the end of the

match list and an empty match list identically.  (Thanks to Greg
Badros.)
This commit is contained in:
Jim Blandy 1999-09-16 20:09:46 +00:00
parent 8cc9503dc0
commit f564140129

View file

@ -166,7 +166,8 @@
;; Walk the set of non-overlapping, maximal matches.
(let next-match ((matches (list-matches regexp string))
(start 0))
(if (pair? matches)
(if (null? matches)
(display (make-shared-substring string start) port)
(let ((m (car matches)))
;; Process all of the items for this match. Don't use
@ -184,11 +185,7 @@
(make-shared-substring string start (match:start m))
port))
((eq? item 'post)
(if (pair? (cdr matches))
(next-match (cdr matches) (match:end m))
(display
(make-shared-substring string (match:end m))
port)))
(next-match (cdr matches) (match:end m)))
(else (error 'wrong-type-arg item))))
(if (pair? items)