diff --git a/collects/honu/core/private/honu2.rkt b/collects/honu/core/private/honu2.rkt index 36043efb6e..609af1715b 100644 --- a/collects/honu/core/private/honu2.rkt +++ b/collects/honu/core/private/honu2.rkt @@ -61,8 +61,6 @@ #'rest #f)]))) - - (provide honu-if) (define-honu-syntax honu-if (lambda (code context) @@ -70,7 +68,10 @@ #:literals (else honu-then) [(_ (#%parens condition:honu-expression) true:honu-expression (~optional else) false:honu-expression . rest) (values - #'(%racket (if condition.result true.result false.result)) + (with-syntax ([condition.result (honu->racket #'condition.result)] + [true.result (honu->racket #'true.result)] + [false.result (honu->racket #'false.result)]) + #'(%racket (if condition.result true.result false.result))) #'rest #f)]))) diff --git a/collects/honu/core/private/operator.rkt b/collects/honu/core/private/operator.rkt index 1c22ff6d02..9745be3fae 100644 --- a/collects/honu/core/private/operator.rkt +++ b/collects/honu/core/private/operator.rkt @@ -3,6 +3,7 @@ (require (for-syntax racket/base "transformer.rkt" "fixture.rkt" + "compile.rkt" syntax/parse) (only-in "literals.rkt" %racket)) @@ -24,12 +25,12 @@ (define-honu-operator/syntax name precedence associativity ;; binary (lambda (left right) - (with-syntax ([left left] - [right right]) + (with-syntax ([left (honu->racket left)] + [right (honu->racket right)]) #'(%racket (operator left right)))) ;; unary (lambda (argument) - (with-syntax ([argument argument]) + (with-syntax ([argument (honu->racket argument)]) #'(%racket (operator argument)))))) (define-syntax-rule (define-unary-operator name precedence associativity operator) @@ -37,20 +38,20 @@ #f ;; unary (lambda (argument) - (with-syntax ([argument argument]) + (with-syntax ([argument (honu->racket argument)]) #'(%racket (operator argument)))))) (define-honu-operator/syntax honu-flow 0.001 'left (lambda (left right) - (with-syntax ([left left] - [right right]) + (with-syntax ([left (honu->racket left)] + [right (honu->racket right)]) #'(%racket (right left))))) (begin-for-syntax (define-syntax-rule (mutator change) (lambda (left right) - (with-syntax ([left left] - [right (change left right)]) + (with-syntax ([left (honu->racket left)] + [right (change left (honu->racket right))]) #'(%racket (set! left right)))))) ;; Traditional assignment operator diff --git a/collects/honu/core/private/parse2.rkt b/collects/honu/core/private/parse2.rkt index 689c99eb42..617df52bdf 100644 --- a/collects/honu/core/private/parse2.rkt +++ b/collects/honu/core/private/parse2.rkt @@ -373,7 +373,7 @@ #; (emit-local-step stuff output #:id binary-transformer) (with-syntax ([out (parse-all output)]) - #'(%racket out))) + #'out)) #f)]) (do-parse unparsed precedence left parsed)) @@ -441,10 +441,13 @@ colon (~seq variable:id honu-equal list:honu-expression (~optional honu-comma)) ... (~seq honu-where where:honu-expression (~optional honu-comma)) ...) (define filter (if (attribute where) - #'((#:when where.result) ...) + (with-syntax ([(where.result ...) (map honu->racket (syntax->list #'(where.result ...)))]) + #'((#:when where.result) ...)) #'())) (define comprehension - (with-syntax ([((filter ...) ...) filter]) + (with-syntax ([((filter ...) ...) filter] + [(list.result ...) (map honu->racket (syntax->list #'(list.result ...)))] + [work.result (honu->racket #'work.result)]) #'(for/list ([variable list.result] ... filter ... ...)