Changed regexp-substring so that unmatched submatches return #f instead of

raising an error.
This commit is contained in:
shivers 1997-03-28 20:55:23 +00:00
parent 5e85d401b9
commit 0e28399b12
1 changed files with 3 additions and 6 deletions

View File

@ -26,12 +26,9 @@
(define (match:substring match . maybe-index) (define (match:substring match . maybe-index)
(let* ((i (:optional maybe-index 0)) (let* ((i (:optional maybe-index 0))
(start (vector-ref (regexp-match:start match) i))) (start (vector-ref (regexp-match:start match) i)))
(if start (and start (substring (regexp-match:string match)
(substring (regexp-match:string match)
start start
(vector-ref (regexp-match:end match) i)) (vector-ref (regexp-match:end match) i)))))
(error match:substring "No sub-match found." match i))))
;;; Compiling regexps ;;; Compiling regexps
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;