enable at-reader in `br` languages

v6.3-exception
Matthew Butterick 7 years ago
parent b2c3988d81
commit 0f002c5586

@ -17,7 +17,19 @@
"until") 'define] "until") 'define]
[else #f]))))) [else #f])))))
(define (br-get-info key default default-filter) (define (br-get-info key default-value proc)
(case key (define (fallback) (if proc (proc key default-value) default-value))
(define (try-dynamic-require lib export)
(with-handlers ([exn:missing-module?
(λ (x) (case key
[(drracket:indentation) indenter] [(drracket:indentation) indenter]
[else (default-filter key default)])) [else (fallback)]))])
(dynamic-require lib export)))
(case key
[(color-lexer)
(try-dynamic-require 'syntax-color/scribble-lexer 'scribble-lexer)]
[(drracket:indentation)
(try-dynamic-require 'scribble/private/indentation 'determine-spaces)]
[(drracket:keystrokes)
(try-dynamic-require 'scribble/private/indentation 'keystrokes)]
[else (fallback)]))

@ -22,4 +22,6 @@
(module reader syntax/module-reader (module reader syntax/module-reader
#:language 'br #:language 'br
#:info br-get-info #:info br-get-info
(require br/get-info)) #:read at:read
#:read-syntax at:read-syntax
(require br/get-info (prefix-in at: scribble/reader)))

@ -5,11 +5,13 @@
(for-syntax (all-from-out sugar/debug))) (for-syntax (all-from-out sugar/debug)))
(define-macro (quicklang-mb . EXPRS) (define-macro (quicklang-mb . EXPRS)
#`(#%module-begin #'(#%module-begin
(provide #%top #%app #%datum #%top-interaction) (provide #%top #%app #%datum #%top-interaction)
. EXPRS)) . EXPRS))
(module reader syntax/module-reader (module reader syntax/module-reader
#:language 'br/quicklang #:language 'br/quicklang
#:info br-get-info #:info br-get-info
(require br/get-info)) #:read at:read
#:read-syntax at:read-syntax
(require br/get-info (prefix-in at: scribble/reader)))
Loading…
Cancel
Save