fold #lang mb/pollen/pre into #lang mb/pollen

pull/9/head
Matthew Butterick 11 years ago
parent fdd748d38b
commit f814c9a81f

@ -1,6 +1,7 @@
#lang racket/base #lang racket/base
(require (only-in scribble/reader make-at-reader) (require (only-in scribble/reader make-at-reader)
(only-in (planet mb/pollen/world) POLLEN_EXPRESSION_DELIMITER)) (only-in "../world.rkt" POLLEN_EXPRESSION_DELIMITER)
(only-in "../pollen-file-tools.rkt" preproc-source?))
(provide (rename-out [mb-read read] (provide (rename-out [mb-read read]
[mb-read-syntax read-syntax]) [mb-read-syntax read-syntax])
@ -20,8 +21,13 @@
`(module pollen-lang-module (planet mb/pollen) `(module pollen-lang-module (planet mb/pollen)
,@i)) ,@i))
(define (mb-read-syntax name p)
(define i (read-inner name p)) (define (mb-read-syntax path-string p)
(define i (read-inner path-string p))
(datum->syntax i (datum->syntax i
(make-output-datum i) ;; select pollen dialect based on file type
`(module pollen-lang-module ,(if (preproc-source? path-string)
'(planet mb/pollen/main-preproc)
'(planet mb/pollen/main))
,@i)
i)) i))

@ -1,27 +0,0 @@
#lang racket/base
(require (only-in scribble/reader make-at-reader)
(only-in (planet mb/pollen/world) POLLEN_EXPRESSION_DELIMITER))
(provide (rename-out [mb-read read]
[mb-read-syntax read-syntax])
read-inner
)
(define read-inner
(make-at-reader #:command-char POLLEN_EXPRESSION_DELIMITER
#:syntax? #t
#:inside? #t))
(define (mb-read p)
(syntax->datum
(mb-read-syntax (object-name p) p)))
(define (make-output-datum i)
`(module lang-module (planet mb/pollen/main-pre)
,@i))
(define (mb-read-syntax name p)
(define i (read-inner name p))
(datum->syntax i
(make-output-datum i)
i))
Loading…
Cancel
Save