Fix character sets containing both ] and -.

This commit is contained in:
sperber 2003-02-17 10:56:22 +00:00
parent edae15ae5b
commit 803b2b1034
1 changed files with 4 additions and 3 deletions

View File

@ -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? "-" "")
"]"))))))))