extend reader for repl too
This commit is contained in:
parent
5d3e291c44
commit
a8a41e1820
9
.gitignore
vendored
9
.gitignore
vendored
|
@ -1,10 +1,5 @@
|
|||
|
||||
*.scrbl~
|
||||
|
||||
*.rkt~
|
||||
|
||||
*~
|
||||
compiled/
|
||||
*.html
|
||||
|
||||
*.css
|
||||
|
||||
*.js
|
||||
|
|
10
afl/lang/language-info.rkt
Normal file
10
afl/lang/language-info.rkt
Normal file
|
@ -0,0 +1,10 @@
|
|||
#lang racket/base
|
||||
|
||||
(provide get-language-info)
|
||||
|
||||
(define (get-language-info data)
|
||||
(lambda (key default)
|
||||
(case key
|
||||
[(configure-runtime)
|
||||
'(#[afl/lang/runtime-config configure #f])]
|
||||
[else default])))
|
|
@ -20,7 +20,12 @@
|
|||
;; fall back to /lang/reader:
|
||||
(string->symbol (string-append str "/lang/reader"))))))
|
||||
wrap-reader
|
||||
wrap-reader
|
||||
(lambda (orig-read-syntax)
|
||||
(define read-syntax (wrap-reader orig-read-syntax))
|
||||
(lambda args
|
||||
(syntax-property (apply read-syntax args)
|
||||
'module-language
|
||||
'#(afl/lang/language-info get-language-info #f))))
|
||||
(lambda (proc)
|
||||
(lambda (key defval)
|
||||
(define (fallback) (if proc (proc key defval) defval))
|
||||
|
|
12
afl/lang/runtime-config.rkt
Normal file
12
afl/lang/runtime-config.rkt
Normal file
|
@ -0,0 +1,12 @@
|
|||
#lang racket/base
|
||||
|
||||
(provide configure)
|
||||
|
||||
(require (only-in afl/reader make-afl-readtable))
|
||||
|
||||
(define (configure data)
|
||||
(define old-read (current-read-interaction))
|
||||
(define (new-read src in)
|
||||
(parameterize ([current-readtable (make-afl-readtable (current-readtable))])
|
||||
(old-read src in)))
|
||||
(current-read-interaction new-read))
|
Loading…
Reference in New Issue
Block a user