fix `regexp-match' variants given a long string and an output port

This commit is contained in:
Matthew Flatt 2012-08-07 05:21:33 -06:00
parent 08b271d34c
commit d194fa6245
2 changed files with 17 additions and 1 deletions

View File

@ -1310,6 +1310,20 @@
(let ([is (open-input-string "barfoo")])
(test '(#f #\f) list (regexp-match "foo" is 0 3) (read-char is)))
;; Check that lazy decoding of strings works right with sending
;; unmatched output to a port:
(for ([succeed? '(#f #t)])
(for ([N '(1 100 1000 1023 1024 10000)])
(define o (open-output-bytes))
(void (regexp-match-positions #rx"y"
(string-append
(make-string N #\x)
(if succeed? "y" ""))
0
(+ N (if succeed? 1 0))
o))
(test N bytes-length (get-output-bytes o))))
(arity-test regexp 1 1)
(arity-test regexp? 1 1)
(arity-test regexp-match 2 6)

View File

@ -5391,8 +5391,10 @@ static Scheme_Object *gen_compare(char *name, int pos,
startv, endv, &dropped,
prefix, prefix_len, prefix_offset);
if (lazy_string)
if (lazy_string) {
full_s = lazy_string->s;
endset = lazy_string->end;
}
if (iport) {
minpos = -prefix_len;