[honu] parse brace-enclosed code as an expression
This commit is contained in:
parent
b823df23a7
commit
3bcf99b8f6
|
@ -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]
|
||||
|
|
9
collects/tests/honu/for.honu
Normal file
9
collects/tests/honu/for.honu
Normal 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)
|
||||
}
|
Loading…
Reference in New Issue
Block a user