diff options
author | Li Jin <dragon-fly@qq.com> | 2020-01-28 00:41:53 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2020-01-28 01:10:31 +0800 |
commit | fb47c11bd942c83317f1f9a2e255535649401cbf (patch) | |
tree | 3fb35b9b23911a37c4e4499cf650792ba2b8b21c /README.md | |
parent | 27717564cb1ab72c88c10a8392b6795ddea7a0ef (diff) | |
download | yuescript-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.md | 57 |
1 files changed, 57 insertions, 0 deletions
@@ -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 | ||
18 | str = --[[ | ||
19 | This is a multi line comment. | ||
20 | It's OK. | ||
21 | ]] strA \ -- comment 1 | ||
22 | .. strB \ -- comment 2 | ||
23 | .. strC | ||
24 | |||
25 | func --[[ip]] "192.168.126.110", --[[port]] 3000 | ||
26 | ``` | ||
27 |   to: | ||
28 | ```Lua | ||
29 | local str = strA .. strB .. strC | ||
30 | func("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 | |||
40 | |||
41 | do | ||
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 |   compiles to: | ||
49 | ```Lua | ||
50 | print(reduce(filter(map({ | ||
51 | 1, | ||
52 | 2, | ||
53 | 3 | ||
54 | }, function(x) | ||
55 | return x * 2 | ||
56 | end), function(x) | ||
57 | return x > 4 | ||
58 | end), 0, function(a, b) | ||
59 | return a + b | ||
60 | end)) | ||
61 | do | ||
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) | ||
69 | end | ||
70 | ``` | ||
71 | |||
15 | * Add existential operator support. Generate codes from: | 72 | * Add existential operator support. Generate codes from: |
16 | ```Moonscript | 73 | ```Moonscript |
17 | func?! | 74 | func?! |