diff options
| author | Li Jin <dragon-fly@qq.com> | 2025-11-05 11:38:45 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2025-11-05 11:38:45 +0800 |
| commit | 36fc4fd1b262fd91226540bc79c833ef17a7425e (patch) | |
| tree | 3da251b14017e45918e7133af1250342e8a6f62e | |
| parent | 4e7cf4d863804303a931d6e16df7de6616337909 (diff) | |
| download | yuescript-36fc4fd1b262fd91226540bc79c833ef17a7425e.tar.gz yuescript-36fc4fd1b262fd91226540bc79c833ef17a7425e.tar.bz2 yuescript-36fc4fd1b262fd91226540bc79c833ef17a7425e.zip | |
Updated spec.
| -rw-r--r-- | CMakeLists.txt | 4 | ||||
| -rw-r--r-- | makefile | 2 | ||||
| -rw-r--r-- | spec/outputs/codes_from_doc.lua | 8 | ||||
| -rw-r--r-- | spec/outputs/codes_from_doc_zh.lua | 8 | ||||
| -rw-r--r-- | spec/outputs/unicode/funcs.lua | 2 | ||||
| -rw-r--r-- | spec/outputs/unicode/import.lua | 4 | ||||
| -rw-r--r-- | 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}) | |||
| 72 | endif() | 72 | endif() |
| 73 | endif() | 73 | endif() |
| 74 | 74 | ||
| 75 | if (APPLE) | ||
| 76 | add_compile_options(-Wno-deprecated-declarations) | ||
| 77 | endif () | ||
| 78 | |||
| 79 | add_library(libyue MODULE | 75 | add_library(libyue MODULE |
| 80 | src/yuescript/ast.cpp | 76 | src/yuescript/ast.cpp |
| 81 | src/yuescript/parser.cpp | 77 | src/yuescript/parser.cpp |
| @@ -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 |
| 12 | LIBS = | 12 | LIBS = |
| 13 | # General compiler flags | 13 | # General compiler flags |
| 14 | COMPILE_FLAGS = -std=c++17 -Wall -Wextra -Wno-deprecated-declarations -DYUE_UTF8_IMPL | 14 | COMPILE_FLAGS = -std=c++17 -Wall -Wextra -DYUE_UTF8_IMPL |
| 15 | # Additional release-specific flags | 15 | # Additional release-specific flags |
| 16 | RCOMPILE_FLAGS = -D NDEBUG -O3 | 16 | RCOMPILE_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({ | |||
| 73 | if (getmetatable(apple) ~= nil) then | 73 | if (getmetatable(apple) ~= nil) then |
| 74 | p(apple.size, apple.color, getmetatable(apple).__index) | 74 | p(apple.size, apple.color, getmetatable(apple).__index) |
| 75 | end | 75 | end |
| 76 | local _ud83c_udf1b = "月之脚本" | 76 | local _u1f31b = "月之脚本" |
| 77 | _module_0["🌛"] = _ud83c_udf1b | 77 | _module_0["🌛"] = _u1f31b |
| 78 | return _module_0 | 78 | return _module_0 |
| 79 | local area = 6.2831853071796 * 5 | 79 | local area = 6.2831853071796 * 5 |
| 80 | print('hello world') | 80 | print('hello world') |
| @@ -2514,8 +2514,8 @@ local apple = setmetatable({ | |||
| 2514 | if (getmetatable(apple) ~= nil) then | 2514 | if (getmetatable(apple) ~= nil) then |
| 2515 | p(apple.size, apple.color, getmetatable(apple).__index) | 2515 | p(apple.size, apple.color, getmetatable(apple).__index) |
| 2516 | end | 2516 | end |
| 2517 | local _ud83c_udf1b = "月之脚本" | 2517 | local _u1f31b = "月之脚本" |
| 2518 | _module_0["🌛"] = _ud83c_udf1b | 2518 | _module_0["🌛"] = _u1f31b |
| 2519 | return _module_0 | 2519 | return _module_0 |
| 2520 | local area = 6.2831853071796 * 5 | 2520 | local area = 6.2831853071796 * 5 |
| 2521 | print('hello world') | 2521 | 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({ | |||
| 73 | if (getmetatable(apple) ~= nil) then | 73 | if (getmetatable(apple) ~= nil) then |
| 74 | p(apple.size, apple.color, getmetatable(apple).__index) | 74 | p(apple.size, apple.color, getmetatable(apple).__index) |
| 75 | end | 75 | end |
| 76 | local _ud83c_udf1b = "月之脚本" | 76 | local _u1f31b = "月之脚本" |
| 77 | _module_0["🌛"] = _ud83c_udf1b | 77 | _module_0["🌛"] = _u1f31b |
| 78 | return _module_0 | 78 | return _module_0 |
| 79 | local area = 6.2831853071796 * 5 | 79 | local area = 6.2831853071796 * 5 |
| 80 | print('你好 世界') | 80 | print('你好 世界') |
| @@ -2508,8 +2508,8 @@ local apple = setmetatable({ | |||
| 2508 | if (getmetatable(apple) ~= nil) then | 2508 | if (getmetatable(apple) ~= nil) then |
| 2509 | p(apple.size, apple.color, getmetatable(apple).__index) | 2509 | p(apple.size, apple.color, getmetatable(apple).__index) |
| 2510 | end | 2510 | end |
| 2511 | local _ud83c_udf1b = "月之脚本" | 2511 | local _u1f31b = "月之脚本" |
| 2512 | _module_0["🌛"] = _ud83c_udf1b | 2512 | _module_0["🌛"] = _u1f31b |
| 2513 | return _module_0 | 2513 | return _module_0 |
| 2514 | local area = 6.2831853071796 * 5 | 2514 | local area = 6.2831853071796 * 5 |
| 2515 | print('你好 世界') | 2515 | 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() | |||
| 24 | end) | 24 | end) |
| 25 | local _u53d8_u91cfh | 25 | local _u53d8_u91cfh |
| 26 | _u53d8_u91cfh = function() | 26 | _u53d8_u91cfh = function() |
| 27 | return _ud83d_udc4b | 27 | return _u1f44b |
| 28 | end | 28 | end |
| 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 |
| 13 | end)(), _u9053_u5177_u7ec4["字段z"] | 13 | end)(), _u9053_u5177_u7ec4["字段z"] |
| 14 | local _u9886_u4e3b, _ud83d_udc7b | 14 | local _u9886_u4e3b, _u1f47b |
| 15 | do | 15 | do |
| 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(); |
