diff options
author | Li Jin <dragon-fly@qq.com> | 2023-07-25 16:18:54 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2023-07-25 16:18:54 +0800 |
commit | cbcbefaa218a02389b6385ab83c501cd3d03bde8 (patch) | |
tree | ca386b104dffd4d90bb672a367466ac624bd1e7c | |
parent | d4e9f31b1568ed3ae65bcd3889f6cd34334bc367 (diff) | |
download | yuescript-0.17.10.tar.gz yuescript-0.17.10.tar.bz2 yuescript-0.17.10.zip |
added a missing Yuescript code formating case.v0.17.10
-rw-r--r-- | CHANGELOG.md | 10 | ||||
-rw-r--r-- | src/yuescript/yue_ast.cpp | 10 | ||||
-rw-r--r-- | src/yuescript/yue_compiler.cpp | 2 |
3 files changed, 13 insertions, 9 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ac9811..95ae614 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md | |||
@@ -2,7 +2,7 @@ | |||
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.17.0 | 5 | ## v0.17.10 |
6 | 6 | ||
7 | ### Added Features | 7 | ### Added Features |
8 | 8 | ||
@@ -14,13 +14,21 @@ The implementation for the original Moonscript language 0.5.0 can be found in th | |||
14 | 14 | ||
15 | switch a when not in [1, 10] | 15 | switch a when not in [1, 10] |
16 | print "not (1 <= a <= 10)" | 16 | print "not (1 <= a <= 10)" |
17 | |||
18 | if item in list | ||
19 | print "item existed in a list" | ||
17 | ``` | 20 | ``` |
18 | * Added metamethod name checking for chain expression. | 21 | * Added metamethod name checking for chain expression. |
22 | * Added feature to reformat the expressions passed as macro function arguments to the formated code strings. | ||
23 | * Added -r option to rewrite compiled Lua code output to match original Yuescript code line numbers. | ||
19 | 24 | ||
20 | ### Fixed Issues | 25 | ### Fixed Issues |
21 | 26 | ||
22 | * Fixed a LuaJIT module loading issue. | 27 | * Fixed a LuaJIT module loading issue. |
23 | * Fixed built-in $FILE macro does not escape backslash on Windows. | 28 | * Fixed built-in $FILE macro does not escape backslash on Windows. |
29 | * Fixed more ambiguous Lua codes generation cases. | ||
30 | * Fixed syntax error should throw for invalid interpolation. | ||
31 | * Fixed an AST object life expired before accessing issue. | ||
24 | 32 | ||
25 | ## v0.16.4 | 33 | ## v0.16.4 |
26 | 34 | ||
diff --git a/src/yuescript/yue_ast.cpp b/src/yuescript/yue_ast.cpp index f243d24..fee15af 100644 --- a/src/yuescript/yue_ast.cpp +++ b/src/yuescript/yue_ast.cpp | |||
@@ -1156,21 +1156,17 @@ std::string UnaryExp_t::to_string(void* ud) const { | |||
1156 | } | 1156 | } |
1157 | std::string InRange_t::to_string(void* ud) const { | 1157 | std::string InRange_t::to_string(void* ud) const { |
1158 | auto valueStr = openValue->to_string(ud); | 1158 | auto valueStr = openValue->to_string(ud); |
1159 | return "in "s + (open.is<InRangeOpen_t>() ? "("s : "["s + (valueStr[0] == '[' ? " "s : ""s)) + valueStr + ", "s + closeValue->to_string(ud) + (close.is<InRangeOpen_t>() ? ')' : ']'); | 1159 | return (open.is<InRangeOpen_t>() ? "("s : "["s + (valueStr[0] == '[' ? " "s : ""s)) + valueStr + ", "s + closeValue->to_string(ud) + (close.is<InRangeOpen_t>() ? ')' : ']'); |
1160 | } | 1160 | } |
1161 | std::string InDiscrete_t::to_string(void* ud) const { | 1161 | std::string InDiscrete_t::to_string(void* ud) const { |
1162 | str_list temp; | 1162 | str_list temp; |
1163 | for (auto value : values.objects()) { | 1163 | for (auto value : values.objects()) { |
1164 | temp.emplace_back(value->to_string(ud)); | 1164 | temp.emplace_back(value->to_string(ud)); |
1165 | } | 1165 | } |
1166 | return "in "s + '{' + join(temp, ", "sv) + '}'; | 1166 | return '{' + join(temp, ", "sv) + '}'; |
1167 | } | 1167 | } |
1168 | std::string In_t::to_string(void* ud) const { | 1168 | std::string In_t::to_string(void* ud) const { |
1169 | if (not_) { | 1169 | return (not_ ? "not "s : ""s) + "in "s + item->to_string(ud); |
1170 | return "not "s + item->to_string(ud); | ||
1171 | } else { | ||
1172 | return item->to_string(ud); | ||
1173 | } | ||
1174 | } | 1170 | } |
1175 | std::string ExpListAssign_t::to_string(void* ud) const { | 1171 | std::string ExpListAssign_t::to_string(void* ud) const { |
1176 | if (action) { | 1172 | if (action) { |
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index f4e1102..0b9889d 100644 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp | |||
@@ -72,7 +72,7 @@ static std::unordered_set<std::string> Metamethods = { | |||
72 | "close"s // Lua 5.4 | 72 | "close"s // Lua 5.4 |
73 | }; | 73 | }; |
74 | 74 | ||
75 | const std::string_view version = "0.17.9"sv; | 75 | const std::string_view version = "0.17.10"sv; |
76 | const std::string_view extension = "yue"sv; | 76 | const std::string_view extension = "yue"sv; |
77 | 77 | ||
78 | class CompileError : public std::logic_error { | 78 | class CompileError : public std::logic_error { |