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
This commit is contained in:
parent
beaaa677d3
commit
0ec41adb9c
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue