From 4836b4c50e7f3b4fc4904daadefb6c64a4cba8dc Mon Sep 17 00:00:00 2001 From: Dorai Sitaram Date: Mon, 25 Apr 2005 14:22:38 +0000 Subject: [PATCH] Signal error when trying to match against non-existent backref. original commit: f8a9434cb6d1c3e82742b4090d35d6ebe1ef465d --- collects/mzlib/pregexp.ss | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/collects/mzlib/pregexp.ss b/collects/mzlib/pregexp.ss index 28a4763..d0870a7 100644 --- a/collects/mzlib/pregexp.ss +++ b/collects/mzlib/pregexp.ss @@ -448,7 +448,16 @@ (lambda (i1) (or (sk i1) (loup-or (cdr res)))) (lambda () (loup-or (cdr res))))))) ((:backref) - (let ((backref (cdr (pregexp-list-ref backrefs (cadr re))))) + (let* ((c (pregexp-list-ref backrefs (cadr re))) + (backref + (cond + (c => cdr) + (else + (error + 'pregexp-match-positions-aux + 'non-existent-backref + re) + #f)))) (if backref (pregexp-string-match (substring s (car backref) (cdr backref)) @@ -664,4 +673,3 @@ ) -