use configure-runtime submodule

pull/139/head
Matthew Butterick 8 years ago
parent 877d3580dd
commit e41955fe05

@ -1,7 +0,0 @@
#lang racket/base
(provide get-language-info)
(define (get-language-info top-here-path)
(λ(key default)
(case key
[(configure-runtime) `(#(pollen/private/runtime-config configure ,top-here-path))]
[else default])))

@ -34,7 +34,6 @@
(read-inner path-string p))) (read-inner path-string p)))
(define reader-here-path (path-string->here-path path-string)) (define reader-here-path (path-string->here-path path-string))
(define parser-mode-from-reader (infer-parser-mode reader-mode reader-here-path)) (define parser-mode-from-reader (infer-parser-mode reader-mode reader-here-path))
(define parsed-syntax
(strip-context (strip-context
(with-syntax* ([HERE-KEY (setup:here-path-key)] (with-syntax* ([HERE-KEY (setup:here-path-key)]
[HERE-PATH reader-here-path] [HERE-PATH reader-here-path]
@ -51,16 +50,16 @@
. SOURCE-LINES)]) . SOURCE-LINES)])
(syntax-property mod-stx 'parser-mode-from-reader parser-mode-from-reader))]) (syntax-property mod-stx 'parser-mode-from-reader parser-mode-from-reader))])
#'(module runtime-wrapper racket/base #'(module runtime-wrapper racket/base
(module configure-runtime racket/base
(require pollen/private/runtime-config)
(configure HERE-PATH)) ; HERE-PATH acts as "top" runtime config when module is main
POLLEN-MODULE-SYNTAX POLLEN-MODULE-SYNTAX
(module META-MOD racket/base (module META-MOD racket/base
(require (submod ".." POLLEN-MOD-NAME META-MOD)) (require (submod ".." POLLEN-MOD-NAME META-MOD))
(provide (all-from-out (submod ".." POLLEN-MOD-NAME META-MOD)))) (provide (all-from-out (submod ".." POLLEN-MOD-NAME META-MOD))))
(require (submod pollen/private/runtime-config show) 'POLLEN-MOD-NAME) (require (only-in pollen/private/runtime-config show) 'POLLEN-MOD-NAME)
(provide (all-from-out 'POLLEN-MOD-NAME)) (provide (all-from-out 'POLLEN-MOD-NAME))
(show DOC 'PARSER-MODE-FROM-READER HERE-PATH))))) ; HERE-PATH acts as "local" runtime config (show DOC 'PARSER-MODE-FROM-READER HERE-PATH))))) ; HERE-PATH otherwise acts as "local" runtime config
(syntax-property parsed-syntax
'module-language
`#(pollen/private/language-info get-language-info ,reader-here-path))) ; reader-here-path acts as "top" runtime config
(define (custom-get-info in mod line col pos) (define (custom-get-info in mod line col pos)
;; DrRacket caches source file information per session, ;; DrRacket caches source file information per session,

@ -1,7 +1,6 @@
#lang racket/base #lang racket/base
(require pollen/setup scribble/reader) (require pollen/setup scribble/reader)
(provide configure) (provide (all-defined-out))
(module+ show (provide show)) ; `show` submodule requested by module wrapper in "reader-base.rkt"
(define current-top-path (make-parameter #f)) (define current-top-path (make-parameter #f))
@ -18,10 +17,8 @@
((dynamic-require 'racket/string 'string-join) (cdr ((dynamic-require 'racket/string 'string-split) (exn-message exn) ": ")) ": "))))]) ((dynamic-require 'racket/string 'string-join) (cdr ((dynamic-require 'racket/string 'string-split) (exn-message exn) ": ")) ": "))))])
((dynamic-require 'txexpr/base 'validate-txexpr) doc))))))) ((dynamic-require 'txexpr/base 'validate-txexpr) doc)))))))
(define (configure top-here-path) (define (configure top-here-path)
;; puts `show` into the right mode (current-top-path top-here-path) ;; puts `show` into the right mode
(current-top-path top-here-path)
;; wrap REPL interactions with pollen expression support ;; wrap REPL interactions with pollen expression support
(define old-read (current-read-interaction)) (define old-read (current-read-interaction))

@ -1 +1 @@
1484772880 1484775689

Loading…
Cancel
Save