From b8d050bbe8e2484e5406d0a6181b43eb711bbf3c Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Wed, 10 Feb 2016 08:36:27 -0800 Subject: [PATCH] module-lang-ify reader --- pollen/main.rkt | 5 ++--- pollen/markdown.rkt | 5 ++--- pollen/markup.rkt | 5 ++--- pollen/pre.rkt | 5 ++--- pollen/private/reader-base.rkt | 8 ++++---- pollen/ptree.rkt | 5 ++--- 6 files changed, 14 insertions(+), 19 deletions(-) diff --git a/pollen/main.rkt b/pollen/main.rkt index 8ab2fb3..b6ab87e 100644 --- a/pollen/main.rkt +++ b/pollen/main.rkt @@ -3,6 +3,5 @@ (define+provide-module-begin-in-mode default-mode-preproc) ; because default mode in submodule is preproc -(module reader racket/base - (require pollen/private/reader-base) - (define+provide-reader-in-mode default-mode-auto)) ; because default mode in file is auto +(module reader "private/reader-base.rkt" + default-mode-auto) \ No newline at end of file diff --git a/pollen/markdown.rkt b/pollen/markdown.rkt index 2d9c378..3321656 100644 --- a/pollen/markdown.rkt +++ b/pollen/markdown.rkt @@ -3,6 +3,5 @@ (define+provide-module-begin-in-mode default-mode-markdown) -(module reader racket/base - (require pollen/private/reader-base) - (define+provide-reader-in-mode default-mode-markdown)) +(module reader "private/reader-base.rkt" + default-mode-markdown) diff --git a/pollen/markup.rkt b/pollen/markup.rkt index bed1538..f7974fe 100644 --- a/pollen/markup.rkt +++ b/pollen/markup.rkt @@ -3,6 +3,5 @@ (define+provide-module-begin-in-mode default-mode-markup) -(module reader racket/base - (require pollen/private/reader-base) - (define+provide-reader-in-mode default-mode-markup)) +(module reader "private/reader-base.rkt" + default-mode-markup) diff --git a/pollen/pre.rkt b/pollen/pre.rkt index 4862faa..4f92f1b 100644 --- a/pollen/pre.rkt +++ b/pollen/pre.rkt @@ -3,6 +3,5 @@ (define+provide-module-begin-in-mode default-mode-preproc) -(module reader racket/base - (require pollen/private/reader-base) - (define+provide-reader-in-mode default-mode-preproc)) +(module reader "private/reader-base.rkt" + default-mode-preproc) diff --git a/pollen/private/reader-base.rkt b/pollen/private/reader-base.rkt index 687d4a1..9f42236 100644 --- a/pollen/private/reader-base.rkt +++ b/pollen/private/reader-base.rkt @@ -1,7 +1,7 @@ #lang racket/base (require racket/syntax syntax/strip-context racket/class (for-syntax racket/base racket/syntax)) (require (only-in scribble/reader make-at-reader) "../setup.rkt" "project.rkt" racket/function) -(provide define+provide-reader-in-mode (all-from-out "../setup.rkt")) +(provide (rename-out [reader-module-begin #%module-begin]) (all-from-out "../setup.rkt")) (define current-reader-mode (make-parameter #f)) @@ -81,13 +81,13 @@ (my-make-drracket-buttons my-command-char)])] [else default])))) -(define-syntax (define+provide-reader-in-mode stx) +(define-syntax (reader-module-begin stx) (syntax-case stx () - [(_ mode) + [(_ mode expr-to-ignore ...) (with-syntax ([cr (generate-temporary)] [crs (generate-temporary)] [cgi (generate-temporary)]) - #'(begin + #'(#%module-begin (current-reader-mode mode) (define cgi custom-get-info) (define cr custom-read) diff --git a/pollen/ptree.rkt b/pollen/ptree.rkt index 7014d03..14665b5 100644 --- a/pollen/ptree.rkt +++ b/pollen/ptree.rkt @@ -3,6 +3,5 @@ (define+provide-module-begin-in-mode default-mode-pagetree) -(module reader racket/base - (require pollen/private/reader-base) - (define+provide-reader-in-mode default-mode-pagetree)) +(module reader "private/reader-base.rkt" + default-mode-pagetree)