From 7f47d4204039258cec78c767f489b7809b4257ff Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 17 Nov 2018 14:38:05 -0800 Subject: In-progress (but working) overhaul of some elements including: function calls, lib/thing.nom API, multi-assignments, varargs, etc. --- nomsu.moon | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'nomsu.moon') diff --git a/nomsu.moon b/nomsu.moon index dd37034..62deada 100755 --- a/nomsu.moon +++ b/nomsu.moon @@ -131,10 +131,10 @@ run = -> for chunk_no, chunk in ipairs tree lua = nomsu_environment.compile(chunk) lua\declare_locals! + lua\prepend((chunk_no > 1) and '\n' or '', "-- File #{filename} chunk ##{chunk_no}\n") + if args.verbose then print(lua\text!) nomsu_environment.run_1_in(chunk, nomsu_environment) - output\write((chunk_no > 1) and '\n' or '', "-- File #{filename} chunk ##{chunk_no}\n") - output\write(tostring(lua), "\n") - if args.verbose then print(tostring(lua)) + output\write(lua\text!, "\n") print ("Compiled %-25s -> %s")\format(filename, filename\gsub("%.nom$", ".lua")) output\close! elseif args.verbose @@ -143,11 +143,12 @@ run = -> code = NomsuCode\from(source, code) tree = nomsu_environment._1_parsed(code) tree = {tree} unless tree.type == 'FileChunks' - for chunk in *tree + for chunk_no, chunk in ipairs tree lua = nomsu_environment.compile(chunk) lua\declare_locals! - nomsu_environment.run_1_in(chunk, nomsu_environment) - print(tostring(lua)) + lua\prepend((chunk_no > 1) and '\n' or '', "-- File #{filename} chunk ##{chunk_no}\n") + print(lua\text!) + nomsu_environment.run_1_in(lua, nomsu_environment) else -- Just run the file nomsu_environment.run_file_1_in(filename, nomsu_environment, 0) -- cgit v1.2.3