From 721946718de7bc4e90c94a7f44bf8e7d519a75e5 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Fri, 9 Oct 2020 15:58:35 +0800 Subject: update readme. --- CHANGELOG.md | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++------- README.md | 19 +++++++++--- 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 -## v0.4.7 +## v0.4.16 ### Fixed Issues +* 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. + * Remove support for escape new line symbol, binary operator expressions can now be written multiline without escape new line symbol. + * Fix an issue when extending class without name. + * Fix an issue when using return with export statement. + * Fix issues when declaring table key with Lua multiline string and indexing expressions with Lua multiline string. +* Make simple table and table block appear in the end of function arguments merged into one table. + + ```Moonscript + -- function arguments end with simple table followed by table block + another hello, one, + two, three, four, yeah: man + okay: yeah + fine: alright + ``` + + ```Lua + -- compiled in original Moonscript compiler + -- get two tables as arguments + another(hello, one, two, three, four, { + yeah = man + }, { + okay = yeah, + fine = alright + }) + -- compiled in fixed MoonPlus compiler + -- get one table as argument + another(hello, one, two, three, four, { + yeah = man, + okay = yeah, + fine = alright + }) + ``` + + + ### Added Features +* Add implicit objects support for table block syntax. + + ```Moonscript + inventory = + equipment: + * "sword" + * "shield" + items: + * name: "potion" + count: 10 + * name: "bread" + count: 3 + ``` + + Compiles to: + + ```Lua + local inventory = { + equipment = { + "sword", + "shield" + }, + items = { + { + name = "potion", + count = 10 + }, + { + name = "bread", + count = 3 + } + } + } + ``` + + + * Add support for local variable declared with attribute 'close' and 'const' for Lua 5.4. ```moonscript @@ -84,7 +156,7 @@ The implementation for original Moonscript language 0.5.0 can be found in the `0 * Add macro functions. ```Moonscript --- file 'macro.moon' +-- file 'macro.mp' export macro block config = (debugging = true)-> global debugMode = debugging == "true" "" @@ -97,7 +169,7 @@ export macro expr assert = (cond)-> $config! --- file 'main.moon' +-- file 'main.mp' import 'macro' as {:$config, :$assert, :$asserts} macro expr and = (...)-> "#{ table.concat {...}, ' and ' }" @@ -111,11 +183,11 @@ if $and f1!, f2!, f3! ``` Compiles to: ```Lua --- file 'macro.moon' +-- file 'macro.mp' local _module_0 = { } return _module_0 --- file 'main.moon' +-- file 'main.mp' assert(item ~= nil) local value = item if (f1() and f2() and f3()) then @@ -150,20 +222,20 @@ From original Moonscript compiler: * Move old `export` statement functions to `global` statement to match the `local` statement. * 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: ```Moonscript --- file 'Config.moon' +-- file 'Config.mp' export default {flag:1, value:"x"} --- file 'Utils.moon' +-- file 'Utils.mp' export map = (items, func)-> [func item for item in *items] export filter = (items, func)-> [item for item in *items when func item] --- file 'main.moon' +-- file 'main.mp' import 'Config' as {:flag, :value} import 'Utils' as {:map, :filter} ``` Compiles to: ```Lua --- file 'Config.moon' +-- file 'Config.mp' local _module_0 = nil _module_0 = { flag = 1, @@ -171,7 +243,7 @@ _module_0 = { } return _module_0 --- file 'Utils.moon' +-- file 'Utils.mp' local _module_0 = { } local map map = function(items, func) @@ -201,7 +273,7 @@ end _module_0["filter"] = filter return _module_0 --- file 'main.moon' +-- file 'main.mp' local flag, value do 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   Then require the module in Lua: ```Lua -require("moonp")("main") -- require `main.moon` +require("moonp")("main") -- require `main.mp` local moonp = require("moonp") local codes, err, globals = moonp.to_lua([[ @@ -59,7 +59,6 @@ f! - * **Binary Tool**   Clone this repo, then build and install executable with: @@ -91,14 +90,26 @@ Usage: moonp [options|files|directories] ... in a single line to start/stop multi-line mode ```   Use cases: -  Recursively compile every moon file under current path: `moonp .` +  Recursively compile every moon+ file with extension `.md` under current path: `moonp .`   Compile and save results to a target path: `moonp -t /target/path/ .`   Compile and reserve debug info: `moonp -l .`   Compile and generate minified codes: `moonp -m .`   Execute raw codes: `moonp -e 'print 123'` -  Execute a moon file: `moonp -e main.moon` +  Execute a moon+ file: `moonp -e main.mp` + + + +* **Docker Hub** + Try moonp in another easy way: https://hub.docker.com/r/moonplus/moonplus + + + +## Editor Support + +* [Vim](https://github.com/pigpigyyy/MoonPlus-vim) ## License + MIT -- cgit v1.2.3-55-g6feb