From 36fc4fd1b262fd91226540bc79c833ef17a7425e Mon Sep 17 00:00:00 2001 From: Li Jin Date: Wed, 5 Nov 2025 11:38:45 +0800 Subject: Updated spec. --- CMakeLists.txt | 4 ---- makefile | 2 +- spec/outputs/codes_from_doc.lua | 8 ++++---- spec/outputs/codes_from_doc_zh.lua | 8 ++++---- spec/outputs/unicode/funcs.lua | 2 +- spec/outputs/unicode/import.lua | 4 ++-- src/yuescript/yue_compiler.cpp | 6 +++--- 7 files changed, 15 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ebdee07..5c03f23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,10 +72,6 @@ if (DEFINED ENV{ANDROID_ROOT}) endif() endif() -if (APPLE) - add_compile_options(-Wno-deprecated-declarations) -endif () - add_library(libyue MODULE src/yuescript/ast.cpp src/yuescript/parser.cpp diff --git a/makefile b/makefile index 7e183d1..7ca8c6c 100644 --- a/makefile +++ b/makefile @@ -11,7 +11,7 @@ SRC_PATH = ./src # Space-separated pkg-config libraries used by this project LIBS = # General compiler flags -COMPILE_FLAGS = -std=c++17 -Wall -Wextra -Wno-deprecated-declarations -DYUE_UTF8_IMPL +COMPILE_FLAGS = -std=c++17 -Wall -Wextra -DYUE_UTF8_IMPL # Additional release-specific flags RCOMPILE_FLAGS = -D NDEBUG -O3 # Additional debug-specific flags diff --git a/spec/outputs/codes_from_doc.lua b/spec/outputs/codes_from_doc.lua index b25753d..3971bb7 100644 --- a/spec/outputs/codes_from_doc.lua +++ b/spec/outputs/codes_from_doc.lua @@ -73,8 +73,8 @@ local apple = setmetatable({ if (getmetatable(apple) ~= nil) then p(apple.size, apple.color, getmetatable(apple).__index) end -local _ud83c_udf1b = "ๆœˆไน‹่„šๆœฌ" -_module_0["๐ŸŒ›"] = _ud83c_udf1b +local _u1f31b = "ๆœˆไน‹่„šๆœฌ" +_module_0["๐ŸŒ›"] = _u1f31b return _module_0 local area = 6.2831853071796 * 5 print('hello world') @@ -2514,8 +2514,8 @@ local apple = setmetatable({ if (getmetatable(apple) ~= nil) then p(apple.size, apple.color, getmetatable(apple).__index) end -local _ud83c_udf1b = "ๆœˆไน‹่„šๆœฌ" -_module_0["๐ŸŒ›"] = _ud83c_udf1b +local _u1f31b = "ๆœˆไน‹่„šๆœฌ" +_module_0["๐ŸŒ›"] = _u1f31b return _module_0 local area = 6.2831853071796 * 5 print('hello world') diff --git a/spec/outputs/codes_from_doc_zh.lua b/spec/outputs/codes_from_doc_zh.lua index e70c20c..403ad3e 100644 --- a/spec/outputs/codes_from_doc_zh.lua +++ b/spec/outputs/codes_from_doc_zh.lua @@ -73,8 +73,8 @@ local apple = setmetatable({ if (getmetatable(apple) ~= nil) then p(apple.size, apple.color, getmetatable(apple).__index) end -local _ud83c_udf1b = "ๆœˆไน‹่„šๆœฌ" -_module_0["๐ŸŒ›"] = _ud83c_udf1b +local _u1f31b = "ๆœˆไน‹่„šๆœฌ" +_module_0["๐ŸŒ›"] = _u1f31b return _module_0 local area = 6.2831853071796 * 5 print('ไฝ ๅฅฝ ไธ–็•Œ') @@ -2508,8 +2508,8 @@ local apple = setmetatable({ if (getmetatable(apple) ~= nil) then p(apple.size, apple.color, getmetatable(apple).__index) end -local _ud83c_udf1b = "ๆœˆไน‹่„šๆœฌ" -_module_0["๐ŸŒ›"] = _ud83c_udf1b +local _u1f31b = "ๆœˆไน‹่„šๆœฌ" +_module_0["๐ŸŒ›"] = _u1f31b return _module_0 local area = 6.2831853071796 * 5 print('ไฝ ๅฅฝ ไธ–็•Œ') diff --git a/spec/outputs/unicode/funcs.lua b/spec/outputs/unicode/funcs.lua index 6e94587..06b24b1 100644 --- a/spec/outputs/unicode/funcs.lua +++ b/spec/outputs/unicode/funcs.lua @@ -24,7 +24,7 @@ _u5f00(function() end) local _u53d8_u91cfh _u53d8_u91cfh = function() - return _ud83d_udc4b + return _u1f44b end _u5403(function() end, _u4e16_u754c); (function() end)() diff --git a/spec/outputs/unicode/import.lua b/spec/outputs/unicode/import.lua index 7c31ceb..e055c81 100644 --- a/spec/outputs/unicode/import.lua +++ b/spec/outputs/unicode/import.lua @@ -11,10 +11,10 @@ local _u5b57_u6bb5x, _u5b57_u6bb5y, _u5b57_u6bb5z = _u9053_u5177_u7ec4["ๅญ—ๆฎตx" return _fn_0(_base_0, ...) end end)(), _u9053_u5177_u7ec4["ๅญ—ๆฎตz"] -local _u9886_u4e3b, _ud83d_udc7b +local _u9886_u4e3b, _u1f47b do local _obj_1 = _u627e_u5230("ๆˆ‘็š„่กจ") - _u9886_u4e3b, _ud83d_udc7b = _obj_1["้ข†ไธป"], (function() + _u9886_u4e3b, _u1f47b = _obj_1["้ข†ไธป"], (function() local _base_0 = _obj_1 local _fn_0 = _base_0["๐Ÿ‘ป"] return _fn_0 and function(...) diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index 4dd3583..75f4787 100644 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp @@ -1360,10 +1360,10 @@ private: std::ostringstream buf; for (auto it = uname->m_begin.m_it; it != uname->m_end.m_it; ++it) { auto ch = *it; - if (ch > 255) { - buf << "_u"sv << std::hex << static_cast(ch); - } else { + if (ch <= 0x7F && ((ch == '_') || ((ch | 0x20) >= 'a' && (ch | 0x20) <= 'z') || (ch >= '0' && ch <= '9'))) { buf << static_cast(ch); + } else { + buf << "_u"sv << std::hex << static_cast(ch); } } return buf.str(); -- cgit v1.2.3-55-g6feb