aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md13
-rwxr-xr-xdoc/docs/doc/README.md24
-rw-r--r--src/yuescript/yue_compiler.cpp2
3 files changed, 37 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 95ae614..0cd6dc7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,19 @@
2 2
3The 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. 3The 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.18.1
6
7### Added Features
8
9* Implemented '...' for variable declaration within scope using anonymous functions.
10 ```moonscript
11 ok, ... = fn!
12 if ok
13 print select '#', ...
14 print select 1, ...
15 ```
16* Added close-variables support for Lua version targets below 5.4.
17
5## v0.17.10 18## v0.17.10
6 19
7### Added Features 20### Added Features
diff --git a/doc/docs/doc/README.md b/doc/docs/doc/README.md
index 4c8ac87..7e4aa22 100755
--- a/doc/docs/doc/README.md
+++ b/doc/docs/doc/README.md
@@ -1181,6 +1181,28 @@ print "OK"
1181</pre> 1181</pre>
1182</YueDisplay> 1182</YueDisplay>
1183 1183
1184## Varargs Assignment
1185
1186You can assign the results returned from a function to a varargs symbol `...`. And then access its content using the Lua way.
1187```moonscript
1188list = {1, 2, 3, 4, 5}
1189fn = (ok) -> ok, table.unpack list
1190ok, ... = fn true
1191count = select '#', ...
1192first = select 1, ...
1193print ok, count, first
1194```
1195<YueDisplay>
1196<pre>
1197list = {1, 2, 3, 4, 5}
1198fn = (ok) -> ok, table.unpack list
1199ok, ... = fn true
1200count = select '#', ...
1201first = select 1, ...
1202print ok, count, first
1203</pre>
1204</YueDisplay>
1205
1184## Whitespace 1206## Whitespace
1185 1207
1186Yuescript is a whitespace significant language. You have to write some code block in the same indent with space **' '** or tab **'\t'** like function body, value list and some control blocks. And expressions containing different whitespaces might mean different things. Tab is treated like 4 space, but it's better not mix the use of spaces and tabs. 1208Yuescript is a whitespace significant language. You have to write some code block in the same indent with space **' '** or tab **'\t'** like function body, value list and some control blocks. And expressions containing different whitespaces might mean different things. Tab is treated like 4 space, but it's better not mix the use of spaces and tabs.
@@ -1299,7 +1321,7 @@ catch err
1299 1321
1300## Attributes 1322## Attributes
1301 1323
1302Syntax support for Lua 5.4 attributes. But you can still use `const` declaration and get constant check working when targeting Lua versions below 5.4. 1324Syntax support for Lua 5.4 attributes. And you can still use both the `const` and `close` declaration and get constant check and scoped callback working when targeting Lua versions below 5.4.
1303 1325
1304```moonscript 1326```moonscript
1305const a = 123 1327const a = 123
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp
index 6644ca5..ab35364 100644
--- a/src/yuescript/yue_compiler.cpp
+++ b/src/yuescript/yue_compiler.cpp
@@ -74,7 +74,7 @@ static std::unordered_set<std::string> Metamethods = {
74 "close"s // Lua 5.4 74 "close"s // Lua 5.4
75}; 75};
76 76
77const std::string_view version = "0.18.0"sv; 77const std::string_view version = "0.18.1"sv;
78const std::string_view extension = "yue"sv; 78const std::string_view extension = "yue"sv;
79 79
80class CompileError : public std::logic_error { 80class CompileError : public std::logic_error {