Remove #:read-annotations?, to ensure a consistent output format from the reader
This commit is contained in:
parent
77fd8e86bf
commit
749747ca05
|
@ -25,16 +25,8 @@
|
|||
|
||||
(define (read-preserve [in-port (current-input-port)]
|
||||
#:read-syntax? [read-syntax? #f]
|
||||
#:read-annotations? [read-annotations? read-syntax?]
|
||||
#:source [source (object-name in-port)])
|
||||
(define b (peek-byte in-port))
|
||||
(cond [(eof-object? b) b]
|
||||
[(<= #x80 b #xBF)
|
||||
(read-preserve/binary in-port
|
||||
#:read-syntax? read-syntax?
|
||||
#:read-annotations? read-annotations?)]
|
||||
[else
|
||||
(read-preserve/text in-port
|
||||
#:read-syntax? read-syntax?
|
||||
#:read-annotations? read-annotations?
|
||||
#:source source)]))
|
||||
[(<= #x80 b #xBF) (read-preserve/binary in-port #:read-syntax? read-syntax?)]
|
||||
[else (read-preserve/text in-port #:read-syntax? read-syntax? #:source source)]))
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
(define (bytes->preserve bs
|
||||
#:read-syntax? [read-syntax? #f]
|
||||
#:read-annotations? [read-annotations? read-syntax?]
|
||||
#:on-short [on-short default-on-short]
|
||||
[on-fail default-on-fail])
|
||||
(call-with-input-bytes
|
||||
|
@ -24,7 +23,6 @@
|
|||
(lambda (p)
|
||||
(match (read-preserve/binary p
|
||||
#:read-syntax? read-syntax?
|
||||
#:read-annotations? read-annotations?
|
||||
#:on-short on-short
|
||||
on-fail)
|
||||
[(? eof-object?) (on-short)]
|
||||
|
@ -34,9 +32,9 @@
|
|||
|
||||
(define (read-preserve/binary [in-port (current-input-port)]
|
||||
#:read-syntax? [read-syntax? #f]
|
||||
#:read-annotations? [read-annotations? read-syntax?]
|
||||
#:on-short [on-short default-on-short]
|
||||
[on-fail default-on-fail])
|
||||
(define read-annotations? read-syntax?)
|
||||
(let/ec return
|
||||
|
||||
(define (next) (wrap (pos) (next* (next-byte))))
|
||||
|
|
|
@ -26,13 +26,11 @@
|
|||
|
||||
(define (string->preserve s
|
||||
#:read-syntax? [read-syntax? #f]
|
||||
#:read-annotations? [read-annotations? read-syntax?]
|
||||
#:source [source "<string>"])
|
||||
(define p (open-input-string s))
|
||||
(when read-syntax? (port-count-lines! p))
|
||||
(define v (read-preserve/text p
|
||||
#:read-syntax? read-syntax?
|
||||
#:read-annotations? read-annotations?
|
||||
#:source source))
|
||||
(when (eof-object? v)
|
||||
(parse-error* #:raise-proc raise-read-eof-error p source "Unexpected end of input"))
|
||||
|
@ -50,8 +48,8 @@
|
|||
|
||||
(define (read-preserve/text [in-port (current-input-port)]
|
||||
#:read-syntax? [read-syntax? #f]
|
||||
#:read-annotations? [read-annotations? read-syntax?]
|
||||
#:source [source (object-name in-port)])
|
||||
(define read-annotations? read-syntax?)
|
||||
|
||||
;;---------------------------------------------------------------------------
|
||||
;; Core of parser
|
||||
|
@ -90,7 +88,6 @@
|
|||
(lambda (message . args)
|
||||
(apply parse-error (string-append "Embedded binary value: " message) args))
|
||||
#:read-syntax? read-syntax?
|
||||
#:read-annotations? read-annotations?
|
||||
#:on-short (lambda () (parse-error "Incomplete embedded binary value")))]
|
||||
[c (parse-error "Invalid # syntax: ~v" c)])]
|
||||
|
||||
|
|
Loading…
Reference in New Issue