diff --git a/collects/compiler/cm.rkt b/collects/compiler/cm.rkt index d1f6f615a0..53e44a32fa 100644 --- a/collects/compiler/cm.rkt +++ b/collects/compiler/cm.rkt @@ -7,7 +7,8 @@ scheme/list scheme/path racket/promise - openssl/sha1) + openssl/sha1 + syntax/private/modread) (provide make-compilation-manager-load/use-compiled-handler managed-compile-zo @@ -465,11 +466,13 @@ -inf.0)) (define (try-file-sha1 path dep-path) - (with-handlers ([exn:fail:filesystem? (lambda (exn) #f)]) - (string-append - (call-with-input-file* path sha1) - (with-handlers ([exn:fail:filesystem? (lambda (exn) "")]) - (call-with-input-file* dep-path (lambda (p) (cdadr (read p)))))))) + (with-module-reading-parameterization + (lambda () + (with-handlers ([exn:fail:filesystem? (lambda (exn) #f)]) + (string-append + (call-with-input-file* path sha1) + (with-handlers ([exn:fail:filesystem? (lambda (exn) "")]) + (call-with-input-file* dep-path (lambda (p) (cdadr (read p)))))))))) (define (get-compiled-sha1 mode path) (define-values (dir name) (get-compilation-dir+name mode path)) @@ -492,9 +495,11 @@ (define orig-path (simple-form-path path0)) (define (read-deps path) (with-handlers ([exn:fail:filesystem? (lambda (ex) (list (version) '#f))]) - (call-with-input-file - (path-add-suffix (get-compilation-path mode path) #".dep") - read))) + (with-module-reading-parameterization + (lambda () + (call-with-input-file + (path-add-suffix (get-compilation-path mode path) #".dep") + read))))) (define (do-check) (let* ([main-path orig-path] [alt-path (rkt->ss orig-path)] diff --git a/collects/syntax/modread.rkt b/collects/syntax/modread.rkt index 2a29d7bf90..9c95c6a9a7 100644 --- a/collects/syntax/modread.rkt +++ b/collects/syntax/modread.rkt @@ -1,27 +1,11 @@ (module modread mzscheme - (require racket/contract) + (require racket/contract + "private/modread.rkt") (provide with-module-reading-parameterization) (provide/contract [check-module-form ((or/c syntax? eof-object?) symbol? (or/c string? path? false/c) . -> . any)]) - (define (with-module-reading-parameterization thunk) - (parameterize ([read-case-sensitive #t] - [read-square-bracket-as-paren #t] - [read-curly-brace-as-paren #t] - [read-accept-box #t] - [read-accept-compiled #t] - [read-accept-bar-quote #t] - [read-accept-graph #t] - [read-decimal-as-inexact #t] - [read-accept-dot #t] - [read-accept-infix-dot #t] - [read-accept-quasiquote #t] - [read-accept-reader #t] - [read-accept-lang #t] - [current-readtable #f]) - (thunk))) - (define (raise-wrong-module-name filename expected-name name) (error 'load-handler "expected a `module' declaration for `~a' in ~s, found: ~a" diff --git a/collects/syntax/private/modread.rkt b/collects/syntax/private/modread.rkt new file mode 100644 index 0000000000..749c1d3f66 --- /dev/null +++ b/collects/syntax/private/modread.rkt @@ -0,0 +1,20 @@ +#lang racket/base + +(provide with-module-reading-parameterization) + +(define (with-module-reading-parameterization thunk) + (parameterize ([read-case-sensitive #t] + [read-square-bracket-as-paren #t] + [read-curly-brace-as-paren #t] + [read-accept-box #t] + [read-accept-compiled #t] + [read-accept-bar-quote #t] + [read-accept-graph #t] + [read-decimal-as-inexact #t] + [read-accept-dot #t] + [read-accept-infix-dot #t] + [read-accept-quasiquote #t] + [read-accept-reader #t] + [read-accept-lang #t] + [current-readtable #f]) + (thunk)))