disable nested `#lang'
A `syntax/module-reader' reader disables `#lang' when looping to read a module body. The HtDP languages require a little additional treatment.
This commit is contained in:
parent
def4da4f9a
commit
248301c9ed
|
@ -10,11 +10,12 @@
|
|||
read))
|
||||
|
||||
(define (get-all-exps source-name port)
|
||||
(parameterize ([read-accept-lang #f])
|
||||
(let loop ()
|
||||
(let ([exp (read-syntax source-name port)])
|
||||
(cond
|
||||
[(eof-object? exp) null]
|
||||
[else (cons exp (loop))]))))
|
||||
[else (cons exp (loop))])))))
|
||||
|
||||
(define (lookup key table)
|
||||
(let ([ans (assoc key table)])
|
||||
|
|
|
@ -90,7 +90,8 @@
|
|||
|
||||
;; take all of the body expressions from the port
|
||||
(define (suck-all-exps port reader)
|
||||
(define (port-reader p) (reader (object-name port) p))
|
||||
(define (port-reader p) (parameterize ([read-accept-lang #f])
|
||||
(reader (object-name port) p)))
|
||||
(sequence->list (in-port port-reader port)))
|
||||
|
||||
;; check that the teachpacks exist, return
|
||||
|
|
|
@ -176,11 +176,12 @@
|
|||
[body (lambda ()
|
||||
(if whole?
|
||||
(read port)
|
||||
(parameterize ([read-accept-lang #f])
|
||||
(let loop ([a null])
|
||||
(let ([v (read port)])
|
||||
(if (eof-object? v)
|
||||
(reverse a)
|
||||
(loop (cons v a)))))))]
|
||||
(loop (cons v a))))))))]
|
||||
[body (cond [(not wrapper) (body)]
|
||||
[(ar? wrapper 2) (wrapper body stx?)]
|
||||
[else (wrapper body)])]
|
||||
|
|
|
@ -96,6 +96,11 @@ identifiers used by the @racket[reader-option]s.
|
|||
repeatedly to the module source until @racket[eof] is produced,
|
||||
but see also @racket[#:whole-body-readers?].
|
||||
|
||||
Unless @racket[#:whole-body-readers?] specifies a true value,
|
||||
the repeated use of @racket[read] or @racket[read-syntax] is
|
||||
@racket[parameterize]d to set @racket[read-accept-lang] to
|
||||
@racket[#f], which disables nested uses of @hash-lang[].
|
||||
|
||||
See also @racket[#:wrapper1] and @racket[#:wrapper2], which
|
||||
support simple parameterization of readers rather than
|
||||
wholesale replacement.}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
Version 5.3.0.10
|
||||
racket/base: add progress-evt?, thread-cell-values?, prefab-key?,
|
||||
semaphore-peek-evt?, channel-put-evt?
|
||||
Changed #lang for most languages so that it cannot be nested;
|
||||
this change is within syntax/module-reader and applies to
|
||||
racket, racket/base, and more
|
||||
|
||||
Version 5.3.0.9
|
||||
Changed the format of error messages
|
||||
|
|
|
@ -2184,14 +2184,19 @@ _internal_read(Scheme_Object *port, Scheme_Object *stxsrc, int crc, int cant_fai
|
|||
else
|
||||
params.table = NULL;
|
||||
}
|
||||
if (crc >= 0)
|
||||
params.can_read_compiled = crc;
|
||||
else {
|
||||
v = scheme_get_param(scheme_current_config(), MZCONFIG_CAN_READ_COMPILED);
|
||||
params.can_read_compiled = SCHEME_TRUEP(v);
|
||||
}
|
||||
v = scheme_get_param(config, MZCONFIG_CAN_READ_PIPE_QUOTE);
|
||||
params.can_read_pipe_quote = SCHEME_TRUEP(v);
|
||||
v = scheme_get_param(config, MZCONFIG_CAN_READ_BOX);
|
||||
params.can_read_box = SCHEME_TRUEP(v);
|
||||
v = scheme_get_param(config, MZCONFIG_CAN_READ_GRAPH);
|
||||
params.can_read_graph = SCHEME_TRUEP(v);
|
||||
if (crc || get_info) {
|
||||
if ((crc > 0) || get_info) {
|
||||
params.can_read_reader = 1;
|
||||
params.can_read_lang = 1;
|
||||
} else {
|
||||
|
@ -2329,9 +2334,6 @@ scheme_internal_read(Scheme_Object *port, Scheme_Object *stxsrc, int crc, int ca
|
|||
{
|
||||
Scheme_Thread *p = scheme_current_thread;
|
||||
|
||||
if (crc < 0)
|
||||
crc = SCHEME_TRUEP(scheme_get_param(scheme_current_config(), MZCONFIG_CAN_READ_COMPILED));
|
||||
|
||||
if (cantfail) {
|
||||
return _internal_read(port, stxsrc, crc, cantfail, recur, expose_comment, -1, NULL,
|
||||
magic_sym, magic_val, delay_load_info, 0);
|
||||
|
|
Loading…
Reference in New Issue
Block a user