aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2020-10-09 15:58:35 +0800
committerLi Jin <dragon-fly@qq.com>2020-10-09 15:58:35 +0800
commit721946718de7bc4e90c94a7f44bf8e7d519a75e5 (patch)
tree65ab681a7d486293aba7afbfa2f59718d8506598
parent97bbe98289fb74c7cf2d9793b80a1a27b4146045 (diff)
downloadyuescript-721946718de7bc4e90c94a7f44bf8e7d519a75e5.tar.gz
yuescript-721946718de7bc4e90c94a7f44bf8e7d519a75e5.tar.bz2
yuescript-721946718de7bc4e90c94a7f44bf8e7d519a75e5.zip
update readme.
-rw-r--r--CHANGELOG.md94
-rw-r--r--README.md19
2 files changed, 98 insertions, 15 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 698921f..85b5d06 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,17 +4,89 @@ The implementation for original Moonscript language 0.5.0 can be found in the `0
4 4
5 5
6 6
7## v0.4.7 7## v0.4.16
8 8
9### Fixed Issues 9### Fixed Issues
10 10
11* Change MoonPlus file extension to '.mp' because some of the Moonscript syntax are no longer supported and some codes written in MoonPlus syntax won't be accepted by Moonscript compiler.
12
11* Remove support for escape new line symbol, binary operator expressions can now be written multiline without escape new line symbol. 13* Remove support for escape new line symbol, binary operator expressions can now be written multiline without escape new line symbol.
14
12* Fix an issue when extending class without name. 15* Fix an issue when extending class without name.
16
13* Fix an issue when using return with export statement. 17* Fix an issue when using return with export statement.
18
14* Fix issues when declaring table key with Lua multiline string and indexing expressions with Lua multiline string. 19* Fix issues when declaring table key with Lua multiline string and indexing expressions with Lua multiline string.
15 20
21* Make simple table and table block appear in the end of function arguments merged into one table.
22
23 ```Moonscript
24 -- function arguments end with simple table followed by table block
25 another hello, one,
26 two, three, four, yeah: man
27 okay: yeah
28 fine: alright
29 ```
30
31 ```Lua
32 -- compiled in original Moonscript compiler
33 -- get two tables as arguments
34 another(hello, one, two, three, four, {
35 yeah = man
36 }, {
37 okay = yeah,
38 fine = alright
39 })
40 -- compiled in fixed MoonPlus compiler
41 -- get one table as argument
42 another(hello, one, two, three, four, {
43 yeah = man,
44 okay = yeah,
45 fine = alright
46 })
47 ```
48
49
50
16### Added Features 51### Added Features
17 52
53* Add implicit objects support for table block syntax.
54
55 ```Moonscript
56 inventory =
57 equipment:
58 * "sword"
59 * "shield"
60 items:
61 * name: "potion"
62 count: 10
63 * name: "bread"
64 count: 3
65 ```
66
67 Compiles to:
68
69 ```Lua
70 local inventory = {
71 equipment = {
72 "sword",
73 "shield"
74 },
75 items = {
76 {
77 name = "potion",
78 count = 10
79 },
80 {
81 name = "bread",
82 count = 3
83 }
84 }
85 }
86 ```
87
88
89
18* Add support for local variable declared with attribute 'close' and 'const' for Lua 5.4. 90* Add support for local variable declared with attribute 'close' and 'const' for Lua 5.4.
19 91
20 ```moonscript 92 ```moonscript
@@ -84,7 +156,7 @@ The implementation for original Moonscript language 0.5.0 can be found in the `0
84 156
85* Add macro functions. 157* Add macro functions.
86```Moonscript 158```Moonscript
87-- file 'macro.moon' 159-- file 'macro.mp'
88export macro block config = (debugging = true)-> 160export macro block config = (debugging = true)->
89 global debugMode = debugging == "true" 161 global debugMode = debugging == "true"
90 "" 162 ""
@@ -97,7 +169,7 @@ export macro expr assert = (cond)->
97 169
98$config! 170$config!
99 171
100-- file 'main.moon' 172-- file 'main.mp'
101import 'macro' as {:$config, :$assert, :$asserts} 173import 'macro' as {:$config, :$assert, :$asserts}
102 174
103macro expr and = (...)-> "#{ table.concat {...}, ' and ' }" 175macro expr and = (...)-> "#{ table.concat {...}, ' and ' }"
@@ -111,11 +183,11 @@ if $and f1!, f2!, f3!
111``` 183```
112 Compiles to: 184 Compiles to:
113```Lua 185```Lua
114-- file 'macro.moon' 186-- file 'macro.mp'
115local _module_0 = { } 187local _module_0 = { }
116return _module_0 188return _module_0
117 189
118-- file 'main.moon' 190-- file 'main.mp'
119assert(item ~= nil) 191assert(item ~= nil)
120local value = item 192local value = item
121if (f1() and f2() and f3()) then 193if (f1() and f2() and f3()) then
@@ -150,20 +222,20 @@ From original Moonscript compiler:
150* Move old `export` statement functions to `global` statement to match the `local` statement. 222* Move old `export` statement functions to `global` statement to match the `local` statement.
151* Change `export` statement behavier to support module management. Moon codes with `export` statement can not explicit return values in root scope. And codes with `export default` can export only one value as the module content. Use cases: 223* Change `export` statement behavier to support module management. Moon codes with `export` statement can not explicit return values in root scope. And codes with `export default` can export only one value as the module content. Use cases:
152```Moonscript 224```Moonscript
153-- file 'Config.moon' 225-- file 'Config.mp'
154export default {flag:1, value:"x"} 226export default {flag:1, value:"x"}
155 227
156-- file 'Utils.moon' 228-- file 'Utils.mp'
157export map = (items, func)-> [func item for item in *items] 229export map = (items, func)-> [func item for item in *items]
158export filter = (items, func)-> [item for item in *items when func item] 230export filter = (items, func)-> [item for item in *items when func item]
159 231
160-- file 'main.moon' 232-- file 'main.mp'
161import 'Config' as {:flag, :value} 233import 'Config' as {:flag, :value}
162import 'Utils' as {:map, :filter} 234import 'Utils' as {:map, :filter}
163``` 235```
164Compiles to: 236Compiles to:
165```Lua 237```Lua
166-- file 'Config.moon' 238-- file 'Config.mp'
167local _module_0 = nil 239local _module_0 = nil
168_module_0 = { 240_module_0 = {
169 flag = 1, 241 flag = 1,
@@ -171,7 +243,7 @@ _module_0 = {
171} 243}
172return _module_0 244return _module_0
173 245
174-- file 'Utils.moon' 246-- file 'Utils.mp'
175local _module_0 = { } 247local _module_0 = { }
176local map 248local map
177map = function(items, func) 249map = function(items, func)
@@ -201,7 +273,7 @@ end
201_module_0["filter"] = filter 273_module_0["filter"] = filter
202return _module_0 274return _module_0
203 275
204-- file 'main.moon' 276-- file 'main.mp'
205local flag, value 277local flag, value
206do 278do
207 local _obj_0 = require('Config') 279 local _obj_0 = require('Config')
diff --git a/README.md b/README.md
index 4275320..88ac995 100644
--- a/README.md
+++ b/README.md
@@ -43,7 +43,7 @@ So MoonPlus is a new code base for pushing the language to go forward and being
43&emsp;&emsp;Then require the module in Lua: 43&emsp;&emsp;Then require the module in Lua:
44 44
45```Lua 45```Lua
46require("moonp")("main") -- require `main.moon` 46require("moonp")("main") -- require `main.mp`
47 47
48local moonp = require("moonp") 48local moonp = require("moonp")
49local codes, err, globals = moonp.to_lua([[ 49local codes, err, globals = moonp.to_lua([[
@@ -59,7 +59,6 @@ f!
59 59
60 60
61 61
62
63* **Binary Tool** 62* **Binary Tool**
64 63
65&emsp;&emsp;Clone this repo, then build and install executable with: 64&emsp;&emsp;Clone this repo, then build and install executable with:
@@ -91,14 +90,26 @@ Usage: moonp [options|files|directories] ...
91 in a single line to start/stop multi-line mode 90 in a single line to start/stop multi-line mode
92``` 91```
93&emsp;&emsp;Use cases: 92&emsp;&emsp;Use cases:
94&emsp;&emsp;Recursively compile every moon file under current path: `moonp .` 93&emsp;&emsp;Recursively compile every moon+ file with extension `.md` under current path: `moonp .`
95&emsp;&emsp;Compile and save results to a target path: `moonp -t /target/path/ .` 94&emsp;&emsp;Compile and save results to a target path: `moonp -t /target/path/ .`
96&emsp;&emsp;Compile and reserve debug info: `moonp -l .` 95&emsp;&emsp;Compile and reserve debug info: `moonp -l .`
97&emsp;&emsp;Compile and generate minified codes: `moonp -m .` 96&emsp;&emsp;Compile and generate minified codes: `moonp -m .`
98&emsp;&emsp;Execute raw codes: `moonp -e 'print 123'` 97&emsp;&emsp;Execute raw codes: `moonp -e 'print 123'`
99&emsp;&emsp;Execute a moon file: `moonp -e main.moon` 98&emsp;&emsp;Execute a moon+ file: `moonp -e main.mp`
99
100
101
102* **Docker Hub**
103 Try moonp in another easy way: https://hub.docker.com/r/moonplus/moonplus
104
105
106
107## Editor Support
108
109* [Vim](https://github.com/pigpigyyy/MoonPlus-vim)
100 110
101 111
102 112
103## License 113## License
114
104MIT 115MIT