aboutsummaryrefslogtreecommitdiff
path: root/core/coroutines.nom
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2018-12-30 19:04:34 -0800
committerBruce Hill <bruce@bruce-hill.com>2018-12-30 19:04:45 -0800
commit8a3c32408733a2f5e14f8a2dbafa3f980b2f73a1 (patch)
tree68f1e8a8b956c33ed24cc7a6a369fd97b8849321 /core/coroutines.nom
parent359152da1772ce501609edd8f84b4985ed3e42f2 (diff)
Update to new syntax.
Diffstat (limited to 'core/coroutines.nom')
-rw-r--r--core/coroutines.nom16
1 files changed, 9 insertions, 7 deletions
diff --git a/core/coroutines.nom b/core/coroutines.nom
index 9f6f6f4..c1dd21d 100644
--- a/core/coroutines.nom
+++ b/core/coroutines.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V5.12.12.8
+#!/usr/bin/env nomsu -V6.12.12.8
#
This file defines the code that creates and manipulates coroutines
@@ -9,17 +9,18 @@ use "core/control_flow.nom"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test:
- $co = (..)
+ $co =
->:
yield 4
yield 5
repeat 3 times:
yield 6
$nums = []
- for $ in coroutine $co: $nums|add $
+ for $ in coroutine $co:
+ $nums, add $
assume ($nums == [4, 5, 6, 6, 6]) or barf "Coroutine iteration failed"
- $d = {x: 0}
- $co2 = (..)
+ $d = {.x = 0}
+ $co2 =
coroutine:
$d.x += 1
yield 1
@@ -29,7 +30,8 @@ test:
repeat while ((coroutine status of $co2) != "dead"): resume $co2
assume $d.x == 3
(coroutine $body) parses as (coroutine from (-> $body))
-(for $ in coroutine $co $body) compiles to "
+(for $ in coroutine $co $body) compiles to ("
for \($ as lua expr) in coroutine_wrap(\($co as lua expr)) do
\($body as lua)
- end"
+ end
+")