allow regexps for pregexp pattern in match
svn: r4410
This commit is contained in:
parent
6e2f93b147
commit
bbcd99e537
|
@ -64,14 +64,15 @@
|
||||||
;; this makes pregexp errors a little more friendly
|
;; this makes pregexp errors a little more friendly
|
||||||
(define (pregexp-match-with-error regex str)
|
(define (pregexp-match-with-error regex str)
|
||||||
(if (or (string? regex)
|
(if (or (string? regex)
|
||||||
(and (pair? regex)
|
(bytes? regex)
|
||||||
(equal? ':sub (car regex))))
|
(regexp? regex)
|
||||||
|
(byte-regexp? regex))
|
||||||
(pregexp-match regex str)
|
(pregexp-match regex str)
|
||||||
(error 'match:pregex
|
(error 'match:pregex
|
||||||
(string-append
|
(string-append
|
||||||
"this pattern expects either a S-regexp or a U-regexp,"
|
"this pattern expects either a string, byte string, regexp or byte regexp,"
|
||||||
" given " (format "~s" regex) "; "
|
" given " (format "~e" regex) "; "
|
||||||
"other argument was " (format "~s" str)))))
|
"other argument was " (format "~e" str)))))
|
||||||
|
|
||||||
|
|
||||||
)
|
)
|
Loading…
Reference in New Issue
Block a user