diff options
author | Li Jin <dragon-fly@qq.com> | 2024-08-09 11:35:27 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2024-08-09 11:35:32 +0800 |
commit | f2b63cb849ea2f7ef571b82e7927cd4abef4414b (patch) | |
tree | c3277a22a76815fa8ec3d7f9909bf950c26e2dc7 /spec | |
parent | b6c86d19d74ac90a2450cf979a92187e691ea5fa (diff) | |
download | yuescript-f2b63cb849ea2f7ef571b82e7927cd4abef4414b.tar.gz yuescript-f2b63cb849ea2f7ef571b82e7927cd4abef4414b.tar.bz2 yuescript-f2b63cb849ea2f7ef571b82e7927cd4abef4414b.zip |
add builtin macro $is_ast().
Diffstat (limited to 'spec')
-rw-r--r-- | spec/inputs/macro.yue | 5 | ||||
-rw-r--r-- | spec/outputs/macro.lua | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/spec/inputs/macro.yue b/spec/inputs/macro.yue index 3d4fb10..d5197da 100644 --- a/spec/inputs/macro.yue +++ b/spec/inputs/macro.yue | |||
@@ -39,9 +39,8 @@ print $WindowFlag( | |||
39 | ) | 39 | ) |
40 | 40 | ||
41 | macro NumAndStr = (num, str) -> | 41 | macro NumAndStr = (num, str) -> |
42 | import "yue" | 42 | unless $is_ast(Num, num) and $is_ast SingleString, str |
43 | unless yue.is_ast("Num", "123") | 43 | error "got unexpected token" |
44 | error "unmatched tokens got" | ||
45 | "[#{num}, #{str}]" | 44 | "[#{num}, #{str}]" |
46 | 45 | ||
47 | print $NumAndStr 123, 'xyz' | 46 | print $NumAndStr 123, 'xyz' |
diff --git a/spec/outputs/macro.lua b/spec/outputs/macro.lua index 4492827..777f754 100644 --- a/spec/outputs/macro.lua +++ b/spec/outputs/macro.lua | |||
@@ -298,7 +298,7 @@ print((setmetatable({ | |||
298 | return 998 | 298 | return 998 |
299 | end | 299 | end |
300 | })) | 300 | })) |
301 | print("current line: " .. tostring(309)) | 301 | print("current line: " .. tostring(308)) |
302 | do | 302 | do |
303 | -- TODO | 303 | -- TODO |
304 | end | 304 | end |