add `allow-unbound-ids` (partially resolves #183)

pull/186/head
Matthew Butterick 6 years ago
parent 69df80d115
commit 78aefc7c1f

@ -20,7 +20,8 @@
;; if `define-meta` is defined it will pop an error msg if the wrong number of args ;; if `define-meta` is defined it will pop an error msg if the wrong number of args
;; even though this error will happen after macro expansion, when metas are extracted ;; even though this error will happen after macro expansion, when metas are extracted
;; empty string will merge with surroundings ;; empty string will merge with surroundings
(define+provide (define-meta k v) "") (provide define-meta)
(define-syntax-rule (define-meta k v) (begin))
(define+provide current-metas (make-parameter #f)) (define+provide current-metas (make-parameter #f))

@ -1 +1 @@
1542295809 1542696684

@ -132,4 +132,6 @@
(define-settable poly-targets '(html)) ; current target applied to multi-output source files (define-settable poly-targets '(html)) ; current target applied to multi-output source files
(define+provide current-poly-target (make-parameter (car (poly-targets)))) (define+provide current-poly-target (make-parameter (car (poly-targets))))
(define-settable index-pages '("index.html")) (define-settable index-pages '("index.html"))
(define-settable allow-unbound-ids #true)

@ -1,11 +1,16 @@
#lang racket/base #lang racket/base
(require (for-syntax racket/base) pollen/tag) (require (for-syntax racket/base pollen/setup) pollen/tag)
(provide def/c (rename-out (top~ #%top))) (provide def/c (rename-out (top~ #%top)))
(define-syntax-rule (top~ . ID) (define-syntax (top~ stx)
(#%app make-default-tag-function 'ID)) (syntax-case stx ()
[(_ . ID)
(setup:allow-unbound-ids)
#'(#%app make-default-tag-function 'ID)]
[(_ . ID)
#'(def/c ID)]))
(define-syntax (def/c stx) (define-syntax (def/c stx)
(syntax-case stx () (syntax-case stx ()
[(_ X) (identifier-binding #'X) #'X] [(_ ID) (identifier-binding #'ID) #'ID]
[(_ X) #'(#%top . X)])) [(_ ID) #'(#%top . ID)]))
Loading…
Cancel
Save