aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2020-01-28 00:41:53 +0800
committerLi Jin <dragon-fly@qq.com>2020-01-28 01:10:31 +0800
commitfb47c11bd942c83317f1f9a2e255535649401cbf (patch)
tree3fb35b9b23911a37c4e4499cf650792ba2b8b21c /README.md
parent27717564cb1ab72c88c10a8392b6795ddea7a0ef (diff)
downloadyuescript-fb47c11bd942c83317f1f9a2e255535649401cbf.tar.gz
yuescript-fb47c11bd942c83317f1f9a2e255535649401cbf.tar.bz2
yuescript-fb47c11bd942c83317f1f9a2e255535649401cbf.zip
Add multi-line comment support. Add escape new line symbol. Add back call syntax.
Diffstat (limited to 'README.md')
-rw-r--r--README.md57
1 files changed, 57 insertions, 0 deletions
diff --git a/README.md b/README.md
index 7786bc7..968cc99 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,63 @@ MoonPlus is a compiler with features from Moonscript language 0.5.0 and could be
12 12
13## Changes 13## Changes
14 14
15* Add multi-line comment support.
16* Add usage for symbol `\` to escape new line. Will compile codes:
17```Moonscript
18str = --[[
19 This is a multi line comment.
20 It's OK.
21]] strA \ -- comment 1
22 .. strB \ -- comment 2
23 .. strC
24
25func --[[ip]] "192.168.126.110", --[[port]] 3000
26```
27&emsp;&emsp;to:
28```Lua
29local str = strA .. strB .. strC
30func("192.168.126.110", 3000)
31```
32
33* Add back call features support with new operator and syntax. For example:
34```Moonscript
35{1,2,3} \
36 |> map((x)-> x * 2) \
37 |> filter((x)-> x > 4) \
38 |> reduce(0, (a,b)-> a + b) \
39 |> print
40
41do
42 (data) <- http.get "ajaxtest"
43 body[".result"]\html data
44 (processed) <- http.get "ajaxprocess", data
45 body[".result"]\append processed
46 print "done"
47```
48&emsp;&emsp;compiles to:
49```Lua
50print(reduce(filter(map({
51 1,
52 2,
53 3
54}, function(x)
55 return x * 2
56end), function(x)
57 return x > 4
58end), 0, function(a, b)
59 return a + b
60end))
61do
62 http.get("ajaxtest", function(data)
63 body[".result"]:html(data)
64 return http.get("ajaxprocess", data, function(processed)
65 body[".result"]:append(processed)
66 return print("done")
67 end)
68 end)
69end
70```
71
15* Add existential operator support. Generate codes from: 72* Add existential operator support. Generate codes from:
16```Moonscript 73```Moonscript
17func?! 74func?!