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