diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2018-10-30 23:42:04 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2018-10-30 23:42:36 -0700 |
| commit | ea3197aaffba00318920ed5e1e33ca5f2a5e6c5c (patch) | |
| tree | 2ec4aff13c7a54a3730994525b591ac60528b5ad /nomsu_compiler.lua | |
| parent | e7e84c9eda38c930f5475301de4a449dcf59e8b6 (diff) | |
Fully working version of (action [foo]: baz) -> ((foo) means: baz)
refactor and misc other changes.
Diffstat (limited to 'nomsu_compiler.lua')
| -rw-r--r-- | nomsu_compiler.lua | 11 |
1 files changed, 9 insertions, 2 deletions
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") |
