experiment

works
Matthew Butterick 9 years ago
parent 1780e77dcf
commit db46a175b5

@ -1,7 +1,5 @@
#lang racket/base (module main "private/main-base.rkt"
(require "private/main-base.rkt") default-mode-preproc
(define+provide-module-begin-in-mode default-mode-preproc) ; because default mode in submodule is preproc
(module reader "private/reader-base.rkt" (module reader "private/reader-base.rkt"
default-mode-auto) default-mode-auto))

@ -1,7 +1,5 @@
#lang racket/base (module markdown "private/main-base.rkt"
(require "private/main-base.rkt") default-mode-markdown
(define+provide-module-begin-in-mode default-mode-markdown)
(module reader "private/reader-base.rkt" (module reader "private/reader-base.rkt"
default-mode-markdown) default-mode-markdown))

@ -1,7 +1,5 @@
#lang racket/base (module markup "private/main-base.rkt"
(require "private/main-base.rkt") default-mode-markup
(define+provide-module-begin-in-mode default-mode-markup)
(module reader "private/reader-base.rkt" (module reader "private/reader-base.rkt"
default-mode-markup) default-mode-markup))

@ -1,7 +1,5 @@
#lang racket/base (module pre "private/main-base.rkt"
(require "private/main-base.rkt") default-mode-preproc
(define+provide-module-begin-in-mode default-mode-preproc)
(module reader "private/reader-base.rkt" (module reader "private/reader-base.rkt"
default-mode-preproc) default-mode-preproc))

@ -1,10 +1,14 @@
#lang racket/base #lang racket/base
(require (for-syntax racket/base syntax/strip-context racket/syntax "../setup.rkt" "split-metas.rkt") (require (for-syntax racket/base syntax/strip-context racket/syntax "../setup.rkt" "split-metas.rkt")
"to-string.rkt" "../pagetree.rkt" "splice.rkt" "../setup.rkt" ) ; need world here to resolve PARSER-MODE-ARG "to-string.rkt" "../pagetree.rkt" "splice.rkt" "../setup.rkt")
(provide (all-defined-out)) (require "../setup.rkt")
(provide (except-out (all-from-out racket/base) #%module-begin)
(all-from-out "../setup.rkt")
(rename-out [dialect-module-begin #%module-begin]))
(define-syntax-rule (define+provide-module-begin-in-mode PARSER-MODE-ARG) (define-syntax-rule (make-pollen-module-begin PARSER-MODE-IN)
(begin (begin
(require racket/base)
(provide (except-out (all-from-out racket/base) #%module-begin) (provide (except-out (all-from-out racket/base) #%module-begin)
(rename-out [pollen-module-begin #%module-begin])) (rename-out [pollen-module-begin #%module-begin]))
(define-syntax (pollen-module-begin stx) (define-syntax (pollen-module-begin stx)
@ -40,7 +44,7 @@
(define DOC (define DOC
(let* ([parser-mode-undefined? (procedure? inner:parser-mode)] ; if undefined, #%top makes it a procedure (let* ([parser-mode-undefined? (procedure? inner:parser-mode)] ; if undefined, #%top makes it a procedure
[parser-mode (if parser-mode-undefined? PARSER-MODE-ARG inner:parser-mode)] [parser-mode (if parser-mode-undefined? PARSER-MODE-IN inner:parser-mode)]
[proc (cond [proc (cond
[(eq? parser-mode 'MODE-PAGETREE) decode-pagetree] [(eq? parser-mode 'MODE-PAGETREE) decode-pagetree]
[(eq? parser-mode 'MODE-MARKUP) (λ(xs) (apply ROOT xs))] ; if `root` undefined, it becomes a default tag function [(eq? parser-mode 'MODE-MARKUP) (λ(xs) (apply ROOT xs))] ; if `root` undefined, it becomes a default tag function
@ -52,4 +56,9 @@
[doc-elements-spliced (splice doc-elements 'SPLICING_TAG)]) [doc-elements-spliced (splice doc-elements 'SPLICING_TAG)])
(proc doc-elements-spliced))) (proc doc-elements-spliced)))
(provide DOC METAS (except-out (all-from-out 'inner) DOC-RAW #%top))))))])))) ; hide internal exports (provide DOC METAS (except-out (all-from-out 'inner) DOC-RAW #%top))))))]))))
(define-syntax-rule (dialect-module-begin MODE EXPR ...)
(#%module-begin
(make-pollen-module-begin MODE)
EXPR ...))

@ -1,7 +1,5 @@
#lang racket/base (module ptree "private/main-base.rkt"
(require "private/main-base.rkt") default-mode-pagetree
(define+provide-module-begin-in-mode default-mode-pagetree)
(module reader "private/reader-base.rkt" (module reader "private/reader-base.rkt"
default-mode-pagetree) default-mode-pagetree))

Loading…
Cancel
Save