simplify reader-base

pull/9/head
Matthew Butterick 11 years ago
parent 6a25de6462
commit 62a4d504c7

@ -1,18 +1,19 @@
#lang racket/base
(require (only-in scribble/reader make-at-reader)
pollen/world)
(require (only-in scribble/reader make-at-reader) pollen/world)
(provide (all-defined-out) (all-from-out pollen/world))
(provide make-reader-with-mode (all-from-out pollen/world))
(define read-inner
(make-at-reader #:command-char EXPRESSION_DELIMITER #:syntax? #t #:inside? #t))
(define read-inner (make-at-reader
#:command-char EXPRESSION_DELIMITER
#:syntax? #t
#:inside? #t))
(define (make-pollen-read pollen-read-syntax-proc)
(define (make-custom-read custom-read-syntax-proc)
(λ(p)
(syntax->datum
(pollen-read-syntax-proc (object-name p) p))))
(custom-read-syntax-proc (object-name p) p))))
(define (make-pollen-read-syntax reader-mode)
(define (make-custom-read-syntax reader-mode)
(λ (path-string p)
(define file-contents (read-inner path-string p))
(datum->syntax file-contents
@ -24,6 +25,6 @@
(define-syntax-rule (make-reader-with-mode mode)
(begin
(define reader-mode mode)
(define pollen-read-syntax (make-pollen-read-syntax reader-mode))
(define pollen-read (make-pollen-read pollen-read-syntax))
(provide (rename-out [pollen-read read] [pollen-read-syntax read-syntax]) read-inner)))
(define custom-read-syntax (make-custom-read-syntax reader-mode))
(define custom-read (make-custom-read custom-read-syntax))
(provide (rename-out [custom-read read] [custom-read-syntax read-syntax]))))

Loading…
Cancel
Save