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 /src | |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/yuescript/yue_ast.cpp | 10 | ||||
-rw-r--r-- | src/yuescript/yue_compiler.cpp | 2 |
2 files changed, 4 insertions, 8 deletions
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 { |