diff options
| author | Li Jin <dragon-fly@qq.com> | 2026-02-03 22:42:37 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2026-02-03 22:42:37 +0800 |
| commit | e4f8d1b3b075323968bb6dc334226dff33c0a2b0 (patch) | |
| tree | 657e1ac82e54b91014dc12d15e90329bf66f9d0f /spec/outputs | |
| parent | ca1ec12725c32b0173692e01259570966da8a9a6 (diff) | |
| download | yuescript-e4f8d1b3b075323968bb6dc334226dff33c0a2b0.tar.gz yuescript-e4f8d1b3b075323968bb6dc334226dff33c0a2b0.tar.bz2 yuescript-e4f8d1b3b075323968bb6dc334226dff33c0a2b0.zip | |
Updated doc.
Diffstat (limited to 'spec/outputs')
| -rw-r--r-- | spec/outputs/codes_from_doc.lua | 34 | ||||
| -rw-r--r-- | spec/outputs/codes_from_doc_zh.lua | 34 | ||||
| -rw-r--r-- | spec/outputs/compile_doc.lua | 10 |
3 files changed, 69 insertions, 9 deletions
diff --git a/spec/outputs/codes_from_doc.lua b/spec/outputs/codes_from_doc.lua index 3b0724a..b8985e7 100644 --- a/spec/outputs/codes_from_doc.lua +++ b/spec/outputs/codes_from_doc.lua | |||
| @@ -107,7 +107,7 @@ if cond then | |||
| 107 | end | 107 | end |
| 108 | end | 108 | end |
| 109 | print("yuescript") | 109 | print("yuescript") |
| 110 | print(3) | 110 | print(2) |
| 111 | print("Valid enum type:", "Static") | 111 | print("Valid enum type:", "Static") |
| 112 | do | 112 | do |
| 113 | print(123, "hello") | 113 | print(123, "hello") |
| @@ -992,6 +992,36 @@ local arg1 = { | |||
| 992 | a = 0 | 992 | a = 0 |
| 993 | } | 993 | } |
| 994 | f2(arg1, arg2) | 994 | f2(arg1, arg2) |
| 995 | local findFirstEven | ||
| 996 | findFirstEven = function(list) | ||
| 997 | for _index_0 = 1, #list do | ||
| 998 | local item = list[_index_0] | ||
| 999 | if type(item) == "table" then | ||
| 1000 | for _index_1 = 1, #item do | ||
| 1001 | local sub = item[_index_1] | ||
| 1002 | if sub % 2 == 0 then | ||
| 1003 | return sub | ||
| 1004 | end | ||
| 1005 | end | ||
| 1006 | end | ||
| 1007 | end | ||
| 1008 | return nil | ||
| 1009 | end | ||
| 1010 | local findFirstEven | ||
| 1011 | findFirstEven = function(list) | ||
| 1012 | for _index_0 = 1, #list do | ||
| 1013 | local item = list[_index_0] | ||
| 1014 | if type(item) == "table" then | ||
| 1015 | for _index_1 = 1, #item do | ||
| 1016 | local sub = item[_index_1] | ||
| 1017 | if sub % 2 == 0 then | ||
| 1018 | return sub | ||
| 1019 | end | ||
| 1020 | end | ||
| 1021 | end | ||
| 1022 | end | ||
| 1023 | return nil | ||
| 1024 | end | ||
| 995 | local f | 1025 | local f |
| 996 | f = function(...) | 1026 | f = function(...) |
| 997 | local t = { | 1027 | local t = { |
| @@ -2637,7 +2667,7 @@ if cond then | |||
| 2637 | end | 2667 | end |
| 2638 | end | 2668 | end |
| 2639 | print("yuescript") | 2669 | print("yuescript") |
| 2640 | print(3) | 2670 | print(2) |
| 2641 | print("Valid enum type:", "Static") | 2671 | print("Valid enum type:", "Static") |
| 2642 | do | 2672 | do |
| 2643 | print(123, "hello") | 2673 | print(123, "hello") |
diff --git a/spec/outputs/codes_from_doc_zh.lua b/spec/outputs/codes_from_doc_zh.lua index 89335c9..2aa354e 100644 --- a/spec/outputs/codes_from_doc_zh.lua +++ b/spec/outputs/codes_from_doc_zh.lua | |||
| @@ -107,7 +107,7 @@ if cond then | |||
| 107 | end | 107 | end |
| 108 | end | 108 | end |
| 109 | print("yuescript") | 109 | print("yuescript") |
| 110 | print(3) | 110 | print(2) |
| 111 | print("有效的枚举类型:", "Static") | 111 | print("有效的枚举类型:", "Static") |
| 112 | do | 112 | do |
| 113 | print(123, "hello") | 113 | print(123, "hello") |
| @@ -986,6 +986,36 @@ local arg1 = { | |||
| 986 | a = 0 | 986 | a = 0 |
| 987 | } | 987 | } |
| 988 | f2(arg1, arg2) | 988 | f2(arg1, arg2) |
| 989 | local findFirstEven | ||
| 990 | findFirstEven = function(list) | ||
| 991 | for _index_0 = 1, #list do | ||
| 992 | local item = list[_index_0] | ||
| 993 | if type(item) == "table" then | ||
| 994 | for _index_1 = 1, #item do | ||
| 995 | local sub = item[_index_1] | ||
| 996 | if sub % 2 == 0 then | ||
| 997 | return sub | ||
| 998 | end | ||
| 999 | end | ||
| 1000 | end | ||
| 1001 | end | ||
| 1002 | return nil | ||
| 1003 | end | ||
| 1004 | local findFirstEven | ||
| 1005 | findFirstEven = function(list) | ||
| 1006 | for _index_0 = 1, #list do | ||
| 1007 | local item = list[_index_0] | ||
| 1008 | if type(item) == "table" then | ||
| 1009 | for _index_1 = 1, #item do | ||
| 1010 | local sub = item[_index_1] | ||
| 1011 | if sub % 2 == 0 then | ||
| 1012 | return sub | ||
| 1013 | end | ||
| 1014 | end | ||
| 1015 | end | ||
| 1016 | end | ||
| 1017 | return nil | ||
| 1018 | end | ||
| 989 | local f | 1019 | local f |
| 990 | f = function(...) | 1020 | f = function(...) |
| 991 | local t = { | 1021 | local t = { |
| @@ -2631,7 +2661,7 @@ if cond then | |||
| 2631 | end | 2661 | end |
| 2632 | end | 2662 | end |
| 2633 | print("yuescript") | 2663 | print("yuescript") |
| 2634 | print(3) | 2664 | print(2) |
| 2635 | print("有效的枚举类型:", "Static") | 2665 | print("有效的枚举类型:", "Static") |
| 2636 | do | 2666 | do |
| 2637 | print(123, "hello") | 2667 | print(123, "hello") |
diff --git a/spec/outputs/compile_doc.lua b/spec/outputs/compile_doc.lua index 3781fb9..e7d307d 100644 --- a/spec/outputs/compile_doc.lua +++ b/spec/outputs/compile_doc.lua | |||
| @@ -2,11 +2,11 @@ local outputFolder = ... | |||
| 2 | local _list_0 = { | 2 | local _list_0 = { |
| 3 | { | 3 | { |
| 4 | "codes_from_doc.lua", | 4 | "codes_from_doc.lua", |
| 5 | "doc/docs/doc/README.md" | 5 | "doc/docs/doc/index.md" |
| 6 | }, | 6 | }, |
| 7 | { | 7 | { |
| 8 | "codes_from_doc_zh.lua", | 8 | "codes_from_doc_zh.lua", |
| 9 | "doc/docs/zh/doc/README.md" | 9 | "doc/docs/zh/doc/index.md" |
| 10 | } | 10 | } |
| 11 | } | 11 | } |
| 12 | for _index_0 = 1, #_list_0 do | 12 | for _index_0 = 1, #_list_0 do |
| @@ -18,7 +18,7 @@ for _index_0 = 1, #_list_0 do | |||
| 18 | local to_lua = require("yue").to_lua | 18 | local to_lua = require("yue").to_lua |
| 19 | local text = _with_0:read("*a") | 19 | local text = _with_0:read("*a") |
| 20 | local codes = { } | 20 | local codes = { } |
| 21 | for code in text:gmatch("```moonscript(.-)```") do | 21 | for code in text:gmatch("```yuescript[\r\n]+(.-)```[^%w]") do |
| 22 | local result, err = to_lua(code, { | 22 | local result, err = to_lua(code, { |
| 23 | implicit_return_root = false, | 23 | implicit_return_root = false, |
| 24 | reserve_line_number = false | 24 | reserve_line_number = false |
| @@ -30,8 +30,8 @@ for _index_0 = 1, #_list_0 do | |||
| 30 | os.exit(1) | 30 | os.exit(1) |
| 31 | end | 31 | end |
| 32 | end | 32 | end |
| 33 | for code in text:gmatch("<pre>(.-)</pre>") do | 33 | for code in text:gmatch("```yue[\r\n]+(.-)```[^%w]") do |
| 34 | local result, err = to_lua(code:gsub("<", "<"):gsub(">", ">"), { | 34 | local result, err = to_lua(code, { |
| 35 | implicit_return_root = false, | 35 | implicit_return_root = false, |
| 36 | reserve_line_number = false | 36 | reserve_line_number = false |
| 37 | }) | 37 | }) |
