io.encodings: fix for read-until seps not containing \n.
parent
632ee276e1
commit
5961cfb7b9
|
@ -87,3 +87,15 @@ unit-test
|
||||||
"\r\n" read-until
|
"\r\n" read-until
|
||||||
] with-byte-reader
|
] with-byte-reader
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
|
{
|
||||||
|
"! lol"
|
||||||
|
"! wa"
|
||||||
|
116
|
||||||
|
} [
|
||||||
|
"! lol\r\n! wat\r\n" utf8 encode
|
||||||
|
utf8 [
|
||||||
|
readln
|
||||||
|
"t" read-until
|
||||||
|
] with-byte-reader
|
||||||
|
] unit-test
|
||||||
|
|
|
@ -163,13 +163,18 @@ M: decoder stream-contents*
|
||||||
|
|
||||||
M: decoder stream-read-until
|
M: decoder stream-read-until
|
||||||
dup cr>> [
|
dup cr>> [
|
||||||
2dup
|
dup cr- 2dup
|
||||||
>decoder< decode-until
|
>decoder< decode-until
|
||||||
2dup [ empty? ] [ CHAR: \n = ] bi* and [
|
over [
|
||||||
|
dup CHAR: \n = [
|
||||||
2drop stream-read-until
|
2drop stream-read-until
|
||||||
] [
|
] [
|
||||||
[ cr- drop ] 2dip
|
[ 2drop ] 2dip
|
||||||
] if
|
] if
|
||||||
|
] [
|
||||||
|
first-unsafe CHAR: \n = [ [ rest ] dip ] when
|
||||||
|
[ 2drop ] 2dip
|
||||||
|
] if-empty
|
||||||
] [
|
] [
|
||||||
>decoder< decode-until
|
>decoder< decode-until
|
||||||
] if ;
|
] if ;
|
||||||
|
|
Loading…
Reference in New Issue