From 803b2b1034ee1892c734ee1feed8533487652d80 Mon Sep 17 00:00:00 2001 From: sperber Date: Mon, 17 Feb 2003 10:56:22 +0000 Subject: [PATCH] Fix character sets containing both ] and -. --- scsh/rx/posixstr.scm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scsh/rx/posixstr.scm b/scsh/rx/posixstr.scm index d3c4607..e12f822 100644 --- a/scsh/rx/posixstr.scm +++ b/scsh/rx/posixstr.scm @@ -615,12 +615,12 @@ (receive (new-loose new-ranges) (shrink-range-start (car ranges)) (lp (append new-loose loose) (append new-ranges ranges) end-hyphen?))) - ;; If both [ and - are in the loose char set, + ;; If both ] and - are in the loose char set, ;; pull - out as special end-hypen. ((and (pair? loose) (pair? (cdr loose)) - (char=? (car loose) #\[) - (char=? (car loose) #\-)) + (char=? (car loose) #\]) + (char=? (cadr loose) #\-)) (lp (cons (car loose) (cddr loose)) ranges #t)) ;; No change! Build the answer... @@ -629,4 +629,5 @@ (apply string-append (map (lambda (r) (string (car r) #\- (cdr r))) ranges)) + (if end-hyphen? "-" "") "]"))))))))