From b6c86d19d74ac90a2450cf979a92187e691ea5fa Mon Sep 17 00:00:00 2001 From: Li Jin Date: Fri, 9 Aug 2024 02:55:56 +0800 Subject: add yue.is_ast(). --- spec/inputs/macro.yue | 8 ++++++++ spec/outputs/macro.lua | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'spec') diff --git a/spec/inputs/macro.yue b/spec/inputs/macro.yue index a2e1046..3d4fb10 100644 --- a/spec/inputs/macro.yue +++ b/spec/inputs/macro.yue @@ -38,6 +38,14 @@ print $WindowFlag( NoScrollbar ) +macro NumAndStr = (num, str) -> + import "yue" + unless yue.is_ast("Num", "123") + error "unmatched tokens got" + "[#{num}, #{str}]" + +print $NumAndStr 123, 'xyz' + $asserts item == nil $myconfig false diff --git a/spec/outputs/macro.lua b/spec/outputs/macro.lua index 953c260..4492827 100644 --- a/spec/outputs/macro.lua +++ b/spec/outputs/macro.lua @@ -7,6 +7,10 @@ print({ "NoMove", "NoScrollbar" }) +print({ + 123, + 'xyz' +}) do assert(item == nil) end @@ -294,7 +298,7 @@ print((setmetatable({ return 998 end })) -print("current line: " .. tostring(301)) +print("current line: " .. tostring(309)) do -- TODO end -- cgit v1.2.3-55-g6feb