aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2025-11-05 11:38:45 +0800
committerLi Jin <dragon-fly@qq.com>2025-11-05 11:38:45 +0800
commit36fc4fd1b262fd91226540bc79c833ef17a7425e (patch)
tree3da251b14017e45918e7133af1250342e8a6f62e
parent4e7cf4d863804303a931d6e16df7de6616337909 (diff)
downloadyuescript-36fc4fd1b262fd91226540bc79c833ef17a7425e.tar.gz
yuescript-36fc4fd1b262fd91226540bc79c833ef17a7425e.tar.bz2
yuescript-36fc4fd1b262fd91226540bc79c833ef17a7425e.zip
Updated spec.
-rw-r--r--CMakeLists.txt4
-rw-r--r--makefile2
-rw-r--r--spec/outputs/codes_from_doc.lua8
-rw-r--r--spec/outputs/codes_from_doc_zh.lua8
-rw-r--r--spec/outputs/unicode/funcs.lua2
-rw-r--r--spec/outputs/unicode/import.lua4
-rw-r--r--src/yuescript/yue_compiler.cpp6
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})
72 endif() 72 endif()
73endif() 73endif()
74 74
75if (APPLE)
76 add_compile_options(-Wno-deprecated-declarations)
77endif ()
78
79add_library(libyue MODULE 75add_library(libyue MODULE
80 src/yuescript/ast.cpp 76 src/yuescript/ast.cpp
81 src/yuescript/parser.cpp 77 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
11# Space-separated pkg-config libraries used by this project 11# Space-separated pkg-config libraries used by this project
12LIBS = 12LIBS =
13# General compiler flags 13# General compiler flags
14COMPILE_FLAGS = -std=c++17 -Wall -Wextra -Wno-deprecated-declarations -DYUE_UTF8_IMPL 14COMPILE_FLAGS = -std=c++17 -Wall -Wextra -DYUE_UTF8_IMPL
15# Additional release-specific flags 15# Additional release-specific flags
16RCOMPILE_FLAGS = -D NDEBUG -O3 16RCOMPILE_FLAGS = -D NDEBUG -O3
17# Additional debug-specific flags 17# 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({
73if (getmetatable(apple) ~= nil) then 73if (getmetatable(apple) ~= nil) then
74 p(apple.size, apple.color, getmetatable(apple).__index) 74 p(apple.size, apple.color, getmetatable(apple).__index)
75end 75end
76local _ud83c_udf1b = "月之脚本" 76local _u1f31b = "月之脚本"
77_module_0["🌛"] = _ud83c_udf1b 77_module_0["🌛"] = _u1f31b
78return _module_0 78return _module_0
79local area = 6.2831853071796 * 5 79local area = 6.2831853071796 * 5
80print('hello world') 80print('hello world')
@@ -2514,8 +2514,8 @@ local apple = setmetatable({
2514if (getmetatable(apple) ~= nil) then 2514if (getmetatable(apple) ~= nil) then
2515 p(apple.size, apple.color, getmetatable(apple).__index) 2515 p(apple.size, apple.color, getmetatable(apple).__index)
2516end 2516end
2517local _ud83c_udf1b = "月之脚本" 2517local _u1f31b = "月之脚本"
2518_module_0["🌛"] = _ud83c_udf1b 2518_module_0["🌛"] = _u1f31b
2519return _module_0 2519return _module_0
2520local area = 6.2831853071796 * 5 2520local area = 6.2831853071796 * 5
2521print('hello world') 2521print('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({
73if (getmetatable(apple) ~= nil) then 73if (getmetatable(apple) ~= nil) then
74 p(apple.size, apple.color, getmetatable(apple).__index) 74 p(apple.size, apple.color, getmetatable(apple).__index)
75end 75end
76local _ud83c_udf1b = "月之脚本" 76local _u1f31b = "月之脚本"
77_module_0["🌛"] = _ud83c_udf1b 77_module_0["🌛"] = _u1f31b
78return _module_0 78return _module_0
79local area = 6.2831853071796 * 5 79local area = 6.2831853071796 * 5
80print('你好 世界') 80print('你好 世界')
@@ -2508,8 +2508,8 @@ local apple = setmetatable({
2508if (getmetatable(apple) ~= nil) then 2508if (getmetatable(apple) ~= nil) then
2509 p(apple.size, apple.color, getmetatable(apple).__index) 2509 p(apple.size, apple.color, getmetatable(apple).__index)
2510end 2510end
2511local _ud83c_udf1b = "月之脚本" 2511local _u1f31b = "月之脚本"
2512_module_0["🌛"] = _ud83c_udf1b 2512_module_0["🌛"] = _u1f31b
2513return _module_0 2513return _module_0
2514local area = 6.2831853071796 * 5 2514local area = 6.2831853071796 * 5
2515print('你好 世界') 2515print('你好 世界')
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()
24end) 24end)
25local _u53d8_u91cfh 25local _u53d8_u91cfh
26_u53d8_u91cfh = function() 26_u53d8_u91cfh = function()
27 return _ud83d_udc4b 27 return _u1f44b
28end 28end
29_u5403(function() end, _u4e16_u754c); 29_u5403(function() end, _u4e16_u754c);
30(function() end)() 30(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"
11 return _fn_0(_base_0, ...) 11 return _fn_0(_base_0, ...)
12 end 12 end
13end)(), _u9053_u5177_u7ec4["字段z"] 13end)(), _u9053_u5177_u7ec4["字段z"]
14local _u9886_u4e3b, _ud83d_udc7b 14local _u9886_u4e3b, _u1f47b
15do 15do
16 local _obj_1 = _u627e_u5230("我的表") 16 local _obj_1 = _u627e_u5230("我的表")
17 _u9886_u4e3b, _ud83d_udc7b = _obj_1["领主"], (function() 17 _u9886_u4e3b, _u1f47b = _obj_1["领主"], (function()
18 local _base_0 = _obj_1 18 local _base_0 = _obj_1
19 local _fn_0 = _base_0["👻"] 19 local _fn_0 = _base_0["👻"]
20 return _fn_0 and function(...) 20 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:
1360 std::ostringstream buf; 1360 std::ostringstream buf;
1361 for (auto it = uname->m_begin.m_it; it != uname->m_end.m_it; ++it) { 1361 for (auto it = uname->m_begin.m_it; it != uname->m_end.m_it; ++it) {
1362 auto ch = *it; 1362 auto ch = *it;
1363 if (ch > 255) { 1363 if (ch <= 0x7F && ((ch == '_') || ((ch | 0x20) >= 'a' && (ch | 0x20) <= 'z') || (ch >= '0' && ch <= '9'))) {
1364 buf << "_u"sv << std::hex << static_cast<int>(ch);
1365 } else {
1366 buf << static_cast<char>(ch); 1364 buf << static_cast<char>(ch);
1365 } else {
1366 buf << "_u"sv << std::hex << static_cast<uint32_t>(ch);
1367 } 1367 }
1368 } 1368 }
1369 return buf.str(); 1369 return buf.str();