aboutsummaryrefslogtreecommitdiff
path: root/spec/inputs/macro.mp
diff options
context:
space:
mode:
Diffstat (limited to 'spec/inputs/macro.mp')
-rw-r--r--spec/inputs/macro.mp23
1 files changed, 14 insertions, 9 deletions
diff --git a/spec/inputs/macro.mp b/spec/inputs/macro.mp
index 103df95..fafa522 100644
--- a/spec/inputs/macro.mp
+++ b/spec/inputs/macro.mp
@@ -1,11 +1,7 @@
1macro block init = -> 1$ ->
2 with require "moonp" 2 package.moonpath = "?.mp;./spec/inputs/?.mp"
3 package.moonpath = "?.mp;./spec/inputs/?.mp"
4 ""
5 3
6$init! 4import "macro-export" as {
7
8import "macro_export" as {
9 $, -- import all macros 5 $, -- import all macros
10 $config:$myconfig, -- rename macro $config to $myconfig 6 $config:$myconfig, -- rename macro $config to $myconfig
11} 7}
@@ -125,6 +121,12 @@ end
125x = x + f(3) 121x = x + f(3)
126]] 122]]
127 123
124$lua[[
125function tb:func()
126 print(123)
127end
128]]
129
128print x 130print x
129 131
130macro lua def = (fname, ...)-> 132macro lua def = (fname, ...)->
@@ -144,8 +146,11 @@ $def sel, a, b, c, [[
144 end 146 end
145]] 147]]
146 148
147$def dummy,[[ 149$def dummy,[[]]
148]] 150
151macro lua insertComment = (text)-> "-- #{text\match '[\'"](.*)[\'"]'}"
152
153$insertComment "a comment here"
149 154
150import 'underscore' as _ 155import 'underscore' as _
151 156