From ea3197aaffba00318920ed5e1e33ca5f2a5e6c5c Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 30 Oct 2018 23:42:04 -0700 Subject: Fully working version of (action [foo]: baz) -> ((foo) means: baz) refactor and misc other changes. --- nomsu_compiler.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'nomsu_compiler.lua') diff --git a/nomsu_compiler.lua b/nomsu_compiler.lua index f9ba314..dff7eb7 100644 --- a/nomsu_compiler.lua +++ b/nomsu_compiler.lua @@ -459,12 +459,19 @@ do return add_lua_bits(self, "value", code) end, ["use 1"] = function(self, tree, path) + local lua = LuaCode(tree.source) if path.type == 'Text' and #path == 1 and type(path[1]) == 'string' then for _, f in Files.walk(path[1]) do - self:import(self:run_file(f)) + if match(f, "%.lua$") or match(f, "%.nom$") or match(f, "^/dev/fd/[012]$") then + self:import(self:run_file(f)) + if #lua.bits > 0 then + lua:append("\n") + end + lua:append("nomsu:import(nomsu:run_file(" .. tostring(f:as_lua()) .. "))") + end end end - return LuaCode(tree.source, "for i,f in Files.walk(", self:compile(path), ") do nomsu:import(nomsu:run_file(f)) end") + return lua end, ["tests"] = function(self, tree) return LuaCode.Value(tree.source, "TESTS") -- cgit v1.2.3