From 0ec41adb9ce0f99a81aa01b99b4587999151d6cf Mon Sep 17 00:00:00 2001 From: olin-shivers Date: Wed, 7 Mar 2001 16:40:02 +0000 Subject: [PATCH] Fixed a bug in re-dsm. It pushed a pre-dsm value inside a submatch record -- but the submatch pre-dsm field describes deleted submatches occuring *after* the indicated submatch and *before* the submatch's body. So this "simplification" was swapping the order of these deleted submatches with the live submatch, throwing off the ordering. -Olin --- scsh/rx/re.scm | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/scsh/rx/re.scm b/scsh/rx/re.scm index 104cb68..263a259 100644 --- a/scsh/rx/re.scm +++ b/scsh/rx/re.scm @@ -41,7 +41,7 @@ (re-tsm (re-dsm:body re))))) ; minus body's submatches. ;;; Slightly smart DSM constructor: -;;; - Absorb this DSM into an inner dsm, or submatch. +;;; - Absorb this DSM into an inner dsm. ;;; - Punt unnecessary DSM's. (define (re-dsm body pre-dsm post-dsm) @@ -49,14 +49,8 @@ (receive (body1 pre-dsm1) (open-dsm body) (let ((pre-dsm (+ pre-dsm pre-dsm1))) - (? ((= tsm (re-tsm body1)) body1) ; Trivial DSM - - ((re-submatch? body1) ; Absorb into submatch. - (%make-re-submatch (re-submatch:body body1) - (+ pre-dsm (re-submatch:pre-dsm body1)) - tsm)) - - (else (%make-re-dsm body1 pre-dsm tsm))))))) ; Non-trivial DSM + (if (= tsm (re-tsm body1)) body1 ; Trivial DSM + (%make-re-dsm body1 pre-dsm tsm)))))) ; Non-trivial DSM ;;; Take a regexp RE and return an equivalent (re', pre-dsm) pair of values. ;;; Recurses into DSM records. It is the case that