Moving the code
This commit is contained in:
parent
96ef21b0cb
commit
895560bb75
|
@ -1,33 +1,3 @@
|
|||
#lang racket/base
|
||||
;; Move this into remix/stx0
|
||||
|
||||
(require (for-syntax racket/base
|
||||
remix/stx/raw0))
|
||||
|
||||
(begin-for-syntax
|
||||
(define (do-lang caller-id module-stx stx)
|
||||
(syntax-case stx ()
|
||||
[(_ module-name s ...)
|
||||
(identifier? #'module-name)
|
||||
(let ()
|
||||
(define ip
|
||||
(syntax-strings->input-port
|
||||
(syntax-source stx)
|
||||
(syntax->list #'(s ...))))
|
||||
(define mb
|
||||
(parameterize ([read-accept-reader #t]
|
||||
[read-accept-lang #t])
|
||||
(read-syntax #'module-name ip)))
|
||||
(syntax-case mb ()
|
||||
[(_ _ module-lang body)
|
||||
(quasisyntax/loc stx
|
||||
(#,module-stx module-name module-lang body))]
|
||||
[_
|
||||
(raise-syntax-error caller-id "Body did not read as module" stx mb)]))])))
|
||||
|
||||
(define-syntax (lang stx)
|
||||
(do-lang 'lang #'module stx))
|
||||
(define-syntax (lang* stx)
|
||||
(do-lang 'lang* #'module* stx))
|
||||
|
||||
(require (only-in remix/stx0 lang lang*))
|
||||
(provide lang lang*)
|
||||
|
|
|
@ -363,6 +363,33 @@
|
|||
(remix-block . answer-body)
|
||||
#,(syntax/loc #'more (remix-cond . more)))))]))
|
||||
|
||||
(begin-for-syntax
|
||||
(require remix/stx/raw0)
|
||||
(define (do-lang caller-id module-stx stx)
|
||||
(syntax-case stx ()
|
||||
[(_ module-name s ...)
|
||||
(identifier? #'module-name)
|
||||
(let ()
|
||||
(define ip
|
||||
(syntax-strings->input-port
|
||||
(syntax-source stx)
|
||||
(syntax->list #'(s ...))))
|
||||
(define mb
|
||||
(parameterize ([read-accept-reader #t]
|
||||
[read-accept-lang #t])
|
||||
(read-syntax #'module-name ip)))
|
||||
(syntax-case mb ()
|
||||
[(_ _ module-lang body)
|
||||
(quasisyntax/loc stx
|
||||
(#,module-stx module-name module-lang body))]
|
||||
[_
|
||||
(raise-syntax-error caller-id "Body did not read as module" stx mb)]))])))
|
||||
|
||||
(define-syntax (lang stx)
|
||||
(do-lang 'lang #'module stx))
|
||||
(define-syntax (lang* stx)
|
||||
(do-lang 'lang* #'module* stx))
|
||||
|
||||
(provide def def*
|
||||
(for-syntax gen:def-transformer
|
||||
def-transformer?
|
||||
|
@ -399,6 +426,8 @@
|
|||
module
|
||||
module*
|
||||
module+
|
||||
lang
|
||||
lang*
|
||||
for-syntax
|
||||
provide)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user