reader: fix parsing of here strings
This commit is contained in:
parent
61fffa4646
commit
014441bceb
|
@ -213,6 +213,12 @@
|
||||||
(err/rt-test (readstr "\"\\uD800\\uDD\"") exn:fail:read?)
|
(err/rt-test (readstr "\"\\uD800\\uDD\"") exn:fail:read?)
|
||||||
(err/rt-test (readstr "\"\\uD800\\uDD1\"") exn:fail:read?)
|
(err/rt-test (readstr "\"\\uD800\\uDD1\"") exn:fail:read?)
|
||||||
|
|
||||||
|
(test "abc" readstr "#<<EOS\nabc\nEOS\n")
|
||||||
|
(test "abc" readstr "#<<EOS\nabc\nEOS")
|
||||||
|
(test "ok\r\nmore\r" readstr "#<<EOS\r\nok\r\nmore\r\nEOS\r")
|
||||||
|
(err/rt-test (readstr "#<<EOS\nabc\nEO") exn:fail:read?)
|
||||||
|
(err/rt-test (readstr "#<<EOS\r\nabc\nEOS") exn:fail:read?)
|
||||||
|
|
||||||
(test (bytes 7) readstr "#\"\\a\"")
|
(test (bytes 7) readstr "#\"\\a\"")
|
||||||
(test (bytes 8) readstr "#\"\\b\"")
|
(test (bytes 8) readstr "#\"\\b\"")
|
||||||
(test (bytes 9) readstr "#\"\\t\"")
|
(test (bytes 9) readstr "#\"\\t\"")
|
||||||
|
|
|
@ -171,17 +171,19 @@
|
||||||
|
|
||||||
;; Parse terminator
|
;; Parse terminator
|
||||||
(define full-terminator
|
(define full-terminator
|
||||||
(let loop ()
|
(cons
|
||||||
(define c (read-char/special in config source))
|
#\newline
|
||||||
(cond
|
(let loop ()
|
||||||
[(eof-object? c)
|
(define c (read-char/special in config source))
|
||||||
(reader-error in config #:due-to c
|
(cond
|
||||||
"found end-of-file after `#<<` and before a newline")]
|
[(eof-object? c)
|
||||||
[(not (char? c))
|
(reader-error in config #:due-to c
|
||||||
(reader-error in config #:due-to c
|
"found end-of-file after `#<<` and before a newline")]
|
||||||
"found non-character while reading `#<<`")]
|
[(not (char? c))
|
||||||
[(char=? c #\newline) null]
|
(reader-error in config #:due-to c
|
||||||
[else (cons c (loop))])))
|
"found non-character while reading `#<<`")]
|
||||||
|
[(char=? c #\newline) null]
|
||||||
|
[else (cons c (loop))]))))
|
||||||
|
|
||||||
;; Get string content
|
;; Get string content
|
||||||
(let loop ([terminator full-terminator] [terminator-accum null])
|
(let loop ([terminator full-terminator] [terminator-accum null])
|
||||||
|
|
|
@ -51999,6 +51999,8 @@ static const char *startup_source =
|
||||||
"(let-values(((source_28)(read-config-source config_48)))"
|
"(let-values(((source_28)(read-config-source config_48)))"
|
||||||
"(let-values(((accum-str_5)(accum-string-init! config_48)))"
|
"(let-values(((accum-str_5)(accum-string-init! config_48)))"
|
||||||
"(let-values(((full-terminator_0)"
|
"(let-values(((full-terminator_0)"
|
||||||
|
"(cons"
|
||||||
|
" '#\\newline"
|
||||||
"((letrec-values(((loop_112)"
|
"((letrec-values(((loop_112)"
|
||||||
"(lambda()"
|
"(lambda()"
|
||||||
"(begin"
|
"(begin"
|
||||||
|
@ -52010,7 +52012,7 @@ static const char *startup_source =
|
||||||
"(let-values()"
|
"(let-values()"
|
||||||
"(let-values(((c94_0) c_87)"
|
"(let-values(((c94_0) c_87)"
|
||||||
"((temp95_2)"
|
"((temp95_2)"
|
||||||
" \"found end-of-file after `#<<` and before a newline\"))"
|
" \"found end-of-file after `#<<` and before a newline\"))"
|
||||||
"(reader-error10.1"
|
"(reader-error10.1"
|
||||||
" #f"
|
" #f"
|
||||||
" #f"
|
" #f"
|
||||||
|
@ -52026,7 +52028,7 @@ static const char *startup_source =
|
||||||
"(let-values()"
|
"(let-values()"
|
||||||
"(let-values(((c98_0) c_87)"
|
"(let-values(((c98_0) c_87)"
|
||||||
"((temp99_2)"
|
"((temp99_2)"
|
||||||
" \"found non-character while reading `#<<`\"))"
|
" \"found non-character while reading `#<<`\"))"
|
||||||
"(reader-error10.1"
|
"(reader-error10.1"
|
||||||
" #f"
|
" #f"
|
||||||
" #f"
|
" #f"
|
||||||
|
@ -52041,7 +52043,7 @@ static const char *startup_source =
|
||||||
"(if(char=? c_87 '#\\newline)"
|
"(if(char=? c_87 '#\\newline)"
|
||||||
"(let-values() null)"
|
"(let-values() null)"
|
||||||
"(let-values()(cons c_87(loop_112)))))))))))"
|
"(let-values()(cons c_87(loop_112)))))))))))"
|
||||||
" loop_112))))"
|
" loop_112)))))"
|
||||||
"(let-values((()"
|
"(let-values((()"
|
||||||
"(begin"
|
"(begin"
|
||||||
"((letrec-values(((loop_113)"
|
"((letrec-values(((loop_113)"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user