diff options
-rw-r--r-- | CHANGELOG.md | 77 | ||||
-rwxr-xr-x | doc/docs/doc/README.md | 28 |
2 files changed, 101 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index dedd8e7..6b44dae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md | |||
@@ -2,15 +2,84 @@ | |||
2 | 2 | ||
3 | The implementation for the original Moonscript language 0.5.0 can be found in the `0.5.0` branch of Yuescript. The Moonscript with fixes and new features is in the main branch of Yuescript. Here are the changelogs for each Yuescript version. | 3 | The implementation for the original Moonscript language 0.5.0 can be found in the `0.5.0` branch of Yuescript. The Moonscript with fixes and new features is in the main branch of Yuescript. Here are the changelogs for each Yuescript version. |
4 | 4 | ||
5 | ## v0.16.4 | ||
6 | |||
7 | ### Added Features | ||
8 | |||
9 | * Added -w option for Yuescript tool to recursively watch file changes under a target path and get codes recompiled. | ||
10 | |||
11 | * Added different metamethod name literals checking for different Lua target versions. | ||
12 | |||
13 | * Added checks for not using `break` statement in a for-loop scope. | ||
14 | |||
15 | * Added compiler option for preserving comments before statements. Using command line tool: | ||
16 | |||
17 | ```sh | ||
18 | yue -c file.yue | ||
19 | ``` | ||
20 | Using Lua lib: | ||
21 | ```lua | ||
22 | local yue = require("yue") | ||
23 | print yue.to_lua([[ | ||
24 | -- a comment | ||
25 | f = -> | ||
26 | ]], {reserve_comment = true}) | ||
27 | ``` | ||
28 | |||
29 | * Added `yue.check()` function to get compile errors in Lua table {{type, msg, line, col}}. | ||
30 | |||
31 | * Added support for extending script search paths using `yue.options.path`. | ||
32 | |||
33 | * Added new module export syntax for exporting items without creating local variables. | ||
34 | ```moonscript | ||
35 | export.<name> = "My module" | ||
36 | export.<call> = (...) -> -- ... | ||
37 | ``` | ||
38 | compiles to: | ||
39 | ```lua | ||
40 | local _module_0 = setmetatable({ }, { }) | ||
41 | getmetatable(_module_0).__name = "My module" | ||
42 | getmetatable(_module_0).__call = function(...) end | ||
43 | return _module_0 | ||
44 | ``` | ||
45 | |||
46 | ### Fixed Issues | ||
47 | |||
48 | * Reduced max parser call stack size. | ||
49 | |||
50 | * Refactored some syntax rules to speed up parsing. | ||
51 | |||
52 | * Fixed default value issue when doing metatable destructuring. | ||
53 | |||
54 | * Fixed a class syntax ambiguous issue when writting table block after a class declaration. | ||
55 | |||
56 | * Improve number literal syntax to support hexadecimal point values, positive decimal exponents and hexadecimal exponents. | ||
57 | |||
58 | * Prevented accessing scoped declared global variables multiple times when generating Lua codes. | ||
59 | |||
60 | * Fixed parser running exponentially slow issue when parsing nested expressions. | ||
61 | |||
62 | * Fixed exposing `yue` module as global variable by default. | ||
63 | |||
64 | * Fixed a stack overflow issue in `yue.to_ast()`. | ||
65 | |||
66 | * Fixed flatten level > 0 getting wrong AST issue in `yue.to_ast()` function. | ||
67 | |||
68 | * Fixed missing indent check for comments in the beginning of `in_block` syntax rule. | ||
69 | |||
70 | * Prevented `yue.loadfile()` throwing errors to match Lua `loadfile()` function behavior. | ||
71 | |||
72 | * Fixed `yue` module registering issue for Lua 5.1 and LuaJIT. | ||
73 | |||
5 | ## v0.15.12 | 74 | ## v0.15.12 |
6 | 75 | ||
7 | ### Added Features | 76 | ### Added Features |
8 | 77 | ||
9 | * yue.to_ast(): Reserve comment nodes followed by a statement in AST structures. | 78 | * yue.to_ast(): Reserve comment nodes followed by a statement in AST structures. |
10 | * Added `while` clause line decorator. | 79 | * Added `while` clause line decorator. |
11 | ```moonscript | 80 | ```moonscript |
12 | reader\parse_line! until reader\eof! | 81 | reader\parse_line! until reader\eof! |
13 | ``` | 82 | ``` |
14 | compiles to: | 83 | compiles to: |
15 | ```lua | 84 | ```lua |
16 | while not reader:eof() do | 85 | while not reader:eof() do |
@@ -19,7 +88,7 @@ The implementation for the original Moonscript language 0.5.0 can be found in th | |||
19 | ``` | 88 | ``` |
20 | * Supported underscores in number literal. `1_000_000`, `0xFF_EF_06` | 89 | * Supported underscores in number literal. `1_000_000`, `0xFF_EF_06` |
21 | * Refactored some error messages with details instead of just "syntax error". | 90 | * Refactored some error messages with details instead of just "syntax error". |
22 | * Added chaining assignment. `a = b = c = 0` | 91 | * Added chaining assignment. `a = b = c = 0` |
23 | 92 | ||
24 | ### Fixed Issues | 93 | ### Fixed Issues |
25 | 94 | ||
diff --git a/doc/docs/doc/README.md b/doc/docs/doc/README.md index 3c910fd..faafd0c 100755 --- a/doc/docs/doc/README.md +++ b/doc/docs/doc/README.md | |||
@@ -760,6 +760,34 @@ export class Something | |||
760 | </pre> | 760 | </pre> |
761 | </YueDisplay> | 761 | </YueDisplay> |
762 | 762 | ||
763 | Doing named export with destructuring. | ||
764 | |||
765 | ```moonscript | ||
766 | export :loadstring, to_lua: tolua = yue | ||
767 | export {itemA: {:fieldA = 'default'}} = tb | ||
768 | ``` | ||
769 | <YueDisplay> | ||
770 | <pre> | ||
771 | export :loadstring, to_lua: tolua = yue | ||
772 | export {itemA: {:fieldA = 'default'}} = tb | ||
773 | </pre> | ||
774 | </YueDisplay> | ||
775 | |||
776 | Export named items from module without creating local variables. | ||
777 | |||
778 | ```moonscript | ||
779 | export.itemA = tb | ||
780 | export.<index> = items | ||
781 | export["a-b-c"] = 123 | ||
782 | ``` | ||
783 | <YueDisplay> | ||
784 | <pre> | ||
785 | export.itemA = tb | ||
786 | export.<index> = items | ||
787 | export["a-b-c"] = 123 | ||
788 | </pre> | ||
789 | </YueDisplay> | ||
790 | |||
763 | * **Unnamed Export** | 791 | * **Unnamed Export** |
764 | Unnamed export will add the target item into the array part of the exported table. | 792 | Unnamed export will add the target item into the array part of the exported table. |
765 | 793 | ||