diff --git a/collects/honu/main.rkt b/collects/honu/main.rkt index 6d1e71a9bf..bbac97ed70 100644 --- a/collects/honu/main.rkt +++ b/collects/honu/main.rkt @@ -51,6 +51,7 @@ ) (parse-an-expr parse) (... scheme:...) + (honu-body:class body) (honu-syntax syntax) (honu-+ +) (honu-scheme scheme2) diff --git a/collects/honu/private/literals.rkt b/collects/honu/private/literals.rkt index 6e40eaf7a1..50a8c2a22f 100644 --- a/collects/honu/private/literals.rkt +++ b/collects/honu/private/literals.rkt @@ -16,4 +16,4 @@ honu-= honu-+= honu--= honu-*= honu-/= honu-%= honu-&= honu-^= honu-\|= honu-<<= honu->>= honu->>>= honu->> honu-<< honu->>> honu-< honu-> honu-<= honu->= - honu-? honu-: honu-comma honu-. #%braces #%parens) + honu-? honu-: honu-comma honu-. #%braces #%parens colon) diff --git a/collects/honu/private/macro.rkt b/collects/honu/private/macro.rkt index 0f20c84ead..21919c6a8b 100644 --- a/collects/honu/private/macro.rkt +++ b/collects/honu/private/macro.rkt @@ -63,7 +63,16 @@ [(_ x ...) |# -(define-for-syntax (fix-template stx) stx) +(define-for-syntax (fix-template stx) + (syntax-parse stx #:literals (honu-:) + [(variable:id honu-: class:id rest ...) + (with-syntax ([(rest* ...) (fix-template #'(rest ...))]) + #'((~var variable class) rest* ...))] + [(one rest ...) + (with-syntax ([one* (fix-template #'one)] + [(rest* ...) (fix-template #'(rest ...))]) + #'(one* rest* ...))] + [else stx])) #| (define-for-syntax (fix-template stx) @@ -402,14 +411,16 @@ . rest) #:with result (list - (syntax/loc stx - (define-honu-syntax name - (lambda (stx ctx) - (syntax-parse stx #:literals (literals ...) - [(template ... rrest (... ...)) - (values - (honu-unparsed-begin code ...) - #'(rrest (... ...)))])))) + (with-syntax ([(fixed ...) (fix-template #'(template ...))]) + (syntax/loc stx + (define-honu-syntax name + (lambda (stx ctx) + (syntax-parse stx #:literals (literals ...) + [(fixed ... rrest (... ...)) + (values + (let ([result (honu-unparsed-begin code ...)]) + (lambda () result)) + #'(rrest (... ...)))]))))) #; (with-syntax ([parsed (let-values ([(out rest*) (parse-block-one/2 #'(code ...) diff --git a/collects/honu/private/parse.rkt b/collects/honu/private/parse.rkt index 5da1e75164..08f085a02f 100644 --- a/collects/honu/private/parse.rkt +++ b/collects/honu/private/parse.rkt @@ -352,6 +352,10 @@ [else (raise-syntax-error 'parse-an-expr "cant parse" stx)] )) +(define-splicing-syntax-class honu-body:class + #:literals (#%braces) + [pattern (~seq (#%braces code ...))]) + (define (parse-block-one/2 stx context) (define (parse-one stx context)