alt
parent
2339fcfb72
commit
3f17c47d6f
@ -1,22 +1,32 @@
|
|||||||
|
#|
|
||||||
#lang s-exp syntax/module-reader
|
#lang s-exp syntax/module-reader
|
||||||
#:read read
|
#:read read
|
||||||
#:read-syntax read-syntax
|
#:read-syntax read-syntax
|
||||||
#:language `(submod ,aoc-lang expander)
|
#:language `(submod ,aoc-lang expander)
|
||||||
(require racket/runtime-path)
|
(require racket/runtime-path)
|
||||||
(define-runtime-path aoc-lang "aoc-lang.rkt")
|
(define-runtime-path aoc-lang "aoc-lang.rkt")
|
||||||
|
|#
|
||||||
|
|
||||||
(module expander br/quicklang
|
#lang br/quicklang
|
||||||
(require "helper.rkt")
|
(require "helper.rkt")
|
||||||
(provide (except-out (all-from-out br/quicklang "helper.rkt") #%module-begin)
|
(provide (except-out (all-from-out br/quicklang "helper.rkt") read-syntax #%module-begin)
|
||||||
(rename-out [#%mb #%module-begin]))
|
(rename-out [my-rs read-syntax] [my-mb #%module-begin]))
|
||||||
|
|
||||||
(define-macro (#%mb . ARGS)
|
(define (my-rs path port)
|
||||||
(with-pattern ([MODULE-PATH (syntax-source caller-stx)])
|
(define datums (for/list ([datum (in-port (curry read-syntax path) port)])
|
||||||
#'(#%module-begin
|
datum))
|
||||||
(provide read-syntax)
|
(strip-context (with-pattern ([THIS-FILE (syntax-source #'here)]
|
||||||
(define (read-syntax path port)
|
[DATUMS datums])
|
||||||
(strip-context #`(module mod MODULE-PATH
|
(syntax/loc (car datums) (module puzzle-lang THIS-FILE
|
||||||
#,@(for/list ([line (in-lines port)])
|
. DATUMS)))))
|
||||||
(for/list ([datums (in-port read (open-input-string line))])
|
|
||||||
datums)))))
|
(define-macro (my-mb . ARGS)
|
||||||
. ARGS))))
|
(with-pattern ([MOD-PATH (syntax-source caller-stx)])
|
||||||
|
#'(#%module-begin
|
||||||
|
(provide read-syntax)
|
||||||
|
(define (read-syntax path port)
|
||||||
|
(strip-context #`(module mod MOD-PATH
|
||||||
|
#,@(for/list ([line (in-lines port)])
|
||||||
|
(for/list ([datums (in-port read (open-input-string line))])
|
||||||
|
datums)))))
|
||||||
|
. ARGS)))
|
||||||
|
Reference in New Issue