aboutsummaryrefslogtreecommitdiff
path: root/nomsu.moon
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2017-12-04 17:54:52 -0800
committerBruce Hill <bitbucket@bruce-hill.com>2017-12-04 17:54:52 -0800
commit5903820699db7f7ce2efdc0faa3874270da42a22 (patch)
tree6d8933dd68fdedbee9c87494e38dac97038e34ed /nomsu.moon
parentb3b8c4d731b0983d5b12c56fc245a8d7c1d631f4 (diff)
Incremental progress towards working.
Diffstat (limited to 'nomsu.moon')
-rwxr-xr-xnomsu.moon6
1 files changed, 4 insertions, 2 deletions
diff --git a/nomsu.moon b/nomsu.moon
index 676f9b8..e957fc4 100755
--- a/nomsu.moon
+++ b/nomsu.moon
@@ -324,7 +324,9 @@ class NomsuCompiler
@write "#{colored.bright "RUNNING MACRO"} #{colored.underscore colored.magenta(tree.stub)} "
@writeln "#{colored.bright "WITH ARGS:"} #{colored.dim repr args}"
insert @callstack, "#macro"
+ old_tree, @defs["#macro_tree"] = @defs["#macro_tree"], tree
expr, statement = @call(tree.stub, tree.line_no, unpack(args))
+ @defs["#macro_tree"] = old_tree
remove @callstack
return expr, statement
@@ -808,13 +810,13 @@ end)]])\format(concat(lua_bits, "\n"))
initialize_core: =>
-- Sets up some core functionality
- nomsu_string_as_lua = (code, tree)=>
+ nomsu_string_as_lua = (code)=>
concat_parts = {}
for bit in *code.value
if type(bit) == "string"
insert concat_parts, bit
elseif type(bit) == "table" and bit.type == "FunctionCall" and bit.src == "__src__"
- insert concat_parts, repr(tree.src)
+ insert concat_parts, repr(@defs["#macro_tree"].src)
else
expr, statement = @tree_to_lua bit
if statement