diff options
| author | Li Jin <dragon-fly@qq.com> | 2021-02-08 13:38:07 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2021-02-08 13:38:07 +0800 |
| commit | 24dab43a753538dcf3b85bd09bf76c0a3c3c8b73 (patch) | |
| tree | 51c59ddf8302657ae3cce5d28ba27c66737fc842 /spec/inputs/macro-export.mp | |
| parent | 32651cccb380bf4682fa8f6d3e70d74952171f7b (diff) | |
| download | yuescript-24dab43a753538dcf3b85bd09bf76c0a3c3c8b73.tar.gz yuescript-24dab43a753538dcf3b85bd09bf76c0a3c3c8b73.tar.bz2 yuescript-24dab43a753538dcf3b85bd09bf76c0a3c3c8b73.zip | |
simplify macro syntax. fix issue #38 again.
Diffstat (limited to 'spec/inputs/macro-export.mp')
| -rw-r--r-- | spec/inputs/macro-export.mp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/spec/inputs/macro-export.mp b/spec/inputs/macro-export.mp index b6079ca..d669975 100644 --- a/spec/inputs/macro-export.mp +++ b/spec/inputs/macro-export.mp | |||
| @@ -1,9 +1,9 @@ | |||
| 1 | export macro block config = (debugging = true)-> | 1 | export macro config = (debugging = true)-> |
| 2 | global debugMode = debugging == "true" | 2 | global debugMode = debugging == "true" |
| 3 | global debugMacro = true | 3 | global debugMacro = true |
| 4 | "" | 4 | "" |
| 5 | 5 | ||
| 6 | export macro expr showMacro = (name,res)-> | 6 | export macro showMacro = (name,res)-> |
| 7 | if debugMacro | 7 | if debugMacro |
| 8 | "do | 8 | "do |
| 9 | txt = #{res} | 9 | txt = #{res} |
| @@ -13,16 +13,17 @@ export macro expr showMacro = (name,res)-> | |||
| 13 | else | 13 | else |
| 14 | res | 14 | res |
| 15 | 15 | ||
| 16 | export macro block asserts = (cond)-> | 16 | export macro asserts = (cond)-> |
| 17 | if debugMode | 17 | if debugMode |
| 18 | $showMacro "assert", "assert #{cond}" | 18 | $showMacro "assert", "assert #{cond}" |
| 19 | else | 19 | else |
| 20 | "" | 20 | "" |
| 21 | 21 | ||
| 22 | export macro expr assert = (cond)-> | 22 | export macro assert = (cond)-> |
| 23 | if debugMode | 23 | if debugMode |
| 24 | $showMacro "assert", "assert #{cond}" | 24 | $showMacro "assert", "assert #{cond}" |
| 25 | else | 25 | else |
| 26 | "#{cond}" | 26 | "#{cond}" |
| 27 | 27 | ||
| 28 | $config! | 28 | $config! |
| 29 | |||
