Correct bug that assumed that regular expression registers might
authorArthur Gleckler <edu/mit/csail/zurich/arthur>
Wed, 28 Aug 1991 02:54:31 +0000 (02:54 +0000)
committerArthur Gleckler <edu/mit/csail/zurich/arthur>
Wed, 28 Aug 1991 02:54:31 +0000 (02:54 +0000)
contain negative numbers, but never false.

v7/src/edwin/regexp.scm

index 8371a331714a9f5228290e28221a6fc5e4d38bbd..4a2f50c66cabeda544b8e5bbfd3d9549b36a85f2 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/regexp.scm,v 1.58 1991/05/17 18:38:32 cph Exp $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/regexp.scm,v 1.59 1991/08/28 02:54:31 arthur Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-91 Massachusetts Institute of Technology
 ;;;
 (define (re-match-start i)
   (guarantee-re-register i 'RE-MATCH-START)
   (let ((index (re-match-start-index i)))
-    (and (not (negative? index))
+    (and index
         (make-mark (re-match-group) index))))
 
 (define (re-match-end i)
   (guarantee-re-register i 'RE-MATCH-END)
   (let ((index (re-match-end-index i)))
-    (and (not (negative? index))
+    (and index
         (make-mark (re-match-group) index))))
 
 (define (guarantee-re-register i operator)
                                            (char->digit char))))
                                   (cond ((not n)
                                          (string char))
-                                        ((negative? (re-match-start-index n))
-                                         (string #\\ char))
+                                        ((not (re-match-start-index n))
+                                         (error "No match for register" n))
                                         (else
                                          (extract-string
                                           (re-match-start n)
                 (list (substring pattern start end))))))
        pattern)))
 
+
 (define (delete-match)
   (let ((start (re-match-start 0)))
     (delete-string start (re-match-end 0))