Closed leonidborisenko closed 9 years ago
Add import macro ... syntax and document it.
import macro ...
Example (based on example from README.md):
README.md
-- file: macros.shn function hello(ctx, expr) util = require("shine.lang.util") mesg = util::unquote(ctx.get(expr)) return ctx.op{'!call', 'print', ctx.op"Hello %{mesg}"} end export hello
-- file: hello.shn import macro hello from "macros" hello("World!")
PR also contains fix for following bug:
-- file:macros.shn function fn(ctx, expr) return ctx.op"hello" end
--- file:error.shn import my_macro = fn from "macros" macro my_macro = my_macro
$ shine error.shn Error: [string "shine.lang.translator"]:0: imported macro body for 'my_macro' cannot be resolved stack traceback: <...>
Looks good. Thanks!
Add
import macro ...
syntax and document it.Example (based on example from
README.md
):PR also contains fix for following bug: