[honu] fix some tests. always reparse the right hand side of an operator
This commit is contained in:
parent
249c7b02ca
commit
a94b7b9260
|
@ -42,8 +42,8 @@
|
|||
|
||||
(define-honu-operator/syntax honu-flow 0.001 'left
|
||||
(lambda (left right)
|
||||
(with-syntax ([left (honu->racket left)]
|
||||
[right (honu->racket right)])
|
||||
(with-syntax ([left left]
|
||||
[right right])
|
||||
(racket-syntax (right left)))))
|
||||
|
||||
(begin-for-syntax
|
||||
|
|
|
@ -220,6 +220,9 @@
|
|||
(racket-syntax (define (function parsed-arguments ...)
|
||||
body.result)))])
|
||||
|
||||
(define (definition? code)
|
||||
#f)
|
||||
|
||||
;; E = macro
|
||||
;; | E operator E
|
||||
;; | [...]
|
||||
|
@ -299,6 +302,7 @@
|
|||
re-parse re-parse))))
|
||||
#;
|
||||
(debug "Reparsed output ~a\n" (pretty-format (syntax->datum re-parse)))
|
||||
(define terminate (definition? re-parse))
|
||||
(if terminate?
|
||||
(values (left re-parse)
|
||||
#'rest)
|
||||
|
@ -375,13 +379,14 @@
|
|||
(let-values ([(parsed unparsed)
|
||||
(do-parse #'(rest ...) new-precedence
|
||||
(lambda (stuff)
|
||||
(define right (parse-all stuff))
|
||||
(define output
|
||||
(if current
|
||||
(if binary-transformer
|
||||
(binary-transformer current stuff)
|
||||
(binary-transformer current right)
|
||||
(error 'binary "cannot be used as a binary operator in ~a" #'head))
|
||||
(if unary-transformer
|
||||
(unary-transformer stuff)
|
||||
(unary-transformer right)
|
||||
(error 'unary "cannot be used as a unary operator in ~a" #'head))))
|
||||
#;
|
||||
(debug "Binary transformer ~a\n" binary-transformer)
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
(for-syntax racket/base
|
||||
"parse2.rkt"
|
||||
"literals.rkt"
|
||||
"compile.rkt"
|
||||
syntax/parse
|
||||
unstable/syntax))
|
||||
|
||||
|
@ -37,7 +38,7 @@
|
|||
(make-accessors #'name (syntax->list #'(fields.name ...)))]
|
||||
[(fields.name/mutator ...)
|
||||
(make-mutators #'name (syntax->list #'(fields.name ...)))])
|
||||
#'(%racket (struct name (fields.name ...)
|
||||
(racket-syntax (struct name (fields.name ...)
|
||||
#:transparent
|
||||
#:mutable
|
||||
#:property honu-struct-mutable
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#lang honu
|
||||
|
||||
foo(x){
|
||||
function foo(x){
|
||||
x + 1
|
||||
}
|
||||
|
||||
bar(x){
|
||||
function bar(x){
|
||||
x * 2
|
||||
}
|
||||
|
||||
buz(z){
|
||||
function buz(z){
|
||||
z - 4
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
(for-syntax racket/base
|
||||
honu/core/private/literals
|
||||
honu/core/private/parse2
|
||||
honu/core/private/compile
|
||||
syntax/parse))
|
||||
|
||||
(define-literal+set linq-literals
|
||||
|
@ -36,9 +37,9 @@
|
|||
#'(sort store.result string<?
|
||||
#:key (lambda (name) order-by.result))
|
||||
#'store.result)])
|
||||
#'(%racket (for/list ([name order]
|
||||
guard ...)
|
||||
select.result))))
|
||||
(racket-syntax (for/list ([name order]
|
||||
guard ...)
|
||||
select.result))))
|
||||
(values out #'rest #f)])))
|
||||
|
||||
#|
|
||||
|
|
|
@ -8,7 +8,7 @@ macro testx () {x:expression} {
|
|||
|
||||
testx 5 * 2
|
||||
|
||||
for z in 1 to testx 5 * 2 do
|
||||
for z in 1 to testx 6 * 2 do
|
||||
printf("z is ~a\n", z)
|
||||
|
||||
macro testfor () {x:expression} {
|
||||
|
|
Loading…
Reference in New Issue
Block a user