Hacks to fit in with the new SRE regexp system.

This commit is contained in:
shivers 1999-09-08 15:19:16 +00:00
parent 0d3f69124f
commit 64613d96db
1 changed files with 9 additions and 5 deletions

View File

@ -69,11 +69,15 @@
(define (->delim-matcher x)
(if (procedure? x) x ; matcher proc
;; The matcher proc.
(lambda (s i)
(cond ((regexp-search x s i) =>
(lambda (m) (values (match:start m 0) (match:end m 0))))
(else (values #f #f))))))
(let ((re (cond ((string? x) (re-string x))
((char-set? x) (re-char-set x))
((char? x) (re-string (string x)))
((regexp? x) x)
(else (error "Illegal field-reader delimiter value" x)))))
(lambda (s i)
(cond ((regexp-search re s i) =>
(lambda (m) (values (match:start m 0) (match:end m 0))))
(else (values #f #f)))))))
;;; (infix-splitter [re num-fields handle-delim]) -> parser
;;; (suffix-splitter [re num-fields handle-delim]) -> parser