aboutsummaryrefslogtreecommitdiff
path: root/lib/core/coroutines.nom
diff options
context:
space:
mode:
Diffstat (limited to 'lib/core/coroutines.nom')
-rw-r--r--lib/core/coroutines.nom20
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/core/coroutines.nom b/lib/core/coroutines.nom
index b151a4b..a11d6ee 100644
--- a/lib/core/coroutines.nom
+++ b/lib/core/coroutines.nom
@@ -1,5 +1,6 @@
-#!/usr/bin/env nomsu -V6.15.13.8
-#
+#!/usr/bin/env nomsu -V7.0.0
+
+###
This file defines the code that creates and manipulates coroutines
use "core/metaprogramming"
@@ -16,11 +17,8 @@ test:
repeat 3 times:
yield 6
$nums = []
- for $ in (coroutine from $fn):
- $nums, add $
-
+ for $ in (coroutine from $fn): $nums, add $
assume ($nums == [4, 5, 6, 6, 6])
-
$d = {.x = 0}
$co =
coroutine:
@@ -35,7 +33,6 @@ test:
[$ok, $val] = (co)
assume ($ok == (yes))
assume ($val == 5)
-
$t = []
$i = 1
for $ in
@@ -47,8 +44,7 @@ test:
..:
$t.$i = $
$i += 1
- assume ($t == [4,5,nil,6])
-
+ assume ($t == [4, 5, nil, 6])
$t = []
for ($k = $) in
coroutine:
@@ -58,11 +54,11 @@ test:
yield 6
..:
$t, add {.key = $k, .value = $}
+
assume $t == [
{.key = 1, .value = 4}, {.key = 2, .value = 5}, {.key = 3}, {.key = 4, .value = 6}
]
-
-(coroutine $body) parses as (coroutine from (-> $body))
+(coroutine $body) parses as (coroutine from ->$body)
external:
($ is a dead coroutine) means
- ((lua type of $) == "thread") and ((coroutine status of $) == "dead")
+ ((lua type of $) == "thread") and ((coroutine status of $) == "dead") \ No newline at end of file