[honu] fix some tests. always reparse the right hand side of an operator

This commit is contained in:
Jon Rafkind 2012-03-05 13:47:30 -07:00
parent 249c7b02ca
commit a94b7b9260
6 changed files with 19 additions and 12 deletions

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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
}

View File

@ -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)])))
#|

View File

@ -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} {