Protecting :- outside clauses

original commit: b126303628f4b1870094949558f89e587b044c97
This commit is contained in:
Jay McCarthy 2010-06-26 13:08:10 -06:00
parent 1e0f7514bc
commit 77b5b07e9b

View File

@ -4,6 +4,9 @@
"../eval.rkt"
"../ast.rkt")
(define-syntax (:- stx)
(raise-syntax-error ':- "only allowed inside ! and ~" stx))
(define-syntax-parameter top
(λ (stx) (raise-syntax-error '#%top "undefined identifier" stx)))
(define-syntax-parameter unquote
@ -48,20 +51,14 @@
(define-syntax (->simple-clause stx)
(syntax-case stx (:-)
[(_ (:- . r))
[(_ (:- head body ...))
(quasisyntax/loc stx
(:- . r))]
(clause #'#,stx (->literal head)
(list (->literal body) ...)))]
[(_ e)
(quasisyntax/loc stx
(clause #'#,stx (->literal e) empty))]))
(define-syntax (:- stx)
(syntax-case stx ()
[(_ head body ...)
(quasisyntax/loc stx
(clause #'#,stx (->literal head)
(list (->literal body) ...)))]))
(define-syntax-rule (define-paren-stx op struct)
(define-syntax (op stx)
(syntax-case stx ()