diff options
| author | Li Jin <dragon-fly@qq.com> | 2025-07-18 11:51:39 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2025-07-18 11:51:39 +0800 |
| commit | 9d3d8ef2be15dfbf279de71241ff747a568e2c49 (patch) | |
| tree | 53f88fa8a0e64dfa2262898312c9b4d988876fe8 /spec/inputs/macro_teal.yue | |
| parent | 51a74726e6f68851bafccba0fe69900274a81d59 (diff) | |
| download | yuescript-9d3d8ef2be15dfbf279de71241ff747a568e2c49.tar.gz yuescript-9d3d8ef2be15dfbf279de71241ff747a568e2c49.tar.bz2 yuescript-9d3d8ef2be15dfbf279de71241ff747a568e2c49.zip | |
Added specs, tests and docs.
Diffstat (limited to 'spec/inputs/macro_teal.yue')
| -rw-r--r-- | spec/inputs/macro_teal.yue | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/spec/inputs/macro_teal.yue b/spec/inputs/macro_teal.yue index 0cfd862..e51bcd7 100644 --- a/spec/inputs/macro_teal.yue +++ b/spec/inputs/macro_teal.yue | |||
| @@ -4,11 +4,16 @@ $ -> | |||
| 4 | options.target_extension = "tl" | 4 | options.target_extension = "tl" |
| 5 | package.path ..= ";./spec/lib/?.lua" | 5 | package.path ..= ";./spec/lib/?.lua" |
| 6 | 6 | ||
| 7 | macro to_lua = (code)-> | 7 | macro to_lua = (code)-> | |
| 8 | "require('yue').to_lua(#{code}, reserve_line_number:false, same_module:true)" | 8 | require('yue').to_lua #{code}, |
| 9 | reserve_line_number: false | ||
| 10 | same_module: true | ||
| 9 | 11 | ||
| 10 | macro trim = (name)-> | 12 | macro trim = (name)-> | |
| 11 | "if result := #{name}\\match '[\\'\"](.*)[\\'\"]' then result else #{name}" | 13 | if result := #{name}\match '[\'"](.*)[\'"]' |
| 14 | result | ||
| 15 | else | ||
| 16 | #{name} | ||
| 12 | 17 | ||
| 13 | export macro local = (decl, value = nil)-> | 18 | export macro local = (decl, value = nil)-> |
| 14 | import "yue" as {options:{:tl_enabled}} | 19 | import "yue" as {options:{:tl_enabled}} |
