From cbcbefaa218a02389b6385ab83c501cd3d03bde8 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Tue, 25 Jul 2023 16:18:54 +0800 Subject: added a missing Yuescript code formating case. --- src/yuescript/yue_ast.cpp | 10 +++------- src/yuescript/yue_compiler.cpp | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'src') 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 { } std::string InRange_t::to_string(void* ud) const { auto valueStr = openValue->to_string(ud); - return "in "s + (open.is() ? "("s : "["s + (valueStr[0] == '[' ? " "s : ""s)) + valueStr + ", "s + closeValue->to_string(ud) + (close.is() ? ')' : ']'); + return (open.is() ? "("s : "["s + (valueStr[0] == '[' ? " "s : ""s)) + valueStr + ", "s + closeValue->to_string(ud) + (close.is() ? ')' : ']'); } std::string InDiscrete_t::to_string(void* ud) const { str_list temp; for (auto value : values.objects()) { temp.emplace_back(value->to_string(ud)); } - return "in "s + '{' + join(temp, ", "sv) + '}'; + return '{' + join(temp, ", "sv) + '}'; } std::string In_t::to_string(void* ud) const { - if (not_) { - return "not "s + item->to_string(ud); - } else { - return item->to_string(ud); - } + return (not_ ? "not "s : ""s) + "in "s + item->to_string(ud); } std::string ExpListAssign_t::to_string(void* ud) const { 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 Metamethods = { "close"s // Lua 5.4 }; -const std::string_view version = "0.17.9"sv; +const std::string_view version = "0.17.10"sv; const std::string_view extension = "yue"sv; class CompileError : public std::logic_error { -- cgit v1.2.3-55-g6feb