diff options
Diffstat (limited to 'spec/inputs')
| -rw-r--r-- | spec/inputs/macro-export.yue | 25 | ||||
| -rw-r--r-- | spec/inputs/macro.yue | 2 |
2 files changed, 18 insertions, 9 deletions
diff --git a/spec/inputs/macro-export.yue b/spec/inputs/macro-export.yue index d669975..22ef424 100644 --- a/spec/inputs/macro-export.yue +++ b/spec/inputs/macro-export.yue | |||
| @@ -1,15 +1,22 @@ | |||
| 1 | $ -> package.path = "?.lua;./spec/inputs/?.lua" | ||
| 2 | |||
| 3 | import "macro-todo" as $ | ||
| 4 | |||
| 5 | import "macro-todo" as {$, :$todo} | ||
| 6 | |||
| 1 | export macro config = (debugging = true)-> | 7 | export macro config = (debugging = true)-> |
| 2 | global debugMode = debugging == "true" | 8 | global debugMode = debugging == "true" |
| 3 | global debugMacro = true | 9 | global debugMacro = true |
| 4 | "" | 10 | "" |
| 5 | 11 | ||
| 6 | export macro showMacro = (name,res)-> | 12 | export macro showMacro = (name, res)-> |
| 7 | if debugMacro | 13 | if debugMacro then " |
| 8 | "do | 14 | do |
| 9 | txt = #{res} | 15 | txt = #{res} |
| 10 | print '[macro '..#{name}..']' | 16 | print '[macro ' .. #{name} .. ']' |
| 11 | print txt | 17 | print txt |
| 12 | txt" | 18 | txt |
| 19 | " | ||
| 13 | else | 20 | else |
| 14 | res | 21 | res |
| 15 | 22 | ||
| @@ -25,5 +32,7 @@ export macro assert = (cond)-> | |||
| 25 | else | 32 | else |
| 26 | "#{cond}" | 33 | "#{cond}" |
| 27 | 34 | ||
| 28 | $config! | 35 | $ -> |
| 36 | global debugMode = true | ||
| 37 | global debugMacro = true | ||
| 29 | 38 | ||
diff --git a/spec/inputs/macro.yue b/spec/inputs/macro.yue index 37702d1..e391b9e 100644 --- a/spec/inputs/macro.yue +++ b/spec/inputs/macro.yue | |||
| @@ -3,7 +3,7 @@ $ -> | |||
| 3 | 3 | ||
| 4 | import "macro-export" as { | 4 | import "macro-export" as { |
| 5 | $, -- import all macros | 5 | $, -- import all macros |
| 6 | $config:$myconfig, -- rename macro $config to $myconfig | 6 | $config: $myconfig, -- rename macro $config to $myconfig |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | import "macro-todo" as $ | 9 | import "macro-todo" as $ |
