From 4ba4c90e711c6204aa40e38347c5a5a076d9370e Mon Sep 17 00:00:00 2001 From: Li Jin Date: Fri, 23 May 2025 15:07:45 +0800 Subject: Added `-` for implicit object. --- spec/inputs/tables.yue | 18 ++++++++++++++++++ spec/inputs/with.yue | 4 ++++ spec/outputs/codes_from_doc.lua | 16 ++++++++++++++++ spec/outputs/codes_from_doc_zh.lua | 16 ++++++++++++++++ spec/outputs/tables.lua | 22 ++++++++++++++++++++++ spec/outputs/with.lua | 30 +++++++++++++++++++++++++----- 6 files changed, 101 insertions(+), 5 deletions(-) (limited to 'spec') diff --git a/spec/inputs/tables.yue b/spec/inputs/tables.yue index 0de8a8c..702e04a 100644 --- a/spec/inputs/tables.yue +++ b/spec/inputs/tables.yue @@ -245,6 +245,24 @@ menus = click: -> } +_ = + boolean: + - true + - false + float: + - 3.14 + - -6.8523015e+5 + int: + - 123 + - -0b1010_0111_0100_1010_1110 + null: + nodeName: 'node' + parent: nil + string: + - 'Hello world' + - "newline +newline2" + tb = {...other} tbMix = { diff --git a/spec/inputs/with.yue b/spec/inputs/with.yue index 3fee48e..dcd4053 100644 --- a/spec/inputs/with.yue +++ b/spec/inputs/with.yue @@ -161,4 +161,8 @@ do if .v break .a + a = while true + break with? tb + break 1 + nil diff --git a/spec/outputs/codes_from_doc.lua b/spec/outputs/codes_from_doc.lua index 3ee20bb..c7a2d50 100644 --- a/spec/outputs/codes_from_doc.lua +++ b/spec/outputs/codes_from_doc.lua @@ -339,6 +339,14 @@ func({ 2, 3 }) +local f +f = function() + return { + 1, + 2, + 3 + } +end local tb = { name = "abc", values = { @@ -2548,6 +2556,14 @@ func({ 2, 3 }) +local f +f = function() + return { + 1, + 2, + 3 + } +end local tb = { name = "abc", values = { diff --git a/spec/outputs/codes_from_doc_zh.lua b/spec/outputs/codes_from_doc_zh.lua index 52204b7..fcde41f 100644 --- a/spec/outputs/codes_from_doc_zh.lua +++ b/spec/outputs/codes_from_doc_zh.lua @@ -339,6 +339,14 @@ func({ 2, 3 }) +local f +f = function() + return { + 1, + 2, + 3 + } +end local tb = { name = "abc", values = { @@ -2542,6 +2550,14 @@ func({ 2, 3 }) +local f +f = function() + return { + 1, + 2, + 3 + } +end local tb = { name = "abc", values = { diff --git a/spec/outputs/tables.lua b/spec/outputs/tables.lua index f358811..3f851de 100644 --- a/spec/outputs/tables.lua +++ b/spec/outputs/tables.lua @@ -366,6 +366,28 @@ local menus = { } } } +_ = { + boolean = { + true, + false + }, + float = { + 3.14, + -6.8523015e+5 + }, + int = { + 123, + -685230 + }, + null = { + nodeName = 'node', + parent = nil + }, + string = { + 'Hello world', + "newline\nnewline2" + } +} local tb do local _tab_0 = { } diff --git a/spec/outputs/with.lua b/spec/outputs/with.lua index 20c5d44..867d1b5 100644 --- a/spec/outputs/with.lua +++ b/spec/outputs/with.lua @@ -203,15 +203,35 @@ do return _with_0 end)()) local a - local _with_0 = tb + do + local _with_0 = tb + do + local _accum_0 + while true do + if _with_0.v then + _accum_0 = _with_0.a + break + end + end + _with_0 = _accum_0 + end + a = _with_0 + end local _accum_0 while true do - if _with_0.v then - _accum_0 = _with_0.a + local _with_0 = tb + local _accum_1 + while true do + if _with_0 ~= nil then + _accum_1 = 1 + break + end break end + _with_0 = _accum_1 + _accum_0 = _with_0 + break end - _with_0 = _accum_0 - a = _with_0 + a = _accum_0 end return nil -- cgit v1.2.3-55-g6feb