[honu] parse brace-enclosed code as an expression

This commit is contained in:
Jon Rafkind 2011-08-09 11:57:36 -06:00
parent b823df23a7
commit 3bcf99b8f6
2 changed files with 16 additions and 1 deletions

View File

@ -220,8 +220,14 @@
[x:atom
(debug "atom ~a current ~a\n" #'x current)
(if current
(values (left current) #'(head rest ...))
(values (left current) stream)
(do-parse #'(rest ...) precedence left #'x))]
[(#%braces stuff ...)
(if current
(values (left current) stream)
(let ()
(define body (parse-all #'(stuff ...)))
(do-parse #'(rest ...) precedence left body)))]
[(#%parens args ...)
(debug "function call ~a\n" left)
(values (left (with-syntax ([current current]

View File

@ -0,0 +1,9 @@
#lang honu
for x = 1 + 5 to 10 do
printf("x is ~a\n" x)
for x = 1 to 10 do {
var y = x + 1;
printf("x ~a y ~a\n", x, y)
}