49 lines
1.4 KiB
Racket
49 lines
1.4 KiB
Racket
#lang racket/base
|
|
|
|
(require (except-in racket-makefile make)
|
|
(only-in racket-makefile [make make/procedure])
|
|
(for-syntax racket/base
|
|
syntax/parse
|
|
linea/line-macro-prop))
|
|
|
|
(provide (except-out
|
|
(all-from-out racket-makefile)
|
|
raco
|
|
git
|
|
make/procedure)
|
|
make)
|
|
|
|
;; In an ordinary Racket expression, `make` remains the first-class procedure
|
|
;; exported by racket-makefile. In Linea/Rash line syntax the same identifier
|
|
;; gets a second meaning: bare target names are converted to symbols before the
|
|
;; procedure is called.
|
|
(begin-for-syntax
|
|
(define (target-argument->expression stx)
|
|
(syntax-parse stx
|
|
[(quote value)
|
|
stx]
|
|
[id:id
|
|
#`(quote #,(syntax-e #'id))]
|
|
[_
|
|
stx]))
|
|
|
|
(struct make-line-binding (target)
|
|
#:property prop:procedure
|
|
(λ (self stx)
|
|
(syntax-parse stx
|
|
[id:id
|
|
(make-line-binding-target self)]
|
|
[(id argument ...)
|
|
#`(#,(make-line-binding-target self) argument ...)]))
|
|
#:property prop:line-macro
|
|
(λ (self stx)
|
|
(syntax-parse stx
|
|
[(_ argument ...)
|
|
(define arguments
|
|
(map target-argument->expression
|
|
(syntax->list #'(argument ...))))
|
|
#`(#,(make-line-binding-target self) #,@arguments)]))))
|
|
|
|
(define-syntax make
|
|
(make-line-binding #'make/procedure))
|