fix problem with regexp-match*, etc. and byte regexps (merge to 4.2.2)
svn: r16133
This commit is contained in:
parent
c91a9847aa
commit
95235a4522
|
@ -109,7 +109,10 @@
|
|||
(define (bstring-length s)
|
||||
(if (bytes? s) (bytes-length s) (string-length s)))
|
||||
(define no-empty-edge-matches
|
||||
(make-regexp-tweaker (lambda (rx) (format "(?=.)(?:~a)(?<=.)" rx))))
|
||||
(make-regexp-tweaker (lambda (rx)
|
||||
(if (bytes? rx)
|
||||
(bytes-append #"(?=.)(?:" rx #")(?<=.)")
|
||||
(format "(?=.)(?:~a)(?<=.)" rx)))))
|
||||
(define (bstring->no-edge-regexp name pattern)
|
||||
(if (or (regexp? pattern) (byte-regexp? pattern)
|
||||
(string? pattern) (bytes? pattern))
|
||||
|
|
|
@ -75,6 +75,9 @@
|
|||
(t '("a" "b" "c") eof "[abc]" "a b c" 0)
|
||||
(t '("a" "b" "c") eof "[abc]" "a b c" 0 #f)
|
||||
(t '("a" "b" "c") eof "[abc]" "a b c" 0 5)
|
||||
(for-each (lambda (cvt)
|
||||
(test '(#"\x80" #"\x80") regexp-match* (cvt #"\x80") #"a\x80z\x80q"))
|
||||
(list values byte-regexp byte-pregexp))
|
||||
;; --------------------
|
||||
(t regexp-match-positions*)
|
||||
(t '((1 . 2) (3 . 4) (5 . 6)) eof "[abc]" " a b c ")
|
||||
|
@ -92,6 +95,9 @@
|
|||
(t '((0 . 1) (2 . 3) (4 . 5)) eof "[abc]" "a b c" 0)
|
||||
(t '((0 . 1) (2 . 3) (4 . 5)) eof "[abc]" "a b c" 0 #f)
|
||||
(t '((0 . 1) (2 . 3) (4 . 5)) eof "[abc]" "a b c" 0 5)
|
||||
(for-each (lambda (cvt)
|
||||
(test '((1 . 2) (3 . 4)) regexp-match-positions* (cvt #"\x80") #"a\x80z\x80q"))
|
||||
(list values byte-regexp byte-pregexp))
|
||||
;; --------------------
|
||||
(t regexp-split)
|
||||
(t '("1" "2" "3" "4") eof "[abc]" "1a2b3c4")
|
||||
|
@ -109,6 +115,9 @@
|
|||
(t '("" "1" "2" "") eof "[abc]" "a1b2c" 0)
|
||||
(t '("" "1" "2" "") eof "[abc]" "a1b2c" 0 #f)
|
||||
(t '("" "1" "2" "") eof "[abc]" "a1b2c" 0 5)
|
||||
(for-each (lambda (cvt)
|
||||
(test '(#"" #"a" #"z" #"q" #"") regexp-split (cvt #"\x80") #"\x80a\x80z\x80q\x80"))
|
||||
(list values byte-regexp byte-pregexp))
|
||||
;; --------------------
|
||||
(t regexp-match-peek-positions*)
|
||||
(err/rt-test (regexp-match-peek-positions* "[abc]" "a b c"))
|
||||
|
|
Loading…
Reference in New Issue
Block a user