aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/inputs/backcall.moon46
-rw-r--r--spec/inputs/syntax.moon10
2 files changed, 56 insertions, 0 deletions
diff --git a/spec/inputs/backcall.moon b/spec/inputs/backcall.moon
new file mode 100644
index 0000000..407a5a7
--- /dev/null
+++ b/spec/inputs/backcall.moon
@@ -0,0 +1,46 @@
1
2{"abc", 123, 998} |> foreach print
3
4{1,2,3} \
5 |> map((x)-> x * 2) \
6 |> filter((x)-> x > 4) \
7 |> reduce(0, (a,b)-> a + b) \
8 |> print
9
10[i |> tostring for i = 0,10] |> table.concat(",") |> print
11
12b = 1 + 2 + (4 |> tostring |> print(1) or 123)
13
14if x = 233 |> math.max 998
15 print x
16
17998 |> func2 "abc", 233 |> func0 |> func1
18998 |> func0("abc", 233) |> func1 |> func2
19
20do
21 (data) <- http?.get "ajaxtest"
22 body[".result"]\html data
23 (processed) <- http.get "ajaxprocess", data
24 body[".result"]\append processed
25 <- setTimeout 1000
26 print "done"
27
28do
29 <- syncStatus
30 (err,data="nil") <- loadAsync "file.moon"
31 print err if err
32 (codes) <- compileAsync data
33 func = loadstring codes
34 func!
35
36do
37 <- f1
38 <- f2
39 do
40 <- f3
41 <- f4
42 <- f5
43 <- f6
44 f7!
45
46alert "hi"
diff --git a/spec/inputs/syntax.moon b/spec/inputs/syntax.moon
index bf0cf04..3ac9991 100644
--- a/spec/inputs/syntax.moon
+++ b/spec/inputs/syntax.moon
@@ -270,3 +270,13 @@ z = a- b
270 270
271 271
272-- cooool 272-- cooool
273
274str = --[[
275This is a multi line comment.
276It's OK.
277]] strA \ -- comment 1
278 .. strB \ -- comment 2
279 .. strC
280
281func --[[port]] 3000, --[[ip]] "192.168.1.1"
282