From b9d084fada57f54d9918f8024e407ed9e720ebca Mon Sep 17 00:00:00 2001 From: XeroOl Date: Thu, 1 Sep 2022 01:02:19 -0500 Subject: [PATCH] Upgrade fennel to ~xerool/fennel for extra hooks --- fennel | 1209 +++++++++++++++++++------------------- src/fennel.lua | 977 +++++++++++++++--------------- test/completion-test.fnl | 20 +- 3 files changed, 1104 insertions(+), 1102 deletions(-) diff --git a/fennel b/fennel index 454e10b..03d0ddf 100755 --- a/fennel +++ b/fennel @@ -1,19 +1,19 @@ #!/usr/bin/env lua package.preload["fennel.binary"] = package.preload["fennel.binary"] or function(...) local fennel = require("fennel") - local _local_768_ = require("fennel.utils") - local warn = _local_768_["warn"] - local copy = _local_768_["copy"] + local _local_767_ = require("fennel.utils") + local warn = _local_767_["warn"] + local copy = _local_767_["copy"] local function shellout(command) local f = io.popen(command) local stdout = f:read("*all") return (f:close() and stdout) end local function execute(cmd) - local _769_ = os.execute(cmd) - if (_769_ == 0) then + local _768_ = os.execute(cmd) + if (_768_ == 0) then return true - elseif (_769_ == true) then + elseif (_768_ == true) then return true else return nil @@ -41,13 +41,13 @@ package.preload["fennel.binary"] = package.preload["fennel.binary"] or function( local function module_name(open, rename, used_renames) local require_name do - local _772_ = rename[open] - if (nil ~= _772_) then - local renamed = _772_ + local _771_ = rename[open] + if (nil ~= _771_) then + local renamed = _771_ used_renames[open] = true require_name = renamed elseif true then - local _ = _772_ + local _ = _771_ require_name = open else require_name = nil @@ -90,14 +90,14 @@ package.preload["fennel.binary"] = package.preload["fennel.binary"] or function( local dotpath = filename:gsub("^%.%/", ""):gsub("[\\/]", ".") local dotpath_noextension = (dotpath:match("(.+)%.") or dotpath) local fennel_loader - local _776_ + local _775_ do - _776_ = "(do (local bundle_2_auto ...) (fn loader_3_auto [name_4_auto] (match (or (. bundle_2_auto name_4_auto) (. bundle_2_auto (.. name_4_auto \".init\"))) (mod_5_auto ? (= \"function\" (type mod_5_auto))) mod_5_auto (mod_5_auto ? (= \"string\" (type mod_5_auto))) (assert (if (= _VERSION \"Lua 5.1\") (loadstring mod_5_auto name_4_auto) (load mod_5_auto name_4_auto))) nil (values nil (: \"\n\\tmodule '%%s' not found in fennel bundle\" \"format\" name_4_auto)))) (table.insert (or package.loaders package.searchers) 2 loader_3_auto) ((assert (loader_3_auto \"%s\")) ((or unpack table.unpack) arg)))" + _775_ = "(do (local bundle_2_auto ...) (fn loader_3_auto [name_4_auto] (match (or (. bundle_2_auto name_4_auto) (. bundle_2_auto (.. name_4_auto \".init\"))) (mod_5_auto ? (= \"function\" (type mod_5_auto))) mod_5_auto (mod_5_auto ? (= \"string\" (type mod_5_auto))) (assert (if (= _VERSION \"Lua 5.1\") (loadstring mod_5_auto name_4_auto) (load mod_5_auto name_4_auto))) nil (values nil (: \"\n\\tmodule '%%s' not found in fennel bundle\" \"format\" name_4_auto)))) (table.insert (or package.loaders package.searchers) 2 loader_3_auto) ((assert (loader_3_auto \"%s\")) ((or unpack table.unpack) arg)))" end - fennel_loader = _776_:format(dotpath_noextension) + fennel_loader = _775_:format(dotpath_noextension) local lua_loader = fennel["compile-string"](fennel_loader) - local _let_777_ = options - local rename_modules = _let_777_["rename-modules"] + local _let_776_ = options + local rename_modules = _let_776_["rename-modules"] return c_shim:format(string__3ec_hex_literal(lua_loader), basename_noextension, string__3ec_hex_literal(compile_fennel(filename, options)), dotpath_noextension, native_loader(native, {["rename-modules"] = rename_modules})) end local function write_c(filename, native, options) @@ -110,28 +110,28 @@ package.preload["fennel.binary"] = package.preload["fennel.binary"] or function( local function compile_binary(lua_c_path, executable_name, static_lua, lua_include_dir, native) local cc = (os.getenv("CC") or "cc") local rdynamic, bin_extension, ldl_3f = nil, nil, nil - local _779_ + local _778_ do - local _778_ = shellout((cc .. " -dumpmachine")) - if (nil ~= _778_) then - _779_ = _778_:match("mingw") + local _777_ = shellout((cc .. " -dumpmachine")) + if (nil ~= _777_) then + _778_ = _777_:match("mingw") else - _779_ = _778_ + _778_ = _777_ end end - if _779_ then + if _778_ then rdynamic, bin_extension, ldl_3f = "", ".exe", false else rdynamic, bin_extension, ldl_3f = "-rdynamic", "", true end local compile_command - local _782_ + local _781_ if ldl_3f then - _782_ = "-ldl" + _781_ = "-ldl" else - _782_ = "" + _781_ = "" end - compile_command = {cc, "-Os", lua_c_path, table.concat(native, " "), static_lua, rdynamic, "-lm", _782_, "-o", (executable_name .. bin_extension), "-I", lua_include_dir, os.getenv("CC_OPTS")} + compile_command = {cc, "-Os", lua_c_path, table.concat(native, " "), static_lua, rdynamic, "-lm", _781_, "-o", (executable_name .. bin_extension), "-I", lua_include_dir, os.getenv("CC_OPTS")} if os.getenv("FENNEL_DEBUG") then print("Compiling with", table.concat(compile_command, " ")) else @@ -152,17 +152,17 @@ package.preload["fennel.binary"] = package.preload["fennel.binary"] or function( if (version_extension and (version_extension ~= "") and not version_extension:match("%.%d+")) then return false else - local _787_ = extension - if (_787_ == "a") then + local _786_ = extension + if (_786_ == "a") then return path - elseif (_787_ == "o") then + elseif (_786_ == "o") then return path - elseif (_787_ == "so") then + elseif (_786_ == "so") then return path - elseif (_787_ == "dylib") then + elseif (_786_ == "dylib") then return path elseif true then - local _ = _787_ + local _ = _786_ return false else return nil @@ -200,10 +200,10 @@ package.preload["fennel.binary"] = package.preload["fennel.binary"] or function( return native end local function compile(filename, executable_name, static_lua, lua_include_dir, options, args) - local _let_794_ = extract_native_args(args) - local modules = _let_794_["modules"] - local libraries = _let_794_["libraries"] - local rename_modules = _let_794_["rename-modules"] + local _let_793_ = extract_native_args(args) + local modules = _let_793_["modules"] + local libraries = _let_793_["libraries"] + local rename_modules = _let_793_["rename-modules"] local opts = {["rename-modules"] = rename_modules} copy(options, opts) return compile_binary(write_c(filename, modules, opts), executable_name, static_lua, lua_include_dir, libraries) @@ -220,14 +220,14 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) local view = require("fennel.view") local unpack = (table.unpack or _G.unpack) local function default_read_chunk(parser_state) - local function _617_() + local function _616_() if (0 < parser_state["stack-size"]) then return ".." else return ">> " end end - io.write(_617_()) + io.write(_616_()) io.flush() local input = io.read() return (input and (input .. "\n")) @@ -237,20 +237,20 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) return io.write("\n") end local function default_on_error(errtype, err, lua_source) - local function _619_() - local _618_ = errtype - if (_618_ == "Lua Compile") then + local function _618_() + local _617_ = errtype + if (_617_ == "Lua Compile") then return ("Bad code generated - likely a bug with the compiler:\n" .. "--- Generated Lua Start ---\n" .. lua_source .. "--- Generated Lua End ---\n") - elseif (_618_ == "Runtime") then + elseif (_617_ == "Runtime") then return (compiler.traceback(tostring(err), 4) .. "\n") elseif true then - local _ = _618_ + local _ = _617_ return ("%s error: %s\n"):format(errtype, tostring(err)) else return nil end end - return io.write(_619_()) + return io.write(_618_()) end local save_source = table.concat({"local ___i___ = 1", "while true do", " local name, value = debug.getlocal(1, ___i___)", " if(name and name ~= \"___i___\") then", " ___replLocals___[name] = value", " ___i___ = ___i___ + 1", " else break end end"}, "\n") local function splice_save_locals(env, lua_source) @@ -278,14 +278,14 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) local scope_first_3f = ((tbl == env) or (tbl == env.___replLocals___)) local tbl_14_auto = matches local i_15_auto = #tbl_14_auto - local function _622_() + local function _621_() if scope_first_3f then return scope.manglings else return tbl end end - for k, is_mangled in utils.allpairs(_622_()) do + for k, is_mangled in utils.allpairs(_621_()) do if (max_items <= #matches) then break end local val_16_auto do @@ -356,7 +356,7 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) return input:match("^%s*,") end local function command_docs() - local _631_ + local _630_ do local tbl_14_auto = {} local i_15_auto = #tbl_14_auto @@ -368,18 +368,18 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) else end end - _631_ = tbl_14_auto + _630_ = tbl_14_auto end - return table.concat(_631_, "\n") + return table.concat(_630_, "\n") end commands.help = function(_, _0, on_values) return on_values({("Welcome to Fennel.\nThis is the REPL where you can enter code to be evaluated.\nYou can also run these repl commands:\n\n" .. command_docs() .. "\n ,exit - Leave the repl.\n\nUse ,doc something to see descriptions for individual macros and special forms.\n\nFor more information about the language, see https://fennel-lang.org/reference")}) end do end (compiler.metadata):set(commands.help, "fnl/docstring", "Show this message.") local function reload(module_name, env, on_values, on_error) - local _633_, _634_ = pcall(specials["load-code"]("return require(...)", env), module_name) - if ((_633_ == true) and (nil ~= _634_)) then - local old = _634_ + local _632_, _633_ = pcall(specials["load-code"]("return require(...)", env), module_name) + if ((_632_ == true) and (nil ~= _633_)) then + local old = _633_ local _ package.loaded[module_name] = nil _ = nil @@ -406,38 +406,38 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) else end return on_values({"ok"}) - elseif ((_633_ == false) and (nil ~= _634_)) then - local msg = _634_ + elseif ((_632_ == false) and (nil ~= _633_)) then + local msg = _633_ if (specials["macro-loaded"])[module_name] then specials["macro-loaded"][module_name] = nil return nil else - local function _639_() - local _638_ = msg:gsub("\n.*", "") - return _638_ + local function _638_() + local _637_ = msg:gsub("\n.*", "") + return _637_ end - return on_error("Runtime", _639_()) + return on_error("Runtime", _638_()) end else return nil end end local function run_command(read, on_error, f) - local _642_, _643_, _644_ = pcall(read) - if ((_642_ == true) and (_643_ == true) and (nil ~= _644_)) then - local val = _644_ + local _641_, _642_, _643_ = pcall(read) + if ((_641_ == true) and (_642_ == true) and (nil ~= _643_)) then + local val = _643_ return f(val) - elseif (_642_ == false) then + elseif (_641_ == false) then return on_error("Parse", "Couldn't parse input.") else return nil end end commands.reload = function(env, read, on_values, on_error) - local function _646_(_241) + local function _645_(_241) return reload(tostring(_241), env, on_values, on_error) end - return run_command(read, on_error, _646_) + return run_command(read, on_error, _645_) end do end (compiler.metadata):set(commands.reload, "fnl/docstring", "Reload the specified module.") commands.reset = function(env, _, on_values) @@ -446,30 +446,30 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) end do end (compiler.metadata):set(commands.reset, "fnl/docstring", "Erase all repl-local scope.") commands.complete = function(env, read, on_values, on_error, scope, chars) - local function _647_() + local function _646_() return on_values(completer(env, scope, string.char(unpack(chars)):gsub(",complete +", ""):sub(1, -2))) end - return run_command(read, on_error, _647_) + return run_command(read, on_error, _646_) end do end (compiler.metadata):set(commands.complete, "fnl/docstring", "Print all possible completions for a given input symbol.") local function apropos_2a(pattern, tbl, prefix, seen, names) for name, subtbl in pairs(tbl) do if (("string" == type(name)) and (package ~= subtbl)) then - local _648_ = type(subtbl) - if (_648_ == "function") then + local _647_ = type(subtbl) + if (_647_ == "function") then if ((prefix .. name)):match(pattern) then table.insert(names, (prefix .. name)) else end - elseif (_648_ == "table") then + elseif (_647_ == "table") then if not seen[subtbl] then - local _651_ + local _650_ do - local _650_ = seen - _650_[subtbl] = true - _651_ = _650_ + local _649_ = seen + _649_[subtbl] = true + _650_ = _649_ end - apropos_2a(pattern, subtbl, (prefix .. name:gsub("%.", "/") .. "."), _651_, names) + apropos_2a(pattern, subtbl, (prefix .. name:gsub("%.", "/") .. "."), _650_, names) else end else @@ -494,10 +494,10 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) return tbl_14_auto end commands.apropos = function(_env, read, on_values, on_error, _scope) - local function _656_(_241) + local function _655_(_241) return on_values(apropos(tostring(_241))) end - return run_command(read, on_error, _656_) + return run_command(read, on_error, _655_) end do end (compiler.metadata):set(commands.apropos, "fnl/docstring", "Print all functions matching a pattern in all loaded modules.") local function apropos_follow_path(path) @@ -518,12 +518,12 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) local tgt = package.loaded for _, path0 in ipairs(paths) do if (nil == tgt) then break end - local _659_ + local _658_ do - local _658_ = path0:gsub("%/", ".") - _659_ = _658_ + local _657_ = path0:gsub("%/", ".") + _658_ = _657_ end - tgt = tgt[_659_] + tgt = tgt[_658_] end return tgt end @@ -535,9 +535,9 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) do local tgt = apropos_follow_path(path) if ("function" == type(tgt)) then - local _660_ = (compiler.metadata):get(tgt, "fnl/docstring") - if (nil ~= _660_) then - local docstr = _660_ + local _659_ = (compiler.metadata):get(tgt, "fnl/docstring") + if (nil ~= _659_) then + local docstr = _659_ val_16_auto = (docstr:match(pattern) and path) else val_16_auto = nil @@ -555,10 +555,10 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) return tbl_14_auto end commands["apropos-doc"] = function(_env, read, on_values, on_error, _scope) - local function _664_(_241) + local function _663_(_241) return on_values(apropos_doc(tostring(_241))) end - return run_command(read, on_error, _664_) + return run_command(read, on_error, _663_) end do end (compiler.metadata):set(commands["apropos-doc"], "fnl/docstring", "Print all functions that match the pattern in their docs") local function apropos_show_docs(on_values, pattern) @@ -573,31 +573,31 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) return nil end commands["apropos-show-docs"] = function(_env, read, on_values, on_error) - local function _666_(_241) + local function _665_(_241) return apropos_show_docs(on_values, tostring(_241)) end - return run_command(read, on_error, _666_) + return run_command(read, on_error, _665_) end do end (compiler.metadata):set(commands["apropos-show-docs"], "fnl/docstring", "Print all documentations matching a pattern in function name") - local function resolve(identifier, _667_, scope) - local _arg_668_ = _667_ - local ___replLocals___ = _arg_668_["___replLocals___"] - local env = _arg_668_ + local function resolve(identifier, _666_, scope) + local _arg_667_ = _666_ + local ___replLocals___ = _arg_667_["___replLocals___"] + local env = _arg_667_ local e - local function _669_(_241, _242) + local function _668_(_241, _242) return (___replLocals___[_242] or env[_242]) end - e = setmetatable({}, {__index = _669_}) - local _670_, _671_ = pcall(compiler["compile-string"], tostring(identifier), {scope = scope}) - if ((_670_ == true) and (nil ~= _671_)) then - local code = _671_ - local _672_ = specials["load-code"](code, e)() - local function _673_() - local x = _672_ + e = setmetatable({}, {__index = _668_}) + local _669_, _670_ = pcall(compiler["compile-string"], tostring(identifier), {scope = scope}) + if ((_669_ == true) and (nil ~= _670_)) then + local code = _670_ + local _671_ = specials["load-code"](code, e)() + local function _672_() + local x = _671_ return (type(x) == "function") end - if ((nil ~= _672_) and _673_()) then - local x = _672_ + if ((nil ~= _671_) and _672_()) then + local x = _671_ return x else return nil @@ -607,79 +607,79 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) end end commands.find = function(env, read, on_values, on_error, scope) - local function _676_(_241) - local _677_ + local function _675_(_241) + local _676_ do - local _678_ = utils["sym?"](_241) - if (nil ~= _678_) then - local _679_ = resolve(_678_, env, scope) - if (nil ~= _679_) then - _677_ = debug.getinfo(_679_) + local _677_ = utils["sym?"](_241) + if (nil ~= _677_) then + local _678_ = resolve(_677_, env, scope) + if (nil ~= _678_) then + _676_ = debug.getinfo(_678_) else - _677_ = _679_ + _676_ = _678_ end else - _677_ = _678_ + _676_ = _677_ end end - if ((_G.type(_677_) == "table") and (nil ~= (_677_).short_src) and ((_677_).what == "Lua") and (nil ~= (_677_).linedefined) and (nil ~= (_677_).source)) then - local src = (_677_).short_src - local line = (_677_).linedefined - local source = (_677_).source + if ((_G.type(_676_) == "table") and (nil ~= (_676_).linedefined) and ((_676_).what == "Lua") and (nil ~= (_676_).source) and (nil ~= (_676_).short_src)) then + local line = (_676_).linedefined + local source = (_676_).source + local src = (_676_).short_src local fnlsrc do - local t_682_ = compiler.sourcemap - if (nil ~= t_682_) then - t_682_ = (t_682_)[source] + local t_681_ = compiler.sourcemap + if (nil ~= t_681_) then + t_681_ = (t_681_)[source] else end - if (nil ~= t_682_) then - t_682_ = (t_682_)[line] + if (nil ~= t_681_) then + t_681_ = (t_681_)[line] else end - if (nil ~= t_682_) then - t_682_ = (t_682_)[2] + if (nil ~= t_681_) then + t_681_ = (t_681_)[2] else end - fnlsrc = t_682_ + fnlsrc = t_681_ end return on_values({string.format("%s:%s", src, (fnlsrc or line))}) - elseif (_677_ == nil) then + elseif (_676_ == nil) then return on_error("Repl", "Unknown value") elseif true then - local _ = _677_ + local _ = _676_ return on_error("Repl", "No source info") else return nil end end - return run_command(read, on_error, _676_) + return run_command(read, on_error, _675_) end do end (compiler.metadata):set(commands.find, "fnl/docstring", "Print the filename and line number for a given function") commands.doc = function(env, read, on_values, on_error, scope) - local function _687_(_241) + local function _686_(_241) local name = tostring(_241) local path = (utils["multi-sym?"](name) or {name}) local is_ok, target = nil, nil - local function _688_() + local function _687_() return (utils["get-in"](scope.specials, path) or utils["get-in"](scope.macros, path) or resolve(name, env, scope)) end - is_ok, target = pcall(_688_) + is_ok, target = pcall(_687_) if is_ok then return on_values({specials.doc(target, name)}) else return on_error("Repl", "Could not resolve value for docstring lookup") end end - return run_command(read, on_error, _687_) + return run_command(read, on_error, _686_) end do end (compiler.metadata):set(commands.doc, "fnl/docstring", "Print the docstring and arglist for a function, macro, or special form.") local function load_plugin_commands(plugins) for _, plugin in ipairs((plugins or {})) do for name, f in pairs(plugin) do - local _690_ = name:match("^repl%-command%-(.*)") - if (nil ~= _690_) then - local cmd_name = _690_ + local _689_ = name:match("^repl%-command%-(.*)") + if (nil ~= _689_) then + local cmd_name = _689_ commands[cmd_name] = (commands[cmd_name] or f) else end @@ -690,12 +690,12 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) local function run_command_loop(input, read, loop, env, on_values, on_error, scope, chars) local command_name = input:match(",([^%s/]+)") do - local _692_ = commands[command_name] - if (nil ~= _692_) then - local command = _692_ + local _691_ = commands[command_name] + if (nil ~= _691_) then + local command = _691_ command(env, read, on_values, on_error, scope, chars) elseif true then - local _ = _692_ + local _ = _691_ if ("exit" ~= command_name) then on_values({"Unknown command", command_name}) else @@ -720,10 +720,10 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) do local tbl_11_auto = {keeplines = 1000, histfile = ""} for k, v in pairs(readline.set_options({})) do - local _697_, _698_ = k, v - if ((nil ~= _697_) and (nil ~= _698_)) then - local k_12_auto = _697_ - local v_13_auto = _698_ + local _696_, _697_ = k, v + if ((nil ~= _696_) and (nil ~= _697_)) then + local k_12_auto = _696_ + local v_13_auto = _697_ tbl_11_auto[k_12_auto] = v_13_auto else end @@ -781,12 +781,12 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) local byte_stream, clear_stream = parser.granulate(read_chunk) local chars = {} local read, reset = nil, nil - local function _704_(parser_state) + local function _703_(parser_state) local c = byte_stream(parser_state) table.insert(chars, c) return c end - read, reset = parser.parser(_704_) + read, reset = parser.parser(_703_) opts.env, opts.scope = env, compiler["make-scope"]() opts.useMetadata = (opts.useMetadata ~= false) if (opts.allowedGlobals == nil) then @@ -794,15 +794,15 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) else end if opts.registerCompleter then - local function _708_() - local _706_ = env - local _707_ = opts.scope - local function _709_(...) - return completer(_706_, _707_, ...) + local function _707_() + local _705_ = env + local _706_ = opts.scope + local function _708_(...) + return completer(_705_, _706_, ...) end - return _709_ + return _708_ end - opts.registerCompleter(_708_()) + opts.registerCompleter(_707_()) else end load_plugin_commands(opts.plugins) @@ -842,43 +842,43 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) else if not_eof_3f then do - local _713_, _714_ = nil, nil - local function _716_() - local _715_ = opts - _715_["source"] = src_string - return _715_ + local _712_, _713_ = nil, nil + local function _715_() + local _714_ = opts + _714_["source"] = src_string + return _714_ end - _713_, _714_ = pcall(compiler.compile, x, _716_()) - if ((_713_ == false) and (nil ~= _714_)) then - local msg = _714_ + _712_, _713_ = pcall(compiler.compile, x, _715_()) + if ((_712_ == false) and (nil ~= _713_)) then + local msg = _713_ clear_stream() on_error("Compile", msg) - elseif ((_713_ == true) and (nil ~= _714_)) then - local src = _714_ + elseif ((_712_ == true) and (nil ~= _713_)) then + local src = _713_ local src0 if save_locals_3f then src0 = splice_save_locals(env, src, opts.scope) else src0 = src end - local _718_, _719_ = pcall(specials["load-code"], src0, env) - if ((_718_ == false) and (nil ~= _719_)) then - local msg = _719_ + local _717_, _718_ = pcall(specials["load-code"], src0, env) + if ((_717_ == false) and (nil ~= _718_)) then + local msg = _718_ clear_stream() on_error("Lua Compile", msg, src0) - elseif (true and (nil ~= _719_)) then - local _ = _718_ - local chunk = _719_ - local function _720_() + elseif (true and (nil ~= _718_)) then + local _ = _717_ + local chunk = _718_ + local function _719_() return print_values(chunk()) end - local function _721_() - local function _722_(...) + local function _720_() + local function _721_(...) return on_error("Runtime", ...) end - return _722_ + return _721_ end - xpcall(_720_, _721_()) + xpcall(_719_, _720_()) else end else @@ -908,14 +908,14 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct local unpack = (table.unpack or _G.unpack) local SPECIALS = compiler.scopes.global.specials local function wrap_env(env) - local function _412_(_, key) + local function _411_(_, key) if utils["string?"](key) then return env[compiler["global-unmangling"](key)] else return env[key] end end - local function _414_(_, key, value) + local function _413_(_, key, value) if utils["string?"](key) then env[compiler["global-unmangling"](key)] = value return nil @@ -924,38 +924,38 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct return nil end end - local function _416_() + local function _415_() local function putenv(k, v) - local _417_ + local _416_ if utils["string?"](k) then - _417_ = compiler["global-unmangling"](k) + _416_ = compiler["global-unmangling"](k) else - _417_ = k + _416_ = k end - return _417_, v + return _416_, v end return next, utils.kvmap(env, putenv), nil end - return setmetatable({}, {__index = _412_, __newindex = _414_, __pairs = _416_}) + return setmetatable({}, {__index = _411_, __newindex = _413_, __pairs = _415_}) end local function current_global_names(_3fenv) local mt do - local _419_ = getmetatable(_3fenv) - if ((_G.type(_419_) == "table") and (nil ~= (_419_).__pairs)) then - local mtpairs = (_419_).__pairs + local _418_ = getmetatable(_3fenv) + if ((_G.type(_418_) == "table") and (nil ~= (_418_).__pairs)) then + local mtpairs = (_418_).__pairs local tbl_11_auto = {} for k, v in mtpairs(_3fenv) do - local _420_, _421_ = k, v - if ((nil ~= _420_) and (nil ~= _421_)) then - local k_12_auto = _420_ - local v_13_auto = _421_ + local _419_, _420_ = k, v + if ((nil ~= _419_) and (nil ~= _420_)) then + local k_12_auto = _419_ + local v_13_auto = _420_ tbl_11_auto[k_12_auto] = v_13_auto else end end mt = tbl_11_auto - elseif (_419_ == nil) then + elseif (_418_ == nil) then mt = (_3fenv or _G) else mt = nil @@ -965,16 +965,16 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct end local function load_code(code, _3fenv, _3ffilename) local env = (_3fenv or rawget(_G, "_ENV") or _G) - local _424_, _425_ = rawget(_G, "setfenv"), rawget(_G, "loadstring") - if ((nil ~= _424_) and (nil ~= _425_)) then - local setfenv = _424_ - local loadstring = _425_ + local _423_, _424_ = rawget(_G, "setfenv"), rawget(_G, "loadstring") + if ((nil ~= _423_) and (nil ~= _424_)) then + local setfenv = _423_ + local loadstring = _424_ local f = assert(loadstring(code, _3ffilename)) - local _426_ = f - setfenv(_426_, env) - return _426_ + local _425_ = f + setfenv(_425_, env) + return _425_ elseif true then - local _ = _424_ + local _ = _423_ return assert(load(code, _3ffilename, "t", env)) else return nil @@ -988,13 +988,13 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct local mt = getmetatable(tgt) if ((type(tgt) == "function") or ((type(mt) == "table") and (type(mt.__call) == "function"))) then local arglist = table.concat(((compiler.metadata):get(tgt, "fnl/arglist") or {"#"}), " ") - local _428_ + local _427_ if (0 < #arglist) then - _428_ = " " + _427_ = " " else - _428_ = "" + _427_ = "" end - return string.format("(%s%s%s)\n %s", name, _428_, arglist, docstring) + return string.format("(%s%s%s)\n %s", name, _427_, arglist, docstring) else return string.format("%s\n %s", name, docstring) end @@ -1019,6 +1019,7 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct local chunk = (_3fchunk or {}) local len = #ast local retexprs = {returned = true} + utils.hook("customhook-early-do", ast, sub_scope) local function compile_body(outer_target, outer_tail, outer_retexprs) if (len < start) then compiler.compile1(nil, sub_scope, chunk, {tail = outer_tail, target = outer_target}) @@ -1083,7 +1084,7 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct doc_special("values", {"..."}, "Return multiple values from a function. Must be in tail position.") local function deep_tostring(x, key_3f) if utils["list?"](x) then - local _437_ + local _436_ do local tbl_14_auto = {} local i_15_auto = #tbl_14_auto @@ -1095,11 +1096,11 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct else end end - _437_ = tbl_14_auto + _436_ = tbl_14_auto end - return ("(" .. table.concat(_437_, " ") .. ")") + return ("(" .. table.concat(_436_, " ") .. ")") elseif utils["sequence?"](x) then - local _439_ + local _438_ do local tbl_14_auto = {} local i_15_auto = #tbl_14_auto @@ -1111,11 +1112,11 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct else end end - _439_ = tbl_14_auto + _438_ = tbl_14_auto end - return ("[" .. table.concat(_439_, " ") .. "]") + return ("[" .. table.concat(_438_, " ") .. "]") elseif utils["table?"](x) then - local _441_ + local _440_ do local tbl_14_auto = {} local i_15_auto = #tbl_14_auto @@ -1127,9 +1128,9 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct else end end - _441_ = tbl_14_auto + _440_ = tbl_14_auto end - return ("{" .. table.concat(_441_, " ") .. "}") + return ("{" .. table.concat(_440_, " ") .. "}") elseif (key_3f and utils["string?"](x) and x:find("^[-%w?\\^_!$%&*+./@:|<=>]+$")) then return (":" .. x) elseif utils["string?"](x) then @@ -1141,10 +1142,10 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct local function set_fn_metadata(arg_list, docstring, parent, fn_name) if utils.root.options.useMetadata then local args - local function _444_(_241) + local function _443_(_241) return ("\"%s\""):format(deep_tostring(_241)) end - args = utils.map(arg_list, _444_) + args = utils.map(arg_list, _443_) local meta_fields = {"\"fnl/arglist\"", ("{" .. table.concat(args, ", ") .. "}")} if docstring then table.insert(meta_fields, "\"fnl/docstring\"") @@ -1159,28 +1160,29 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct end local function get_fn_name(ast, scope, fn_name, multi) if (fn_name and (fn_name[1] ~= "nil")) then - local _447_ + local _446_ if not multi then - _447_ = compiler["declare-local"](fn_name, {}, scope, ast) + _446_ = compiler["declare-local"](fn_name, {}, scope, ast) else - _447_ = (compiler["symbol-to-expression"](fn_name, scope))[1] + _446_ = (compiler["symbol-to-expression"](fn_name, scope))[1] end - return _447_, not multi, 3 + return _446_, not multi, 3 else return nil, true, 2 end end local function compile_named_fn(ast, f_scope, f_chunk, parent, index, fn_name, local_3f, arg_name_list, f_metadata) + utils.hook("customhook-early-fn", ast, f_scope) for i = (index + 1), #ast do compiler.compile1(ast[i], f_scope, f_chunk, {nval = (((i ~= #ast) and 0) or nil), tail = (i == #ast)}) end - local _450_ + local _449_ if local_3f then - _450_ = "local function %s(%s)" + _449_ = "local function %s(%s)" else - _450_ = "%s = function(%s)" + _449_ = "%s = function(%s)" end - compiler.emit(parent, string.format(_450_, fn_name, table.concat(arg_name_list, ", ")), ast) + compiler.emit(parent, string.format(_449_, fn_name, table.concat(arg_name_list, ", ")), ast) compiler.emit(parent, f_chunk, ast) compiler.emit(parent, "end", ast) set_fn_metadata(f_metadata["fnl/arglist"], f_metadata["fnl/docstring"], parent, fn_name) @@ -1196,29 +1198,29 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct local index_2a = (index + 1) local expr = ast[index_2a] if (utils["string?"](expr) and (index_2a < #ast)) then - local _453_ + local _452_ do - local _452_ = f_metadata - _452_["fnl/docstring"] = expr - _453_ = _452_ + local _451_ = f_metadata + _451_["fnl/docstring"] = expr + _452_ = _451_ end - return _453_, index_2a + return _452_, index_2a elseif (utils["table?"](expr) and (index_2a < #ast)) then - local _454_ + local _453_ do local tbl_11_auto = f_metadata for k, v in pairs(expr) do - local _455_, _456_ = k, v - if ((nil ~= _455_) and (nil ~= _456_)) then - local k_12_auto = _455_ - local v_13_auto = _456_ + local _454_, _455_ = k, v + if ((nil ~= _454_) and (nil ~= _455_)) then + local k_12_auto = _454_ + local v_13_auto = _455_ tbl_11_auto[k_12_auto] = v_13_auto else end end - _454_ = tbl_11_auto + _453_ = tbl_11_auto end - return _454_, index_2a + return _453_, index_2a else return f_metadata, index end @@ -1226,9 +1228,9 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct SPECIALS.fn = function(ast, scope, parent) local f_scope do - local _459_ = compiler["make-scope"](scope) - do end (_459_)["vararg"] = false - f_scope = _459_ + local _458_ = compiler["make-scope"](scope) + do end (_458_)["vararg"] = false + f_scope = _458_ end local f_chunk = {} local fn_sym = utils["sym?"](ast[2]) @@ -1263,29 +1265,29 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct doc_special("fn", {"name?", "args", "docstring?", "..."}, "Function syntax. May optionally include a name and docstring or a metadata table.\nIf a name is provided, the function will be bound in the current scope.\nWhen called with the wrong number of args, excess args will be discarded\nand lacking args will be nil, use lambda for arity-checked functions.", true) SPECIALS.lua = function(ast, _, parent) compiler.assert(((#ast == 2) or (#ast == 3)), "expected 1 or 2 arguments", ast) - local _463_ + local _462_ do - local _462_ = utils["sym?"](ast[2]) - if (nil ~= _462_) then - _463_ = tostring(_462_) + local _461_ = utils["sym?"](ast[2]) + if (nil ~= _461_) then + _462_ = tostring(_461_) else - _463_ = _462_ + _462_ = _461_ end end - if ("nil" ~= _463_) then + if ("nil" ~= _462_) then table.insert(parent, {ast = ast, leaf = tostring(ast[2])}) else end - local _467_ + local _466_ do - local _466_ = utils["sym?"](ast[3]) - if (nil ~= _466_) then - _467_ = tostring(_466_) + local _465_ = utils["sym?"](ast[3]) + if (nil ~= _465_) then + _466_ = tostring(_465_) else - _467_ = _466_ + _466_ = _465_ end end - if ("nil" ~= _467_) then + if ("nil" ~= _466_) then return tostring(ast[3]) else return nil @@ -1294,8 +1296,8 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct local function dot(ast, scope, parent) compiler.assert((1 < #ast), "expected table argument", ast) local len = #ast - local _let_470_ = compiler.compile1(ast[2], scope, parent, {nval = 1}) - local lhs = _let_470_[1] + local _let_469_ = compiler.compile1(ast[2], scope, parent, {nval = 1}) + local lhs = _let_469_[1] if (len == 2) then return tostring(lhs) else @@ -1305,8 +1307,8 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct if (utils["string?"](index) and utils["valid-lua-identifier?"](index)) then table.insert(indices, ("." .. index)) else - local _let_471_ = compiler.compile1(index, scope, parent, {nval = 1}) - local index0 = _let_471_[1] + local _let_470_ = compiler.compile1(index, scope, parent, {nval = 1}) + local index0 = _let_470_[1] table.insert(indices, ("[" .. tostring(index0) .. "]")) end end @@ -1351,7 +1353,7 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct end doc_special("var", {"name", "val"}, "Introduce new mutable local.") local function kv_3f(t) - local _475_ + local _474_ do local tbl_14_auto = {} local i_15_auto = #tbl_14_auto @@ -1368,9 +1370,9 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct else end end - _475_ = tbl_14_auto + _474_ = tbl_14_auto end - return (_475_)[1] + return (_474_)[1] end SPECIALS.let = function(ast, scope, parent, opts) local bindings = ast[2] @@ -1397,24 +1399,24 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct end end local function disambiguate_3f(rootstr, parent) - local function _480_() - local _479_ = get_prev_line(parent) - if (nil ~= _479_) then - local prev_line = _479_ + local function _479_() + local _478_ = get_prev_line(parent) + if (nil ~= _478_) then + local prev_line = _478_ return prev_line:match("%)$") else return nil end end - return (rootstr:match("^{") or _480_()) + return (rootstr:match("^{") or _479_()) end SPECIALS.tset = function(ast, scope, parent) compiler.assert((3 < #ast), "expected table, key, and value arguments", ast) local root = (compiler.compile1(ast[2], scope, parent, {nval = 1}))[1] local keys = {} for i = 3, (#ast - 1) do - local _let_482_ = compiler.compile1(ast[i], scope, parent, {nval = 1}) - local key = _let_482_[1] + local _let_481_ = compiler.compile1(ast[i], scope, parent, {nval = 1}) + local key = _let_481_[1] table.insert(keys, tostring(key)) end local value = (compiler.compile1(ast[#ast], scope, parent, {nval = 1}))[1] @@ -1538,8 +1540,8 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct end local function compile_until(condition, scope, chunk) if condition then - local _let_491_ = compiler.compile1(condition, scope, chunk, {nval = 1}) - local condition_lua = _let_491_[1] + local _let_490_ = compiler.compile1(condition, scope, chunk, {nval = 1}) + local condition_lua = _let_490_[1] return compiler.emit(chunk, ("if %s then break end"):format(tostring(condition_lua)), utils.expr(condition, "expression")) else return nil @@ -1622,10 +1624,10 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct SPECIALS["for"] = for_2a doc_special("for", {"[index start stop step?]", "..."}, "Numeric loop construct.\nEvaluates body once for each value between start and stop (inclusive).", true) local function native_method_call(ast, _scope, _parent, target, args) - local _let_495_ = ast - local _ = _let_495_[1] - local _0 = _let_495_[2] - local method_string = _let_495_[3] + local _let_494_ = ast + local _ = _let_494_[1] + local _0 = _let_494_[2] + local method_string = _let_494_[3] local call_string if ((target.type == "literal") or (target.type == "varg") or (target.type == "expression")) then call_string = "(%s):%s(%s)" @@ -1647,18 +1649,18 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct end local function method_call(ast, scope, parent) compiler.assert((2 < #ast), "expected at least 2 arguments", ast) - local _let_497_ = compiler.compile1(ast[2], scope, parent, {nval = 1}) - local target = _let_497_[1] + local _let_496_ = compiler.compile1(ast[2], scope, parent, {nval = 1}) + local target = _let_496_[1] local args = {} for i = 4, #ast do local subexprs - local _498_ + local _497_ if (i ~= #ast) then - _498_ = 1 + _497_ = 1 else - _498_ = nil + _497_ = nil end - subexprs = compiler.compile1(ast[i], scope, parent, {nval = _498_}) + subexprs = compiler.compile1(ast[i], scope, parent, {nval = _497_}) utils.map(subexprs, tostring, args) end if (utils["string?"](ast[3]) and utils["valid-lua-identifier?"](ast[3])) then @@ -1696,10 +1698,10 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct compiler.assert((#ast == 2), "expected one argument", ast) local f_scope do - local _503_ = compiler["make-scope"](scope) - do end (_503_)["vararg"] = false - _503_["hashfn"] = true - f_scope = _503_ + local _502_ = compiler["make-scope"](scope) + do end (_502_)["vararg"] = false + _502_["hashfn"] = true + f_scope = _502_ end local f_chunk = {} local name = compiler.gensym(scope) @@ -1737,9 +1739,9 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct return utils.expr(name, "sym") end doc_special("hashfn", {"..."}, "Function literal shorthand; args are either $... OR $1, $2, etc.") - local function maybe_short_circuit_protect(ast, i, name, _507_) - local _arg_508_ = _507_ - local mac = _arg_508_["macros"] + local function maybe_short_circuit_protect(ast, i, name, _506_) + local _arg_507_ = _506_ + local mac = _arg_507_["macros"] local call = (utils["list?"](ast) and tostring(ast[1])) if ((("or" == name) or ("and" == name)) and (1 < i) and (mac[call] or ("set" == call) or ("tset" == call) or ("global" == call))) then return utils.list(utils.sym("do"), ast) @@ -1760,40 +1762,40 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct table.insert(operands, tostring(subexprs[1])) end end - local _511_ = #operands - if (_511_ == 0) then - local _513_ + local _510_ = #operands + if (_510_ == 0) then + local _512_ do - local _512_ = zero_arity - compiler.assert(_512_, "Expected more than 0 arguments", ast) - _513_ = _512_ + local _511_ = zero_arity + compiler.assert(_511_, "Expected more than 0 arguments", ast) + _512_ = _511_ end - return utils.expr(_513_, "literal") - elseif (_511_ == 1) then + return utils.expr(_512_, "literal") + elseif (_510_ == 1) then if unary_prefix then return ("(" .. unary_prefix .. padded_op .. operands[1] .. ")") else return operands[1] end elseif true then - local _ = _511_ + local _ = _510_ return ("(" .. table.concat(operands, padded_op) .. ")") else return nil end end local function define_arithmetic_special(name, zero_arity, unary_prefix, _3flua_name) - local _519_ + local _518_ do - local _516_ = (_3flua_name or name) - local _517_ = zero_arity - local _518_ = unary_prefix - local function _520_(...) - return arithmetic_special(_516_, _517_, _518_, ...) + local _515_ = (_3flua_name or name) + local _516_ = zero_arity + local _517_ = unary_prefix + local function _519_(...) + return arithmetic_special(_515_, _516_, _517_, ...) end - _519_ = _520_ + _518_ = _519_ end - SPECIALS[name] = _519_ + SPECIALS[name] = _518_ return doc_special(name, {"a", "b", "..."}, "Arithmetic operator; works the same as Lua but accepts more arguments.") end define_arithmetic_special("+", "0") @@ -1822,13 +1824,13 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct local prefixed_lib_name = ("bit." .. lib_name) for i = 2, len do local subexprs - local _521_ + local _520_ if (i ~= len) then - _521_ = 1 + _520_ = 1 else - _521_ = nil + _520_ = nil end - subexprs = compiler.compile1(ast[i], scope, parent, {nval = _521_}) + subexprs = compiler.compile1(ast[i], scope, parent, {nval = _520_}) utils.map(subexprs, tostring, operands) end if (#operands == 1) then @@ -1847,18 +1849,18 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct end end local function define_bitop_special(name, zero_arity, unary_prefix, native) - local _531_ + local _530_ do - local _527_ = native - local _528_ = name - local _529_ = zero_arity - local _530_ = unary_prefix - local function _532_(...) - return bitop_special(_527_, _528_, _529_, _530_, ...) + local _526_ = native + local _527_ = name + local _528_ = zero_arity + local _529_ = unary_prefix + local function _531_(...) + return bitop_special(_526_, _527_, _528_, _529_, ...) end - _531_ = _532_ + _530_ = _531_ end - SPECIALS[name] = _531_ + SPECIALS[name] = _530_ return nil end define_bitop_special("lshift", nil, "1", "<<") @@ -1872,15 +1874,15 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct doc_special("bor", {"x1", "x2", "..."}, "Bitwise OR of any number of arguments.\nOnly works in Lua 5.3+ or LuaJIT with the --use-bit-lib flag.") doc_special("bxor", {"x1", "x2", "..."}, "Bitwise XOR of any number of arguments.\nOnly works in Lua 5.3+ or LuaJIT with the --use-bit-lib flag.") doc_special("..", {"a", "b", "..."}, "String concatenation operator; works the same as Lua but accepts more arguments.") - local function native_comparator(op, _533_, scope, parent) - local _arg_534_ = _533_ - local _ = _arg_534_[1] - local lhs_ast = _arg_534_[2] - local rhs_ast = _arg_534_[3] - local _let_535_ = compiler.compile1(lhs_ast, scope, parent, {nval = 1}) - local lhs = _let_535_[1] - local _let_536_ = compiler.compile1(rhs_ast, scope, parent, {nval = 1}) - local rhs = _let_536_[1] + local function native_comparator(op, _532_, scope, parent) + local _arg_533_ = _532_ + local _ = _arg_533_[1] + local lhs_ast = _arg_533_[2] + local rhs_ast = _arg_533_[3] + local _let_534_ = compiler.compile1(lhs_ast, scope, parent, {nval = 1}) + local lhs = _let_534_[1] + local _let_535_ = compiler.compile1(rhs_ast, scope, parent, {nval = 1}) + local rhs = _let_535_[1] return string.format("(%s %s %s)", tostring(lhs), op, tostring(rhs)) end local function double_eval_protected_comparator(op, chain_op, ast, scope, parent) @@ -1956,21 +1958,21 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct end local safe_require = nil local function safe_compiler_env() - local _540_ + local _539_ do - local _539_ = rawget(_G, "utf8") - if (nil ~= _539_) then - _540_ = utils.copy(_539_) + local _538_ = rawget(_G, "utf8") + if (nil ~= _538_) then + _539_ = utils.copy(_538_) else - _540_ = _539_ + _539_ = _538_ end end - return {table = utils.copy(table), math = utils.copy(math), string = utils.copy(string), pairs = pairs, ipairs = ipairs, select = select, tostring = tostring, tonumber = tonumber, bit = rawget(_G, "bit"), pcall = pcall, xpcall = xpcall, next = next, print = print, type = type, assert = assert, error = error, setmetatable = setmetatable, getmetatable = safe_getmetatable, require = safe_require, rawlen = rawget(_G, "rawlen"), rawget = rawget, rawset = rawset, rawequal = rawequal, _VERSION = _VERSION, utf8 = _540_} + return {table = utils.copy(table), math = utils.copy(math), string = utils.copy(string), pairs = pairs, ipairs = ipairs, select = select, tostring = tostring, tonumber = tonumber, bit = rawget(_G, "bit"), pcall = pcall, xpcall = xpcall, next = next, print = print, type = type, assert = assert, error = error, setmetatable = setmetatable, getmetatable = safe_getmetatable, require = safe_require, rawlen = rawget(_G, "rawlen"), rawget = rawget, rawset = rawset, rawequal = rawequal, _VERSION = _VERSION, utf8 = _539_} end local function combined_mt_pairs(env) local combined = {} - local _let_542_ = getmetatable(env) - local __index = _let_542_["__index"] + local _let_541_ = getmetatable(env) + local __index = _let_541_["__index"] if ("table" == type(__index)) then for k, v in pairs(__index) do combined[k] = v @@ -1985,42 +1987,42 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct local function make_compiler_env(ast, scope, parent, _3fopts) local provided do - local _544_ = (_3fopts or utils.root.options) - if ((_G.type(_544_) == "table") and ((_544_)["compiler-env"] == "strict")) then + local _543_ = (_3fopts or utils.root.options) + if ((_G.type(_543_) == "table") and ((_543_)["compiler-env"] == "strict")) then provided = safe_compiler_env() - elseif ((_G.type(_544_) == "table") and (nil ~= (_544_).compilerEnv)) then - local compilerEnv = (_544_).compilerEnv + elseif ((_G.type(_543_) == "table") and (nil ~= (_543_).compilerEnv)) then + local compilerEnv = (_543_).compilerEnv provided = compilerEnv - elseif ((_G.type(_544_) == "table") and (nil ~= (_544_)["compiler-env"])) then - local compiler_env = (_544_)["compiler-env"] + elseif ((_G.type(_543_) == "table") and (nil ~= (_543_)["compiler-env"])) then + local compiler_env = (_543_)["compiler-env"] provided = compiler_env elseif true then - local _ = _544_ + local _ = _543_ provided = safe_compiler_env(false) else provided = nil end end local env - local function _546_(base) + local function _545_(base) return utils.sym(compiler.gensym((compiler.scopes.macro or scope), base)) end - local function _547_() + local function _546_() return compiler.scopes.macro end - local function _548_(symbol) + local function _547_(symbol) compiler.assert(compiler.scopes.macro, "must call from macro", ast) return compiler.scopes.macro.manglings[tostring(symbol)] end - local function _549_(form) + local function _548_(form) compiler.assert(compiler.scopes.macro, "must call from macro", ast) return compiler.macroexpand(form, compiler.scopes.macro) end - env = {_AST = ast, _CHUNK = parent, _IS_COMPILER = true, _SCOPE = scope, _SPECIALS = compiler.scopes.global.specials, _VARARG = utils.varg(), ["macro-loaded"] = macro_loaded, unpack = unpack, ["assert-compile"] = compiler.assert, view = view, version = utils.version, metadata = compiler.metadata, ["ast-source"] = utils["ast-source"], list = utils.list, ["list?"] = utils["list?"], ["table?"] = utils["table?"], sequence = utils.sequence, ["sequence?"] = utils["sequence?"], sym = utils.sym, ["sym?"] = utils["sym?"], ["multi-sym?"] = utils["multi-sym?"], comment = utils.comment, ["comment?"] = utils["comment?"], ["varg?"] = utils["varg?"], gensym = _546_, ["get-scope"] = _547_, ["in-scope?"] = _548_, macroexpand = _549_} + env = {_AST = ast, _CHUNK = parent, _IS_COMPILER = true, _SCOPE = scope, _SPECIALS = compiler.scopes.global.specials, _VARARG = utils.varg(), ["macro-loaded"] = macro_loaded, unpack = unpack, ["assert-compile"] = compiler.assert, view = view, version = utils.version, metadata = compiler.metadata, ["ast-source"] = utils["ast-source"], list = utils.list, ["list?"] = utils["list?"], ["table?"] = utils["table?"], sequence = utils.sequence, ["sequence?"] = utils["sequence?"], sym = utils.sym, ["sym?"] = utils["sym?"], ["multi-sym?"] = utils["multi-sym?"], comment = utils.comment, ["comment?"] = utils["comment?"], ["varg?"] = utils["varg?"], gensym = _545_, ["get-scope"] = _546_, ["in-scope?"] = _547_, macroexpand = _548_} env._G = env return setmetatable(env, {__index = provided, __newindex = provided, __pairs = combined_mt_pairs}) end - local function _551_(...) + local function _550_(...) local tbl_14_auto = {} local i_15_auto = #tbl_14_auto for c in string.gmatch((package.config or ""), "([^\n]+)") do @@ -2033,10 +2035,10 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct end return tbl_14_auto end - local _local_550_ = _551_(...) - local dirsep = _local_550_[1] - local pathsep = _local_550_[2] - local pathmark = _local_550_[3] + local _local_549_ = _550_(...) + local dirsep = _local_549_[1] + local pathsep = _local_549_[2] + local pathmark = _local_549_[3] local pkg_config = {dirsep = (dirsep or "/"), pathmark = (pathmark or ";"), pathsep = (pathsep or "?")} local function escapepat(str) return string.gsub(str, "[^%w]", "%%%1") @@ -2049,40 +2051,40 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct local function try_path(path) local filename = path:gsub(escapepat(pkg_config.pathmark), no_dot_module) local filename2 = path:gsub(escapepat(pkg_config.pathmark), modulename) - local _553_ = (io.open(filename) or io.open(filename2)) - if (nil ~= _553_) then - local file = _553_ + local _552_ = (io.open(filename) or io.open(filename2)) + if (nil ~= _552_) then + local file = _552_ file:close() return filename elseif true then - local _ = _553_ + local _ = _552_ return nil, ("no file '" .. filename .. "'") else return nil end end local function find_in_path(start, _3ftried_paths) - local _555_ = fullpath:match(pattern, start) - if (nil ~= _555_) then - local path = _555_ - local _556_, _557_ = try_path(path) - if (nil ~= _556_) then - local filename = _556_ + local _554_ = fullpath:match(pattern, start) + if (nil ~= _554_) then + local path = _554_ + local _555_, _556_ = try_path(path) + if (nil ~= _555_) then + local filename = _555_ return filename - elseif ((_556_ == nil) and (nil ~= _557_)) then - local error = _557_ - local function _559_() - local _558_ = (_3ftried_paths or {}) - table.insert(_558_, error) - return _558_ + elseif ((_555_ == nil) and (nil ~= _556_)) then + local error = _556_ + local function _558_() + local _557_ = (_3ftried_paths or {}) + table.insert(_557_, error) + return _557_ end - return find_in_path((start + #path + 1), _559_()) + return find_in_path((start + #path + 1), _558_()) else return nil end elseif true then - local _ = _555_ - local function _561_() + local _ = _554_ + local function _560_() local tried_paths = table.concat((_3ftried_paths or {}), "\n\9") if (_VERSION < "Lua 5.4") then return ("\n\9" .. tried_paths) @@ -2090,7 +2092,7 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct return tried_paths end end - return nil, _561_() + return nil, _560_() else return nil end @@ -2098,33 +2100,33 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct return find_in_path(1) end local function make_searcher(_3foptions) - local function _564_(module_name) + local function _563_(module_name) local opts = utils.copy(utils.root.options) for k, v in pairs((_3foptions or {})) do opts[k] = v end opts["module-name"] = module_name - local _565_, _566_ = search_module(module_name) - if (nil ~= _565_) then - local filename = _565_ - local _569_ + local _564_, _565_ = search_module(module_name) + if (nil ~= _564_) then + local filename = _564_ + local _568_ do - local _567_ = filename - local _568_ = opts - local function _570_(...) - return utils["fennel-module"].dofile(_567_, _568_, ...) + local _566_ = filename + local _567_ = opts + local function _569_(...) + return utils["fennel-module"].dofile(_566_, _567_, ...) end - _569_ = _570_ + _568_ = _569_ end - return _569_, filename - elseif ((_565_ == nil) and (nil ~= _566_)) then - local error = _566_ + return _568_, filename + elseif ((_564_ == nil) and (nil ~= _565_)) then + local error = _565_ return error else return nil end end - return _564_ + return _563_ end local function dofile_with_searcher(fennel_macro_searcher, filename, opts, ...) local searchers = (package.loaders or package.searchers or {}) @@ -2136,42 +2138,42 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct local function fennel_macro_searcher(module_name) local opts do - local _572_ = utils.copy(utils.root.options) - do end (_572_)["module-name"] = module_name - _572_["env"] = "_COMPILER" - _572_["requireAsInclude"] = false - _572_["allowedGlobals"] = nil - opts = _572_ + local _571_ = utils.copy(utils.root.options) + do end (_571_)["module-name"] = module_name + _571_["env"] = "_COMPILER" + _571_["requireAsInclude"] = false + _571_["allowedGlobals"] = nil + opts = _571_ end - local _573_ = search_module(module_name, utils["fennel-module"]["macro-path"]) - if (nil ~= _573_) then - local filename = _573_ - local _574_ + local _572_ = search_module(module_name, utils["fennel-module"]["macro-path"]) + if (nil ~= _572_) then + local filename = _572_ + local _573_ if (opts["compiler-env"] == _G) then - local _575_ = fennel_macro_searcher - local _576_ = filename - local _577_ = opts - local function _579_(...) - return dofile_with_searcher(_575_, _576_, _577_, ...) + local _574_ = fennel_macro_searcher + local _575_ = filename + local _576_ = opts + local function _578_(...) + return dofile_with_searcher(_574_, _575_, _576_, ...) end - _574_ = _579_ + _573_ = _578_ else - local _580_ = filename - local _581_ = opts - local function _583_(...) - return utils["fennel-module"].dofile(_580_, _581_, ...) + local _579_ = filename + local _580_ = opts + local function _582_(...) + return utils["fennel-module"].dofile(_579_, _580_, ...) end - _574_ = _583_ + _573_ = _582_ end - return _574_, filename + return _573_, filename else return nil end end local function lua_macro_searcher(module_name) - local _586_ = search_module(module_name, package.path) - if (nil ~= _586_) then - local filename = _586_ + local _585_ = search_module(module_name, package.path) + if (nil ~= _585_) then + local filename = _585_ local code do local f = io.open(filename) @@ -2183,10 +2185,10 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct return error(..., 0) end end - local function _588_() + local function _587_() return assert(f:read("*a")) end - code = close_handlers_8_auto(_G.xpcall(_588_, (package.loaded.fennel or debug).traceback)) + code = close_handlers_8_auto(_G.xpcall(_587_, (package.loaded.fennel or debug).traceback)) end local chunk = load_code(code, make_compiler_env(), filename) return chunk, filename @@ -2196,16 +2198,16 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct end local macro_searchers = {fennel_macro_searcher, lua_macro_searcher} local function search_macro_module(modname, n) - local _590_ = macro_searchers[n] - if (nil ~= _590_) then - local f = _590_ - local _591_, _592_ = f(modname) - if ((nil ~= _591_) and true) then - local loader = _591_ - local _3ffilename = _592_ + local _589_ = macro_searchers[n] + if (nil ~= _589_) then + local f = _589_ + local _590_, _591_ = f(modname) + if ((nil ~= _590_) and true) then + local loader = _590_ + local _3ffilename = _591_ return loader, _3ffilename elseif true then - local _ = _591_ + local _ = _590_ return search_macro_module(modname, (n + 1)) else return nil @@ -2221,16 +2223,16 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct return nil end end - local function _596_(modname) - local function _597_() + local function _595_(modname) + local function _596_() local loader, filename = search_macro_module(modname, 1) compiler.assert(loader, (modname .. " module not found.")) do end (macro_loaded)[modname] = loader(modname, filename) return macro_loaded[modname] end - return (macro_loaded[modname] or sandbox_fennel_module(modname) or _597_()) + return (macro_loaded[modname] or sandbox_fennel_module(modname) or _596_()) end - safe_require = _596_ + safe_require = _595_ local function add_macros(macros_2a, ast, scope) compiler.assert(utils["table?"](macros_2a), "expected macros to be table", ast) for k, v in pairs(macros_2a) do @@ -2240,10 +2242,10 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct end return nil end - local function resolve_module_name(_598_, _scope, _parent, opts) - local _arg_599_ = _598_ - local filename = _arg_599_["filename"] - local second = _arg_599_[2] + local function resolve_module_name(_597_, _scope, _parent, opts) + local _arg_598_ = _597_ + local filename = _arg_598_["filename"] + local second = _arg_598_[2] local filename0 = (filename or (utils["table?"](second) and second.filename)) local module_name = utils.root.options["module-name"] local modexpr = compiler.compile(second, opts) @@ -2302,10 +2304,10 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct return error(..., 0) end end - local function _605_() + local function _604_() return assert(f:read("*all")):gsub("[\13\n]*$", "") end - src = close_handlers_8_auto(_G.xpcall(_605_, (package.loaded.fennel or debug).traceback)) + src = close_handlers_8_auto(_G.xpcall(_604_, (package.loaded.fennel or debug).traceback)) end local ret = utils.expr(("require(\"" .. mod .. "\")"), "statement") local target = ("package.preload[%q]"):format(mod) @@ -2337,12 +2339,12 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct compiler.assert((#ast == 2), "expected one argument", ast) local modexpr do - local _608_, _609_ = pcall(resolve_module_name, ast, scope, parent, opts) - if ((_608_ == true) and (nil ~= _609_)) then - local modname = _609_ + local _607_, _608_ = pcall(resolve_module_name, ast, scope, parent, opts) + if ((_607_ == true) and (nil ~= _608_)) then + local modname = _608_ modexpr = utils.expr(string.format("%q", modname), "literal") elseif true then - local _ = _608_ + local _ = _607_ modexpr = (compiler.compile1(ast[2], scope, parent, {nval = 1}))[1] else modexpr = nil @@ -2361,13 +2363,13 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct utils.root.options["module-name"] = mod _ = nil local res - local function _613_() - local _612_ = search_module(mod) - if (nil ~= _612_) then - local fennel_path = _612_ + local function _612_() + local _611_ = search_module(mod) + if (nil ~= _611_) then + local fennel_path = _611_ return include_path(ast, opts, fennel_path, mod, true) elseif true then - local _0 = _612_ + local _0 = _611_ local lua_path = search_module(mod, package.path) if lua_path then return include_path(ast, opts, lua_path, mod, false) @@ -2380,7 +2382,7 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct return nil end end - res = ((utils["member?"](mod, (utils.root.options.skipInclude or {})) and opts.fallback(modexpr, true)) or include_circular_fallback(mod, modexpr, opts.fallback, ast) or utils.root.scope.includes[mod] or _613_()) + res = ((utils["member?"](mod, (utils.root.options.skipInclude or {})) and opts.fallback(modexpr, true)) or include_circular_fallback(mod, modexpr, opts.fallback, ast) or utils.root.scope.includes[mod] or _612_()) utils.root.options["module-name"] = oldmod return res end @@ -2883,14 +2885,13 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct local line = _arg_317_["line"] local bytestart = _arg_317_["bytestart"] local byteend = _arg_317_["byteend"] - if ("table" == type(node)) then + do local src = utils["ast-source"](node) - if (filename ~= src.filename) then + if (("table" == type(node)) and (filename ~= src.filename)) then src.filename, src.line, src["from-macro?"] = filename, line, true src.bytestart, src.byteend = bytestart, byteend else end - else end return ("table" == type(node)) end @@ -2907,8 +2908,8 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct local function quote_literal_nils(index, node, parent) if (parent and utils["list?"](parent)) then for i = 1, max_n(parent) do - local _321_ = parent[i] - if (_321_ == nil) then + local _320_ = parent[i] + if (_320_ == nil) then parent[i] = utils.sym("nil") else end @@ -2918,10 +2919,10 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct return index, node, parent end local function comp(f, g) - local function _324_(...) + local function _323_(...) return f(g(...)) end - return _324_ + return _323_ end local function built_in_3f(m) local found_3f = false @@ -2932,41 +2933,41 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct return found_3f end local function macroexpand_2a(ast, scope, _3fonce) - local _325_ + local _324_ if utils["list?"](ast) then - _325_ = find_macro(ast, scope) + _324_ = find_macro(ast, scope) else - _325_ = nil + _324_ = nil end - if (_325_ == false) then + if (_324_ == false) then return ast - elseif (nil ~= _325_) then - local macro_2a = _325_ + elseif (nil ~= _324_) then + local macro_2a = _324_ local old_scope = scopes.macro local _ scopes.macro = scope _ = nil local ok, transformed = nil, nil - local function _327_() + local function _326_() return macro_2a(unpack(ast, 2)) end - local function _328_() + local function _327_() if built_in_3f(macro_2a) then return tostring else return debug.traceback end end - ok, transformed = xpcall(_327_, _328_()) - local _330_ + ok, transformed = xpcall(_326_, _327_()) + local _329_ do - local _329_ = ast - local function _331_(...) - return propagate_trace_info(_329_, ...) + local _328_ = ast + local function _330_(...) + return propagate_trace_info(_328_, ...) end - _330_ = _331_ + _329_ = _330_ end - utils["walk-tree"](transformed, comp(_330_, quote_literal_nils)) + utils["walk-tree"](transformed, comp(_329_, quote_literal_nils)) scopes.macro = old_scope assert_compile(ok, transformed, ast) if (_3fonce or not transformed) then @@ -2975,7 +2976,7 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct return macroexpand_2a(transformed, scope) end elseif true then - local _ = _325_ + local _ = _324_ return ast else return nil @@ -3009,14 +3010,14 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct assert_compile((utils["sym?"](ast[1]) or utils["list?"](ast[1]) or ("string" == type(ast[1]))), ("cannot call literal value " .. tostring(ast[1])), ast) for i = 2, len do local subexprs - local _337_ + local _336_ if (i ~= len) then - _337_ = 1 + _336_ = 1 else - _337_ = nil + _336_ = nil end - subexprs = compile1(ast[i], scope, parent, {nval = _337_}) - table.insert(fargs, (subexprs[1] or utils.expr("nil", "literal"))) + subexprs = compile1(ast[i], scope, parent, {nval = _336_}) + table.insert(fargs, subexprs[1]) if (i == len) then for j = 2, #subexprs do table.insert(fargs, subexprs[j]) @@ -3053,13 +3054,13 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct end end local function compile_varg(ast, scope, parent, opts) - local _342_ + local _341_ if scope.hashfn then - _342_ = "use $... in hashfn" + _341_ = "use $... in hashfn" else - _342_ = "unexpected vararg" + _341_ = "unexpected vararg" end - assert_compile(scope.vararg, _342_, ast) + assert_compile(scope.vararg, _341_, ast) return handle_compile_opts({utils.expr("...", "varg")}, parent, opts, ast) end local function compile_sym(ast, scope, parent, opts) @@ -3074,20 +3075,20 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct return handle_compile_opts({e}, parent, opts, ast) end local function serialize_number(n) - local _345_ = string.gsub(tostring(n), ",", ".") - return _345_ + local _344_ = string.gsub(tostring(n), ",", ".") + return _344_ end local function compile_scalar(ast, _scope, parent, opts) local serialize do - local _346_ = type(ast) - if (_346_ == "nil") then + local _345_ = type(ast) + if (_345_ == "nil") then serialize = tostring - elseif (_346_ == "boolean") then + elseif (_345_ == "boolean") then serialize = tostring - elseif (_346_ == "string") then + elseif (_345_ == "string") then serialize = serialize_string - elseif (_346_ == "number") then + elseif (_345_ == "number") then serialize = serialize_number else serialize = nil @@ -3102,8 +3103,8 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct if ((type(k) == "string") and utils["valid-lua-identifier?"](k)) then return {k, k} else - local _let_348_ = compile1(k, scope, parent, {nval = 1}) - local compiled = _let_348_[1] + local _let_347_ = compile1(k, scope, parent, {nval = 1}) + local compiled = _let_347_[1] local kstr = ("[" .. tostring(compiled) .. "]") return {kstr, k} end @@ -3126,15 +3127,15 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct end keys = tbl_14_auto end - local function _354_(_352_) - local _arg_353_ = _352_ - local k1 = _arg_353_[1] - local k2 = _arg_353_[2] - local _let_355_ = compile1(ast[k2], scope, parent, {nval = 1}) - local v = _let_355_[1] + local function _353_(_351_) + local _arg_352_ = _351_ + local k1 = _arg_352_[1] + local k2 = _arg_352_[2] + local _let_354_ = compile1(ast[k2], scope, parent, {nval = 1}) + local v = _let_354_[1] return string.format("%s = %s", k1, tostring(v)) end - utils.map(keys, _354_, buffer) + utils.map(keys, _353_, buffer) end for i = 1, #ast do local nval = ((i ~= #ast) and 1) @@ -3161,12 +3162,12 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct end local function destructure(to, from, ast, scope, parent, opts) local opts0 = (opts or {}) - local _let_357_ = opts0 - local isvar = _let_357_["isvar"] - local declaration = _let_357_["declaration"] - local forceglobal = _let_357_["forceglobal"] - local forceset = _let_357_["forceset"] - local symtype = _let_357_["symtype"] + local _let_356_ = opts0 + local isvar = _let_356_["isvar"] + local declaration = _let_356_["declaration"] + local forceglobal = _let_356_["forceglobal"] + local forceset = _let_356_["forceset"] + local symtype = _let_356_["symtype"] local symtype0 = ("_" .. (symtype or "dst")) local setter if declaration then @@ -3205,14 +3206,14 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct end local function compile_top_target(lvalues) local inits - local function _363_(_241) + local function _362_(_241) if scope.manglings[_241] then return _241 else return "nil" end end - inits = utils.map(lvalues, _363_) + inits = utils.map(lvalues, _362_) local init = table.concat(inits, ", ") local lvalue = table.concat(lvalues, ", ") local plast = parent[#parent] @@ -3254,7 +3255,7 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct local unpack_fn = "function (t, k, e)\n local mt = getmetatable(t)\n if 'table' == type(mt) and mt.__fennelrest then\n return mt.__fennelrest(t, k)\n elseif e then\n local rest = {}\n for k, v in pairs(t) do\n if not e[k] then rest[k] = v end\n end\n return rest\n else\n return {(table.unpack or unpack)(t, k)}\n end\n end" local function destructure_kv_rest(s, v, left, excluded_keys, destructure1) local exclude_str - local _370_ + local _369_ do local tbl_14_auto = {} local i_15_auto = #tbl_14_auto @@ -3266,9 +3267,9 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct else end end - _370_ = tbl_14_auto + _369_ = tbl_14_auto end - exclude_str = table.concat(_370_, ", ") + exclude_str = table.concat(_369_, ", ") local subexpr = utils.expr(string.format(string.gsub(("(" .. unpack_fn .. ")(%s, %s, {%s})"), "\n%s*", " "), s, tostring(v), exclude_str), "expression") return destructure1(v, {subexpr}, left) end @@ -3283,16 +3284,16 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct local s = gensym(scope, symtype0) local right do - local _372_ + local _371_ if top_3f then - _372_ = exprs1(compile1(from, scope, parent)) + _371_ = exprs1(compile1(from, scope, parent)) else - _372_ = exprs1(rightexprs) + _371_ = exprs1(rightexprs) end - if (_372_ == "") then + if (_371_ == "") then right = "nil" - elseif (nil ~= _372_) then - local right0 = _372_ + elseif (nil ~= _371_) then + local right0 = _371_ right = right0 else right = nil @@ -3465,14 +3466,14 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct else end if (info.what == "Lua") then - local function _392_() + local function _391_() if info.name then return ("'" .. info.name .. "'") else return "?" end end - return string.format(" %s:%d: in function %s", info.short_src, info.currentline, _392_()) + return string.format(" %s:%d: in function %s", info.short_src, info.currentline, _391_()) elseif (info.short_src == "(tail call)") then return " (tail call)" else @@ -3496,11 +3497,11 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct local done_3f, level = false, (_3fstart or 2) while not done_3f do do - local _396_ = debug.getinfo(level, "Sln") - if (_396_ == nil) then + local _395_ = debug.getinfo(level, "Sln") + if (_395_ == nil) then done_3f = true - elseif (nil ~= _396_) then - local info = _396_ + elseif (nil ~= _395_) then + local info = _395_ table.insert(lines, traceback_frame(info)) else end @@ -3511,14 +3512,14 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct end end local function entry_transform(fk, fv) - local function _399_(k, v) + local function _398_(k, v) if (type(k) == "number") then return k, fv(v) else return fk(k), fv(v) end end - return _399_ + return _398_ end local function mixed_concat(t, joiner) local seen = {} @@ -3564,10 +3565,10 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct return res[1] elseif utils["list?"](form) then local mapped - local function _404_() + local function _403_() return nil end - mapped = utils.kvmap(form, entry_transform(_404_, q)) + mapped = utils.kvmap(form, entry_transform(_403_, q)) local filename if form.filename then filename = string.format("%q", form.filename) @@ -3585,13 +3586,13 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct else filename = "nil" end - local _407_ + local _406_ if source then - _407_ = source.line + _406_ = source.line else - _407_ = "nil" + _406_ = "nil" end - return string.format("setmetatable({%s}, {filename=%s, line=%s, sequence=%s})", mixed_concat(mapped, ", "), filename, _407_, "(getmetatable(sequence()))['sequence']") + return string.format("setmetatable({%s}, {filename=%s, line=%s, sequence=%s})", mixed_concat(mapped, ", "), filename, _406_, "(getmetatable(sequence()))['sequence']") elseif (type(form) == "table") then local mapped = utils.kvmap(form, entry_transform(q, q)) local source = getmetatable(form) @@ -3601,14 +3602,14 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct else filename = "nil" end - local function _410_() + local function _409_() if source then return source.line else return "nil" end end - return string.format("setmetatable({%s}, {filename=%s, line=%s})", mixed_concat(mapped, ", "), filename, _410_()) + return string.format("setmetatable({%s}, {filename=%s, line=%s})", mixed_concat(mapped, ", "), filename, _409_()) elseif (type(form) == "string") then return serialize_string(form) else @@ -4759,7 +4760,7 @@ package.preload["fennel.view"] = package.preload["fennel.view"] or function(...) end package.preload["fennel.utils"] = package.preload["fennel.utils"] or function(...) local view = require("fennel.view") - local version = "1.2.0-dev" + local version = "1.3.0-dev" local function luajit_vm_3f() return ((nil ~= _G.jit) and (type(_G.jit) == "table") and (nil ~= _G.jit.on) and (nil ~= _G.jit.off) and (type(_G.jit.version_num) == "number")) end @@ -5319,14 +5320,14 @@ package.preload["fennel"] = package.preload["fennel"] or function(...) local env = eval_env(opts.env, opts) local lua_source = compiler["compile-string"](str, opts) local loader - local function _733_(...) + local function _732_(...) if opts.filename then return ("@" .. opts.filename) else return str end end - loader = specials["load-code"](lua_source, env, _733_(...)) + loader = specials["load-code"](lua_source, env, _732_(...)) opts.filename = nil return loader(...) end @@ -5351,10 +5352,10 @@ package.preload["fennel"] = package.preload["fennel"] or function(...) out[k] = {["macro?"] = true, ["body-form?"] = utils["member?"](k, body_3f), ["binding-form?"] = utils["member?"](k, binding_3f), ["define?"] = utils["member?"](k, define_3f)} end for k, v in pairs(_G) do - local _734_ = type(v) - if (_734_ == "function") then + local _733_ = type(v) + if (_733_ == "function") then out[k] = {["global?"] = true, ["function?"] = true} - elseif (_734_ == "table") then + elseif (_733_ == "table") then for k2, v2 in pairs(v) do if (("function" == type(v2)) and (k ~= "_G")) then out[(k .. "." .. k2)] = {["function?"] = true, ["global?"] = true} @@ -5367,7 +5368,7 @@ package.preload["fennel"] = package.preload["fennel"] or function(...) end return out end - local mod = {list = utils.list, ["list?"] = utils["list?"], sym = utils.sym, ["sym?"] = utils["sym?"], sequence = utils.sequence, ["sequence?"] = utils["sequence?"], comment = utils.comment, ["comment?"] = utils["comment?"], varg = utils.varg, ["varg?"] = utils["varg?"], ["sym-char?"] = parser["sym-char?"], parser = parser.parser, compile = compiler.compile, ["compile-string"] = compiler["compile-string"], ["compile-stream"] = compiler["compile-stream"], eval = eval, repl = repl, view = view, dofile = dofile_2a, ["load-code"] = specials["load-code"], doc = specials.doc, metadata = compiler.metadata, traceback = compiler.traceback, version = utils.version, ["runtime-version"] = utils["runtime-version"], ["ast-source"] = utils["ast-source"], path = utils.path, ["macro-path"] = utils["macro-path"], ["macro-loaded"] = specials["macro-loaded"], ["macro-searchers"] = specials["macro-searchers"], ["search-module"] = specials["search-module"], ["make-searcher"] = specials["make-searcher"], searcher = specials["make-searcher"](), syntax = syntax, gensym = compiler.gensym, scope = compiler["make-scope"], mangle = compiler["global-mangling"], unmangle = compiler["global-unmangling"], compile1 = compiler.compile1, ["string-stream"] = parser["string-stream"], granulate = parser.granulate, loadCode = specials["load-code"], make_searcher = specials["make-searcher"], makeSearcher = specials["make-searcher"], searchModule = specials["search-module"], macroPath = utils["macro-path"], macroSearchers = specials["macro-searchers"], macroLoaded = specials["macro-loaded"], compileStream = compiler["compile-stream"], compileString = compiler["compile-string"], stringStream = parser["string-stream"], runtimeVersion = utils["runtime-version"]} + local mod = {list = utils.list, ["list?"] = utils["list?"], sym = utils.sym, ["sym?"] = utils["sym?"], ["multi-sym?"] = utils["multi-sym?"], sequence = utils.sequence, ["sequence?"] = utils["sequence?"], comment = utils.comment, ["comment?"] = utils["comment?"], varg = utils.varg, ["varg?"] = utils["varg?"], ["sym-char?"] = parser["sym-char?"], parser = parser.parser, compile = compiler.compile, ["compile-string"] = compiler["compile-string"], ["compile-stream"] = compiler["compile-stream"], eval = eval, repl = repl, view = view, dofile = dofile_2a, ["load-code"] = specials["load-code"], doc = specials.doc, metadata = compiler.metadata, traceback = compiler.traceback, version = utils.version, ["runtime-version"] = utils["runtime-version"], ["ast-source"] = utils["ast-source"], path = utils.path, ["macro-path"] = utils["macro-path"], ["macro-loaded"] = specials["macro-loaded"], ["macro-searchers"] = specials["macro-searchers"], ["search-module"] = specials["search-module"], ["make-searcher"] = specials["make-searcher"], searcher = specials["make-searcher"](), syntax = syntax, gensym = compiler.gensym, scope = compiler["make-scope"], mangle = compiler["global-mangling"], unmangle = compiler["global-unmangling"], compile1 = compiler.compile1, ["string-stream"] = parser["string-stream"], granulate = parser.granulate, loadCode = specials["load-code"], make_searcher = specials["make-searcher"], makeSearcher = specials["make-searcher"], searchModule = specials["search-module"], macroPath = utils["macro-path"], macroSearchers = specials["macro-searchers"], macroLoaded = specials["macro-loaded"], compileStream = compiler["compile-stream"], compileString = compiler["compile-string"], stringStream = parser["string-stream"], runtimeVersion = utils["runtime-version"]} utils["fennel-module"] = mod do local builtin_macros = [===[;; These macros are awkward because their definition cannot rely on the any @@ -6002,17 +6003,17 @@ package.preload["fennel"] = package.preload["fennel"] or function(...) ]===] local module_name = "fennel.macros" local _ - local function _737_() + local function _736_() return mod end - package.preload[module_name] = _737_ + package.preload[module_name] = _736_ _ = nil local env do - local _738_ = specials["make-compiler-env"](nil, compiler.scopes.compiler, {}) - do end (_738_)["utils"] = utils - _738_["fennel"] = mod - env = _738_ + local _737_ = specials["make-compiler-env"](nil, compiler.scopes.compiler, {}) + do end (_737_)["utils"] = utils + _737_["fennel"] = mod + env = _737_ end local built_ins = eval(builtin_macros, {env = env, scope = compiler.scopes.compiler, allowedGlobals = false, useMetadata = true, filename = "src/fennel/macros.fnl", moduleName = module_name}) for k, v in pairs(built_ins) do @@ -6028,23 +6029,23 @@ local unpack = (table.unpack or _G.unpack) local help = "\nUsage: fennel [FLAG] [FILE]\n\nRun fennel, a lisp programming language for the Lua runtime.\n\n --repl : Command to launch an interactive repl session\n --compile FILES (-c) : Command to AOT compile files, writing Lua to stdout\n --eval SOURCE (-e) : Command to evaluate source code and print the result\n\n --no-searcher : Skip installing package.searchers entry\n --indent VAL : Indent compiler output with VAL\n --add-package-path PATH : Add PATH to package.path for finding Lua modules\n --add-fennel-path PATH : Add PATH to fennel.path for finding Fennel modules\n --add-macro-path PATH : Add PATH to fennel.macro-path for macro modules\n --globals G1[,G2...] : Allow these globals in addition to standard ones\n --globals-only G1[,G2] : Same as above, but exclude standard ones\n --require-as-include : Inline required modules in the output\n --skip-include M1[,M2] : Omit certain modules from output when included\n --use-bit-lib : Use LuaJITs bit library instead of operators\n --metadata : Enable function metadata, even in compiled output\n --no-metadata : Disable function metadata, even in REPL\n --correlate : Make Lua output line numbers match Fennel input\n --load FILE (-l) : Load the specified FILE before executing the command\n --lua LUA_EXE : Run in a child process with LUA_EXE\n --no-fennelrc : Skip loading ~/.fennelrc when launching repl\n --raw-errors : Disable friendly compile error reporting\n --plugin FILE : Activate the compiler plugin in FILE\n --compile-binary FILE\n OUT LUA_LIB LUA_DIR : Compile FILE to standalone binary OUT\n --compile-binary --help : Display further help for compiling binaries\n --no-compiler-sandbox : Do not limit compiler environment to minimal sandbox\n\n --help (-h) : Display this text\n --version (-v) : Show version\n\nGlobals are not checked when doing AOT (ahead-of-time) compilation unless\nthe --globals-only or --globals flag is provided. Use --globals \"*\" to disable\nstrict globals checking in other contexts.\n\nMetadata is typically considered a development feature and is not recommended\nfor production. It is used for docstrings and enabled by default in the REPL.\n\nWhen not given a command, runs the file given as the first argument.\nWhen given neither command nor file, launches a repl.\n\nIf ~/.fennelrc exists, it will be loaded before launching a repl." local options = {plugins = {}} local function pack(...) - local _739_ = {...} - _739_["n"] = select("#", ...) - return _739_ + local _738_ = {...} + _738_["n"] = select("#", ...) + return _738_ end local function dosafely(f, ...) local args = {...} - local _740_ - local function _741_() + local _739_ + local function _740_() return f(unpack(args)) end - _740_ = pack(xpcall(_741_, fennel.traceback)) - if ((_G.type(_740_) == "table") and ((_740_)[1] == true)) then - local all = _740_ + _739_ = pack(xpcall(_740_, fennel.traceback)) + if ((_G.type(_739_) == "table") and ((_739_)[1] == true)) then + local all = _739_ return unpack(all, 2, all.n) - elseif ((_G.type(_740_) == "table") and true and (nil ~= (_740_)[2])) then - local _ = (_740_)[1] - local msg = (_740_)[2] + elseif ((_G.type(_739_) == "table") and true and (nil ~= (_739_)[2])) then + local _ = (_739_)[1] + local msg = (_739_)[2] do end (io.stderr):write((msg .. "\n")) return os.exit(1) else @@ -6088,18 +6089,18 @@ local function handle_lua(i) table.insert(cmd, string.format("%q", arg[i0])) end local ok = os.execute(table.concat(cmd, " ")) - local _745_ + local _744_ if ok then - _745_ = 0 + _744_ = 0 else - _745_ = 1 + _744_ = 1 end - return os.exit(_745_, true) + return os.exit(_744_, true) end assert(arg, "Using the launcher from non-CLI context; use fennel.lua instead.") for i = #arg, 1, -1 do - local _747_ = arg[i] - if (_747_ == "--lua") then + local _746_ = arg[i] + if (_746_ == "--lua") then handle_lua(i) else end @@ -6108,52 +6109,52 @@ do local commands = {["--repl"] = true, ["--compile"] = true, ["-c"] = true, ["--compile-binary"] = true, ["--eval"] = true, ["-e"] = true, ["-v"] = true, ["--version"] = true, ["--help"] = true, ["-h"] = true, ["-"] = true} local i = 1 while (arg[i] and not options["ignore-options"]) do - local _749_ = arg[i] - if (_749_ == "--no-searcher") then + local _748_ = arg[i] + if (_748_ == "--no-searcher") then options["no-searcher"] = true table.remove(arg, i) - elseif (_749_ == "--indent") then + elseif (_748_ == "--indent") then options.indent = table.remove(arg, (i + 1)) if (options.indent == "false") then options.indent = false else end table.remove(arg, i) - elseif (_749_ == "--add-package-path") then + elseif (_748_ == "--add-package-path") then local entry = table.remove(arg, (i + 1)) package.path = (entry .. ";" .. package.path) table.remove(arg, i) - elseif (_749_ == "--add-fennel-path") then + elseif (_748_ == "--add-fennel-path") then local entry = table.remove(arg, (i + 1)) fennel.path = (entry .. ";" .. fennel.path) table.remove(arg, i) - elseif (_749_ == "--add-macro-path") then + elseif (_748_ == "--add-macro-path") then local entry = table.remove(arg, (i + 1)) fennel["macro-path"] = (entry .. ";" .. fennel["macro-path"]) table.remove(arg, i) - elseif (_749_ == "--load") then + elseif (_748_ == "--load") then handle_load(i) - elseif (_749_ == "-l") then + elseif (_748_ == "-l") then handle_load(i) - elseif (_749_ == "--no-fennelrc") then + elseif (_748_ == "--no-fennelrc") then options.fennelrc = false table.remove(arg, i) - elseif (_749_ == "--correlate") then + elseif (_748_ == "--correlate") then options.correlate = true table.remove(arg, i) - elseif (_749_ == "--check-unused-locals") then + elseif (_748_ == "--check-unused-locals") then options.checkUnusedLocals = true table.remove(arg, i) - elseif (_749_ == "--globals") then + elseif (_748_ == "--globals") then allow_globals(table.remove(arg, (i + 1)), _G) table.remove(arg, i) - elseif (_749_ == "--globals-only") then + elseif (_748_ == "--globals-only") then allow_globals(table.remove(arg, (i + 1)), {}) table.remove(arg, i) - elseif (_749_ == "--require-as-include") then + elseif (_748_ == "--require-as-include") then options.requireAsInclude = true table.remove(arg, i) - elseif (_749_ == "--skip-include") then + elseif (_748_ == "--skip-include") then local skip_names = table.remove(arg, (i + 1)) local skip do @@ -6171,28 +6172,28 @@ do end options.skipInclude = skip table.remove(arg, i) - elseif (_749_ == "--use-bit-lib") then + elseif (_748_ == "--use-bit-lib") then options.useBitLib = true table.remove(arg, i) - elseif (_749_ == "--metadata") then + elseif (_748_ == "--metadata") then options.useMetadata = true table.remove(arg, i) - elseif (_749_ == "--no-metadata") then + elseif (_748_ == "--no-metadata") then options.useMetadata = false table.remove(arg, i) - elseif (_749_ == "--no-compiler-sandbox") then + elseif (_748_ == "--no-compiler-sandbox") then options["compiler-env"] = _G table.remove(arg, i) - elseif (_749_ == "--raw-errors") then + elseif (_748_ == "--raw-errors") then options.unfriendly = true table.remove(arg, i) - elseif (_749_ == "--plugin") then + elseif (_748_ == "--plugin") then local opts = {env = "_COMPILER", useMetadata = true, ["compiler-env"] = _G} local plugin = fennel.dofile(table.remove(arg, (i + 1)), opts) table.insert(options.plugins, 1, plugin) table.remove(arg, i) elseif true then - local _ = _749_ + local _ = _748_ if not commands[arg[i]] then options["ignore-options"] = true i = (i + 1) @@ -6247,13 +6248,13 @@ local function repl() return fennel.repl(options) end local function eval(form) - local _759_ + local _758_ if (form == "-") then - _759_ = (io.stdin):read("*a") + _758_ = (io.stdin):read("*a") else - _759_ = form + _758_ = form end - return print(dosafely(fennel.eval, _759_, options)) + return print(dosafely(fennel.eval, _758_, options)) end local function compile(files) for _, filename in ipairs(files) do @@ -6265,17 +6266,17 @@ local function compile(files) f = assert(io.open(filename, "rb")) end do - local _762_, _763_ = nil, nil - local function _764_() + local _761_, _762_ = nil, nil + local function _763_() return fennel["compile-string"](f:read("*a"), options) end - _762_, _763_ = xpcall(_764_, fennel.traceback) - if ((_762_ == true) and (nil ~= _763_)) then - local val = _763_ + _761_, _762_ = xpcall(_763_, fennel.traceback) + if ((_761_ == true) and (nil ~= _762_)) then + local val = _762_ print(val) - elseif (true and (nil ~= _763_)) then - local _0 = _762_ - local msg = _763_ + elseif (true and (nil ~= _762_)) then + local _0 = _761_ + local msg = _762_ do end (io.stderr):write((msg .. "\n")) os.exit(1) else @@ -6285,56 +6286,56 @@ local function compile(files) end return nil end -local _766_ = arg -local function _767_(...) +local _765_ = arg +local function _766_(...) return (0 == #arg) end -if ((_G.type(_766_) == "table") and _767_(...)) then +if ((_G.type(_765_) == "table") and _766_(...)) then return repl() -elseif ((_G.type(_766_) == "table") and ((_766_)[1] == "--repl")) then +elseif ((_G.type(_765_) == "table") and ((_765_)[1] == "--repl")) then return repl() -elseif ((_G.type(_766_) == "table") and ((_766_)[1] == "--compile")) then - local files = {select(2, (table.unpack or _G.unpack)(_766_))} +elseif ((_G.type(_765_) == "table") and ((_765_)[1] == "--compile")) then + local files = {select(2, (table.unpack or _G.unpack)(_765_))} return compile(files) -elseif ((_G.type(_766_) == "table") and ((_766_)[1] == "-c")) then - local files = {select(2, (table.unpack or _G.unpack)(_766_))} +elseif ((_G.type(_765_) == "table") and ((_765_)[1] == "-c")) then + local files = {select(2, (table.unpack or _G.unpack)(_765_))} return compile(files) -elseif ((_G.type(_766_) == "table") and ((_766_)[1] == "--compile-binary") and (nil ~= (_766_)[2]) and (nil ~= (_766_)[3]) and (nil ~= (_766_)[4]) and (nil ~= (_766_)[5])) then - local filename = (_766_)[2] - local out = (_766_)[3] - local static_lua = (_766_)[4] - local lua_include_dir = (_766_)[5] - local args = {select(6, (table.unpack or _G.unpack)(_766_))} +elseif ((_G.type(_765_) == "table") and ((_765_)[1] == "--compile-binary") and (nil ~= (_765_)[2]) and (nil ~= (_765_)[3]) and (nil ~= (_765_)[4]) and (nil ~= (_765_)[5])) then + local filename = (_765_)[2] + local out = (_765_)[3] + local static_lua = (_765_)[4] + local lua_include_dir = (_765_)[5] + local args = {select(6, (table.unpack or _G.unpack)(_765_))} local bin = require("fennel.binary") options.filename = filename options.requireAsInclude = true return bin.compile(filename, out, static_lua, lua_include_dir, options, args) -elseif ((_G.type(_766_) == "table") and ((_766_)[1] == "--compile-binary")) then +elseif ((_G.type(_765_) == "table") and ((_765_)[1] == "--compile-binary")) then return print((require("fennel.binary")).help) -elseif ((_G.type(_766_) == "table") and ((_766_)[1] == "--eval") and (nil ~= (_766_)[2])) then - local form = (_766_)[2] +elseif ((_G.type(_765_) == "table") and ((_765_)[1] == "--eval") and (nil ~= (_765_)[2])) then + local form = (_765_)[2] return eval(form) -elseif ((_G.type(_766_) == "table") and ((_766_)[1] == "-e") and (nil ~= (_766_)[2])) then - local form = (_766_)[2] +elseif ((_G.type(_765_) == "table") and ((_765_)[1] == "-e") and (nil ~= (_765_)[2])) then + local form = (_765_)[2] return eval(form) else - local function _795_(...) - local a = (_766_)[1] + local function _794_(...) + local a = (_765_)[1] return ((a == "-v") or (a == "--version")) end - if (((_G.type(_766_) == "table") and (nil ~= (_766_)[1])) and _795_(...)) then - local a = (_766_)[1] + if (((_G.type(_765_) == "table") and (nil ~= (_765_)[1])) and _794_(...)) then + local a = (_765_)[1] return print(fennel["runtime-version"]()) - elseif ((_G.type(_766_) == "table") and ((_766_)[1] == "--help")) then + elseif ((_G.type(_765_) == "table") and ((_765_)[1] == "--help")) then return print(help) - elseif ((_G.type(_766_) == "table") and ((_766_)[1] == "-h")) then + elseif ((_G.type(_765_) == "table") and ((_765_)[1] == "-h")) then return print(help) - elseif ((_G.type(_766_) == "table") and ((_766_)[1] == "-")) then - local args = {select(2, (table.unpack or _G.unpack)(_766_))} + elseif ((_G.type(_765_) == "table") and ((_765_)[1] == "-")) then + local args = {select(2, (table.unpack or _G.unpack)(_765_))} return dosafely(fennel.eval, (io.stdin):read("*a")) - elseif ((_G.type(_766_) == "table") and (nil ~= (_766_)[1])) then - local filename = (_766_)[1] - local args = {select(2, (table.unpack or _G.unpack)(_766_))} + elseif ((_G.type(_765_) == "table") and (nil ~= (_765_)[1])) then + local filename = (_765_)[1] + local args = {select(2, (table.unpack or _G.unpack)(_765_))} arg[-2] = arg[-1] arg[-1] = arg[0] arg[0] = table.remove(arg, 1) diff --git a/src/fennel.lua b/src/fennel.lua index b679d84..29ed331 100644 --- a/src/fennel.lua +++ b/src/fennel.lua @@ -6,14 +6,14 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) local view = require("fennel.view") local unpack = (table.unpack or _G.unpack) local function default_read_chunk(parser_state) - local function _617_() + local function _616_() if (0 < parser_state["stack-size"]) then return ".." else return ">> " end end - io.write(_617_()) + io.write(_616_()) io.flush() local input = io.read() return (input and (input .. "\n")) @@ -23,20 +23,20 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) return io.write("\n") end local function default_on_error(errtype, err, lua_source) - local function _619_() - local _618_ = errtype - if (_618_ == "Lua Compile") then + local function _618_() + local _617_ = errtype + if (_617_ == "Lua Compile") then return ("Bad code generated - likely a bug with the compiler:\n" .. "--- Generated Lua Start ---\n" .. lua_source .. "--- Generated Lua End ---\n") - elseif (_618_ == "Runtime") then + elseif (_617_ == "Runtime") then return (compiler.traceback(tostring(err), 4) .. "\n") elseif true then - local _ = _618_ + local _ = _617_ return ("%s error: %s\n"):format(errtype, tostring(err)) else return nil end end - return io.write(_619_()) + return io.write(_618_()) end local save_source = table.concat({"local ___i___ = 1", "while true do", " local name, value = debug.getlocal(1, ___i___)", " if(name and name ~= \"___i___\") then", " ___replLocals___[name] = value", " ___i___ = ___i___ + 1", " else break end end"}, "\n") local function splice_save_locals(env, lua_source) @@ -64,14 +64,14 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) local scope_first_3f = ((tbl == env) or (tbl == env.___replLocals___)) local tbl_14_auto = matches local i_15_auto = #tbl_14_auto - local function _622_() + local function _621_() if scope_first_3f then return scope.manglings else return tbl end end - for k, is_mangled in utils.allpairs(_622_()) do + for k, is_mangled in utils.allpairs(_621_()) do if (max_items <= #matches) then break end local val_16_auto do @@ -142,7 +142,7 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) return input:match("^%s*,") end local function command_docs() - local _631_ + local _630_ do local tbl_14_auto = {} local i_15_auto = #tbl_14_auto @@ -154,18 +154,18 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) else end end - _631_ = tbl_14_auto + _630_ = tbl_14_auto end - return table.concat(_631_, "\n") + return table.concat(_630_, "\n") end commands.help = function(_, _0, on_values) return on_values({("Welcome to Fennel.\nThis is the REPL where you can enter code to be evaluated.\nYou can also run these repl commands:\n\n" .. command_docs() .. "\n ,exit - Leave the repl.\n\nUse ,doc something to see descriptions for individual macros and special forms.\n\nFor more information about the language, see https://fennel-lang.org/reference")}) end do end (compiler.metadata):set(commands.help, "fnl/docstring", "Show this message.") local function reload(module_name, env, on_values, on_error) - local _633_, _634_ = pcall(specials["load-code"]("return require(...)", env), module_name) - if ((_633_ == true) and (nil ~= _634_)) then - local old = _634_ + local _632_, _633_ = pcall(specials["load-code"]("return require(...)", env), module_name) + if ((_632_ == true) and (nil ~= _633_)) then + local old = _633_ local _ package.loaded[module_name] = nil _ = nil @@ -192,38 +192,38 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) else end return on_values({"ok"}) - elseif ((_633_ == false) and (nil ~= _634_)) then - local msg = _634_ + elseif ((_632_ == false) and (nil ~= _633_)) then + local msg = _633_ if (specials["macro-loaded"])[module_name] then specials["macro-loaded"][module_name] = nil return nil else - local function _639_() - local _638_ = msg:gsub("\n.*", "") - return _638_ + local function _638_() + local _637_ = msg:gsub("\n.*", "") + return _637_ end - return on_error("Runtime", _639_()) + return on_error("Runtime", _638_()) end else return nil end end local function run_command(read, on_error, f) - local _642_, _643_, _644_ = pcall(read) - if ((_642_ == true) and (_643_ == true) and (nil ~= _644_)) then - local val = _644_ + local _641_, _642_, _643_ = pcall(read) + if ((_641_ == true) and (_642_ == true) and (nil ~= _643_)) then + local val = _643_ return f(val) - elseif (_642_ == false) then + elseif (_641_ == false) then return on_error("Parse", "Couldn't parse input.") else return nil end end commands.reload = function(env, read, on_values, on_error) - local function _646_(_241) + local function _645_(_241) return reload(tostring(_241), env, on_values, on_error) end - return run_command(read, on_error, _646_) + return run_command(read, on_error, _645_) end do end (compiler.metadata):set(commands.reload, "fnl/docstring", "Reload the specified module.") commands.reset = function(env, _, on_values) @@ -232,30 +232,30 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) end do end (compiler.metadata):set(commands.reset, "fnl/docstring", "Erase all repl-local scope.") commands.complete = function(env, read, on_values, on_error, scope, chars) - local function _647_() + local function _646_() return on_values(completer(env, scope, string.char(unpack(chars)):gsub(",complete +", ""):sub(1, -2))) end - return run_command(read, on_error, _647_) + return run_command(read, on_error, _646_) end do end (compiler.metadata):set(commands.complete, "fnl/docstring", "Print all possible completions for a given input symbol.") local function apropos_2a(pattern, tbl, prefix, seen, names) for name, subtbl in pairs(tbl) do if (("string" == type(name)) and (package ~= subtbl)) then - local _648_ = type(subtbl) - if (_648_ == "function") then + local _647_ = type(subtbl) + if (_647_ == "function") then if ((prefix .. name)):match(pattern) then table.insert(names, (prefix .. name)) else end - elseif (_648_ == "table") then + elseif (_647_ == "table") then if not seen[subtbl] then - local _651_ + local _650_ do - local _650_ = seen - _650_[subtbl] = true - _651_ = _650_ + local _649_ = seen + _649_[subtbl] = true + _650_ = _649_ end - apropos_2a(pattern, subtbl, (prefix .. name:gsub("%.", "/") .. "."), _651_, names) + apropos_2a(pattern, subtbl, (prefix .. name:gsub("%.", "/") .. "."), _650_, names) else end else @@ -280,10 +280,10 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) return tbl_14_auto end commands.apropos = function(_env, read, on_values, on_error, _scope) - local function _656_(_241) + local function _655_(_241) return on_values(apropos(tostring(_241))) end - return run_command(read, on_error, _656_) + return run_command(read, on_error, _655_) end do end (compiler.metadata):set(commands.apropos, "fnl/docstring", "Print all functions matching a pattern in all loaded modules.") local function apropos_follow_path(path) @@ -304,12 +304,12 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) local tgt = package.loaded for _, path0 in ipairs(paths) do if (nil == tgt) then break end - local _659_ + local _658_ do - local _658_ = path0:gsub("%/", ".") - _659_ = _658_ + local _657_ = path0:gsub("%/", ".") + _658_ = _657_ end - tgt = tgt[_659_] + tgt = tgt[_658_] end return tgt end @@ -321,9 +321,9 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) do local tgt = apropos_follow_path(path) if ("function" == type(tgt)) then - local _660_ = (compiler.metadata):get(tgt, "fnl/docstring") - if (nil ~= _660_) then - local docstr = _660_ + local _659_ = (compiler.metadata):get(tgt, "fnl/docstring") + if (nil ~= _659_) then + local docstr = _659_ val_16_auto = (docstr:match(pattern) and path) else val_16_auto = nil @@ -341,10 +341,10 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) return tbl_14_auto end commands["apropos-doc"] = function(_env, read, on_values, on_error, _scope) - local function _664_(_241) + local function _663_(_241) return on_values(apropos_doc(tostring(_241))) end - return run_command(read, on_error, _664_) + return run_command(read, on_error, _663_) end do end (compiler.metadata):set(commands["apropos-doc"], "fnl/docstring", "Print all functions that match the pattern in their docs") local function apropos_show_docs(on_values, pattern) @@ -359,31 +359,31 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) return nil end commands["apropos-show-docs"] = function(_env, read, on_values, on_error) - local function _666_(_241) + local function _665_(_241) return apropos_show_docs(on_values, tostring(_241)) end - return run_command(read, on_error, _666_) + return run_command(read, on_error, _665_) end do end (compiler.metadata):set(commands["apropos-show-docs"], "fnl/docstring", "Print all documentations matching a pattern in function name") - local function resolve(identifier, _667_, scope) - local _arg_668_ = _667_ - local ___replLocals___ = _arg_668_["___replLocals___"] - local env = _arg_668_ + local function resolve(identifier, _666_, scope) + local _arg_667_ = _666_ + local ___replLocals___ = _arg_667_["___replLocals___"] + local env = _arg_667_ local e - local function _669_(_241, _242) + local function _668_(_241, _242) return (___replLocals___[_242] or env[_242]) end - e = setmetatable({}, {__index = _669_}) - local _670_, _671_ = pcall(compiler["compile-string"], tostring(identifier), {scope = scope}) - if ((_670_ == true) and (nil ~= _671_)) then - local code = _671_ - local _672_ = specials["load-code"](code, e)() - local function _673_() - local x = _672_ + e = setmetatable({}, {__index = _668_}) + local _669_, _670_ = pcall(compiler["compile-string"], tostring(identifier), {scope = scope}) + if ((_669_ == true) and (nil ~= _670_)) then + local code = _670_ + local _671_ = specials["load-code"](code, e)() + local function _672_() + local x = _671_ return (type(x) == "function") end - if ((nil ~= _672_) and _673_()) then - local x = _672_ + if ((nil ~= _671_) and _672_()) then + local x = _671_ return x else return nil @@ -393,79 +393,79 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) end end commands.find = function(env, read, on_values, on_error, scope) - local function _676_(_241) - local _677_ + local function _675_(_241) + local _676_ do - local _678_ = utils["sym?"](_241) - if (nil ~= _678_) then - local _679_ = resolve(_678_, env, scope) - if (nil ~= _679_) then - _677_ = debug.getinfo(_679_) + local _677_ = utils["sym?"](_241) + if (nil ~= _677_) then + local _678_ = resolve(_677_, env, scope) + if (nil ~= _678_) then + _676_ = debug.getinfo(_678_) else - _677_ = _679_ + _676_ = _678_ end else - _677_ = _678_ + _676_ = _677_ end end - if ((_G.type(_677_) == "table") and (nil ~= (_677_).short_src) and ((_677_).what == "Lua") and (nil ~= (_677_).source) and (nil ~= (_677_).linedefined)) then - local src = (_677_).short_src - local source = (_677_).source - local line = (_677_).linedefined + if ((_G.type(_676_) == "table") and (nil ~= (_676_).source) and ((_676_).what == "Lua") and (nil ~= (_676_).short_src) and (nil ~= (_676_).linedefined)) then + local source = (_676_).source + local src = (_676_).short_src + local line = (_676_).linedefined local fnlsrc do - local t_682_ = compiler.sourcemap - if (nil ~= t_682_) then - t_682_ = (t_682_)[source] + local t_681_ = compiler.sourcemap + if (nil ~= t_681_) then + t_681_ = (t_681_)[source] else end - if (nil ~= t_682_) then - t_682_ = (t_682_)[line] + if (nil ~= t_681_) then + t_681_ = (t_681_)[line] else end - if (nil ~= t_682_) then - t_682_ = (t_682_)[2] + if (nil ~= t_681_) then + t_681_ = (t_681_)[2] else end - fnlsrc = t_682_ + fnlsrc = t_681_ end return on_values({string.format("%s:%s", src, (fnlsrc or line))}) - elseif (_677_ == nil) then + elseif (_676_ == nil) then return on_error("Repl", "Unknown value") elseif true then - local _ = _677_ + local _ = _676_ return on_error("Repl", "No source info") else return nil end end - return run_command(read, on_error, _676_) + return run_command(read, on_error, _675_) end do end (compiler.metadata):set(commands.find, "fnl/docstring", "Print the filename and line number for a given function") commands.doc = function(env, read, on_values, on_error, scope) - local function _687_(_241) + local function _686_(_241) local name = tostring(_241) local path = (utils["multi-sym?"](name) or {name}) local is_ok, target = nil, nil - local function _688_() + local function _687_() return (utils["get-in"](scope.specials, path) or utils["get-in"](scope.macros, path) or resolve(name, env, scope)) end - is_ok, target = pcall(_688_) + is_ok, target = pcall(_687_) if is_ok then return on_values({specials.doc(target, name)}) else return on_error("Repl", "Could not resolve value for docstring lookup") end end - return run_command(read, on_error, _687_) + return run_command(read, on_error, _686_) end do end (compiler.metadata):set(commands.doc, "fnl/docstring", "Print the docstring and arglist for a function, macro, or special form.") local function load_plugin_commands(plugins) for _, plugin in ipairs((plugins or {})) do for name, f in pairs(plugin) do - local _690_ = name:match("^repl%-command%-(.*)") - if (nil ~= _690_) then - local cmd_name = _690_ + local _689_ = name:match("^repl%-command%-(.*)") + if (nil ~= _689_) then + local cmd_name = _689_ commands[cmd_name] = (commands[cmd_name] or f) else end @@ -476,12 +476,12 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) local function run_command_loop(input, read, loop, env, on_values, on_error, scope, chars) local command_name = input:match(",([^%s/]+)") do - local _692_ = commands[command_name] - if (nil ~= _692_) then - local command = _692_ + local _691_ = commands[command_name] + if (nil ~= _691_) then + local command = _691_ command(env, read, on_values, on_error, scope, chars) elseif true then - local _ = _692_ + local _ = _691_ if ("exit" ~= command_name) then on_values({"Unknown command", command_name}) else @@ -506,10 +506,10 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) do local tbl_11_auto = {keeplines = 1000, histfile = ""} for k, v in pairs(readline.set_options({})) do - local _697_, _698_ = k, v - if ((nil ~= _697_) and (nil ~= _698_)) then - local k_12_auto = _697_ - local v_13_auto = _698_ + local _696_, _697_ = k, v + if ((nil ~= _696_) and (nil ~= _697_)) then + local k_12_auto = _696_ + local v_13_auto = _697_ tbl_11_auto[k_12_auto] = v_13_auto else end @@ -567,12 +567,12 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) local byte_stream, clear_stream = parser.granulate(read_chunk) local chars = {} local read, reset = nil, nil - local function _704_(parser_state) + local function _703_(parser_state) local c = byte_stream(parser_state) table.insert(chars, c) return c end - read, reset = parser.parser(_704_) + read, reset = parser.parser(_703_) opts.env, opts.scope = env, compiler["make-scope"]() opts.useMetadata = (opts.useMetadata ~= false) if (opts.allowedGlobals == nil) then @@ -580,15 +580,15 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) else end if opts.registerCompleter then - local function _708_() - local _706_ = env - local _707_ = opts.scope - local function _709_(...) - return completer(_706_, _707_, ...) + local function _707_() + local _705_ = env + local _706_ = opts.scope + local function _708_(...) + return completer(_705_, _706_, ...) end - return _709_ + return _708_ end - opts.registerCompleter(_708_()) + opts.registerCompleter(_707_()) else end load_plugin_commands(opts.plugins) @@ -628,43 +628,43 @@ package.preload["fennel.repl"] = package.preload["fennel.repl"] or function(...) else if not_eof_3f then do - local _713_, _714_ = nil, nil - local function _716_() - local _715_ = opts - _715_["source"] = src_string - return _715_ + local _712_, _713_ = nil, nil + local function _715_() + local _714_ = opts + _714_["source"] = src_string + return _714_ end - _713_, _714_ = pcall(compiler.compile, x, _716_()) - if ((_713_ == false) and (nil ~= _714_)) then - local msg = _714_ + _712_, _713_ = pcall(compiler.compile, x, _715_()) + if ((_712_ == false) and (nil ~= _713_)) then + local msg = _713_ clear_stream() on_error("Compile", msg) - elseif ((_713_ == true) and (nil ~= _714_)) then - local src = _714_ + elseif ((_712_ == true) and (nil ~= _713_)) then + local src = _713_ local src0 if save_locals_3f then src0 = splice_save_locals(env, src, opts.scope) else src0 = src end - local _718_, _719_ = pcall(specials["load-code"], src0, env) - if ((_718_ == false) and (nil ~= _719_)) then - local msg = _719_ + local _717_, _718_ = pcall(specials["load-code"], src0, env) + if ((_717_ == false) and (nil ~= _718_)) then + local msg = _718_ clear_stream() on_error("Lua Compile", msg, src0) - elseif (true and (nil ~= _719_)) then - local _ = _718_ - local chunk = _719_ - local function _720_() + elseif (true and (nil ~= _718_)) then + local _ = _717_ + local chunk = _718_ + local function _719_() return print_values(chunk()) end - local function _721_() - local function _722_(...) + local function _720_() + local function _721_(...) return on_error("Runtime", ...) end - return _722_ + return _721_ end - xpcall(_720_, _721_()) + xpcall(_719_, _720_()) else end else @@ -694,14 +694,14 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct local unpack = (table.unpack or _G.unpack) local SPECIALS = compiler.scopes.global.specials local function wrap_env(env) - local function _412_(_, key) + local function _411_(_, key) if utils["string?"](key) then return env[compiler["global-unmangling"](key)] else return env[key] end end - local function _414_(_, key, value) + local function _413_(_, key, value) if utils["string?"](key) then env[compiler["global-unmangling"](key)] = value return nil @@ -710,38 +710,38 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct return nil end end - local function _416_() + local function _415_() local function putenv(k, v) - local _417_ + local _416_ if utils["string?"](k) then - _417_ = compiler["global-unmangling"](k) + _416_ = compiler["global-unmangling"](k) else - _417_ = k + _416_ = k end - return _417_, v + return _416_, v end return next, utils.kvmap(env, putenv), nil end - return setmetatable({}, {__index = _412_, __newindex = _414_, __pairs = _416_}) + return setmetatable({}, {__index = _411_, __newindex = _413_, __pairs = _415_}) end local function current_global_names(_3fenv) local mt do - local _419_ = getmetatable(_3fenv) - if ((_G.type(_419_) == "table") and (nil ~= (_419_).__pairs)) then - local mtpairs = (_419_).__pairs + local _418_ = getmetatable(_3fenv) + if ((_G.type(_418_) == "table") and (nil ~= (_418_).__pairs)) then + local mtpairs = (_418_).__pairs local tbl_11_auto = {} for k, v in mtpairs(_3fenv) do - local _420_, _421_ = k, v - if ((nil ~= _420_) and (nil ~= _421_)) then - local k_12_auto = _420_ - local v_13_auto = _421_ + local _419_, _420_ = k, v + if ((nil ~= _419_) and (nil ~= _420_)) then + local k_12_auto = _419_ + local v_13_auto = _420_ tbl_11_auto[k_12_auto] = v_13_auto else end end mt = tbl_11_auto - elseif (_419_ == nil) then + elseif (_418_ == nil) then mt = (_3fenv or _G) else mt = nil @@ -751,16 +751,16 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct end local function load_code(code, _3fenv, _3ffilename) local env = (_3fenv or rawget(_G, "_ENV") or _G) - local _424_, _425_ = rawget(_G, "setfenv"), rawget(_G, "loadstring") - if ((nil ~= _424_) and (nil ~= _425_)) then - local setfenv = _424_ - local loadstring = _425_ + local _423_, _424_ = rawget(_G, "setfenv"), rawget(_G, "loadstring") + if ((nil ~= _423_) and (nil ~= _424_)) then + local setfenv = _423_ + local loadstring = _424_ local f = assert(loadstring(code, _3ffilename)) - local _426_ = f - setfenv(_426_, env) - return _426_ + local _425_ = f + setfenv(_425_, env) + return _425_ elseif true then - local _ = _424_ + local _ = _423_ return assert(load(code, _3ffilename, "t", env)) else return nil @@ -774,13 +774,13 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct local mt = getmetatable(tgt) if ((type(tgt) == "function") or ((type(mt) == "table") and (type(mt.__call) == "function"))) then local arglist = table.concat(((compiler.metadata):get(tgt, "fnl/arglist") or {"#"}), " ") - local _428_ + local _427_ if (0 < #arglist) then - _428_ = " " + _427_ = " " else - _428_ = "" + _427_ = "" end - return string.format("(%s%s%s)\n %s", name, _428_, arglist, docstring) + return string.format("(%s%s%s)\n %s", name, _427_, arglist, docstring) else return string.format("%s\n %s", name, docstring) end @@ -805,6 +805,7 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct local chunk = (_3fchunk or {}) local len = #ast local retexprs = {returned = true} + utils.hook("customhook-early-do", ast, sub_scope) local function compile_body(outer_target, outer_tail, outer_retexprs) if (len < start) then compiler.compile1(nil, sub_scope, chunk, {tail = outer_tail, target = outer_target}) @@ -869,7 +870,7 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct doc_special("values", {"..."}, "Return multiple values from a function. Must be in tail position.") local function deep_tostring(x, key_3f) if utils["list?"](x) then - local _437_ + local _436_ do local tbl_14_auto = {} local i_15_auto = #tbl_14_auto @@ -881,11 +882,11 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct else end end - _437_ = tbl_14_auto + _436_ = tbl_14_auto end - return ("(" .. table.concat(_437_, " ") .. ")") + return ("(" .. table.concat(_436_, " ") .. ")") elseif utils["sequence?"](x) then - local _439_ + local _438_ do local tbl_14_auto = {} local i_15_auto = #tbl_14_auto @@ -897,11 +898,11 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct else end end - _439_ = tbl_14_auto + _438_ = tbl_14_auto end - return ("[" .. table.concat(_439_, " ") .. "]") + return ("[" .. table.concat(_438_, " ") .. "]") elseif utils["table?"](x) then - local _441_ + local _440_ do local tbl_14_auto = {} local i_15_auto = #tbl_14_auto @@ -913,9 +914,9 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct else end end - _441_ = tbl_14_auto + _440_ = tbl_14_auto end - return ("{" .. table.concat(_441_, " ") .. "}") + return ("{" .. table.concat(_440_, " ") .. "}") elseif (key_3f and utils["string?"](x) and x:find("^[-%w?\\^_!$%&*+./@:|<=>]+$")) then return (":" .. x) elseif utils["string?"](x) then @@ -927,10 +928,10 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct local function set_fn_metadata(arg_list, docstring, parent, fn_name) if utils.root.options.useMetadata then local args - local function _444_(_241) + local function _443_(_241) return ("\"%s\""):format(deep_tostring(_241)) end - args = utils.map(arg_list, _444_) + args = utils.map(arg_list, _443_) local meta_fields = {"\"fnl/arglist\"", ("{" .. table.concat(args, ", ") .. "}")} if docstring then table.insert(meta_fields, "\"fnl/docstring\"") @@ -945,28 +946,29 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct end local function get_fn_name(ast, scope, fn_name, multi) if (fn_name and (fn_name[1] ~= "nil")) then - local _447_ + local _446_ if not multi then - _447_ = compiler["declare-local"](fn_name, {}, scope, ast) + _446_ = compiler["declare-local"](fn_name, {}, scope, ast) else - _447_ = (compiler["symbol-to-expression"](fn_name, scope))[1] + _446_ = (compiler["symbol-to-expression"](fn_name, scope))[1] end - return _447_, not multi, 3 + return _446_, not multi, 3 else return nil, true, 2 end end local function compile_named_fn(ast, f_scope, f_chunk, parent, index, fn_name, local_3f, arg_name_list, f_metadata) + utils.hook("customhook-early-fn", ast, f_scope) for i = (index + 1), #ast do compiler.compile1(ast[i], f_scope, f_chunk, {nval = (((i ~= #ast) and 0) or nil), tail = (i == #ast)}) end - local _450_ + local _449_ if local_3f then - _450_ = "local function %s(%s)" + _449_ = "local function %s(%s)" else - _450_ = "%s = function(%s)" + _449_ = "%s = function(%s)" end - compiler.emit(parent, string.format(_450_, fn_name, table.concat(arg_name_list, ", ")), ast) + compiler.emit(parent, string.format(_449_, fn_name, table.concat(arg_name_list, ", ")), ast) compiler.emit(parent, f_chunk, ast) compiler.emit(parent, "end", ast) set_fn_metadata(f_metadata["fnl/arglist"], f_metadata["fnl/docstring"], parent, fn_name) @@ -982,29 +984,29 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct local index_2a = (index + 1) local expr = ast[index_2a] if (utils["string?"](expr) and (index_2a < #ast)) then - local _453_ + local _452_ do - local _452_ = f_metadata - _452_["fnl/docstring"] = expr - _453_ = _452_ + local _451_ = f_metadata + _451_["fnl/docstring"] = expr + _452_ = _451_ end - return _453_, index_2a + return _452_, index_2a elseif (utils["table?"](expr) and (index_2a < #ast)) then - local _454_ + local _453_ do local tbl_11_auto = f_metadata for k, v in pairs(expr) do - local _455_, _456_ = k, v - if ((nil ~= _455_) and (nil ~= _456_)) then - local k_12_auto = _455_ - local v_13_auto = _456_ + local _454_, _455_ = k, v + if ((nil ~= _454_) and (nil ~= _455_)) then + local k_12_auto = _454_ + local v_13_auto = _455_ tbl_11_auto[k_12_auto] = v_13_auto else end end - _454_ = tbl_11_auto + _453_ = tbl_11_auto end - return _454_, index_2a + return _453_, index_2a else return f_metadata, index end @@ -1012,9 +1014,9 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct SPECIALS.fn = function(ast, scope, parent) local f_scope do - local _459_ = compiler["make-scope"](scope) - do end (_459_)["vararg"] = false - f_scope = _459_ + local _458_ = compiler["make-scope"](scope) + do end (_458_)["vararg"] = false + f_scope = _458_ end local f_chunk = {} local fn_sym = utils["sym?"](ast[2]) @@ -1049,29 +1051,29 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct doc_special("fn", {"name?", "args", "docstring?", "..."}, "Function syntax. May optionally include a name and docstring or a metadata table.\nIf a name is provided, the function will be bound in the current scope.\nWhen called with the wrong number of args, excess args will be discarded\nand lacking args will be nil, use lambda for arity-checked functions.", true) SPECIALS.lua = function(ast, _, parent) compiler.assert(((#ast == 2) or (#ast == 3)), "expected 1 or 2 arguments", ast) - local _463_ + local _462_ do - local _462_ = utils["sym?"](ast[2]) - if (nil ~= _462_) then - _463_ = tostring(_462_) + local _461_ = utils["sym?"](ast[2]) + if (nil ~= _461_) then + _462_ = tostring(_461_) else - _463_ = _462_ + _462_ = _461_ end end - if ("nil" ~= _463_) then + if ("nil" ~= _462_) then table.insert(parent, {ast = ast, leaf = tostring(ast[2])}) else end - local _467_ + local _466_ do - local _466_ = utils["sym?"](ast[3]) - if (nil ~= _466_) then - _467_ = tostring(_466_) + local _465_ = utils["sym?"](ast[3]) + if (nil ~= _465_) then + _466_ = tostring(_465_) else - _467_ = _466_ + _466_ = _465_ end end - if ("nil" ~= _467_) then + if ("nil" ~= _466_) then return tostring(ast[3]) else return nil @@ -1080,8 +1082,8 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct local function dot(ast, scope, parent) compiler.assert((1 < #ast), "expected table argument", ast) local len = #ast - local _let_470_ = compiler.compile1(ast[2], scope, parent, {nval = 1}) - local lhs = _let_470_[1] + local _let_469_ = compiler.compile1(ast[2], scope, parent, {nval = 1}) + local lhs = _let_469_[1] if (len == 2) then return tostring(lhs) else @@ -1091,8 +1093,8 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct if (utils["string?"](index) and utils["valid-lua-identifier?"](index)) then table.insert(indices, ("." .. index)) else - local _let_471_ = compiler.compile1(index, scope, parent, {nval = 1}) - local index0 = _let_471_[1] + local _let_470_ = compiler.compile1(index, scope, parent, {nval = 1}) + local index0 = _let_470_[1] table.insert(indices, ("[" .. tostring(index0) .. "]")) end end @@ -1137,7 +1139,7 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct end doc_special("var", {"name", "val"}, "Introduce new mutable local.") local function kv_3f(t) - local _475_ + local _474_ do local tbl_14_auto = {} local i_15_auto = #tbl_14_auto @@ -1154,9 +1156,9 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct else end end - _475_ = tbl_14_auto + _474_ = tbl_14_auto end - return (_475_)[1] + return (_474_)[1] end SPECIALS.let = function(ast, scope, parent, opts) local bindings = ast[2] @@ -1183,24 +1185,24 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct end end local function disambiguate_3f(rootstr, parent) - local function _480_() - local _479_ = get_prev_line(parent) - if (nil ~= _479_) then - local prev_line = _479_ + local function _479_() + local _478_ = get_prev_line(parent) + if (nil ~= _478_) then + local prev_line = _478_ return prev_line:match("%)$") else return nil end end - return (rootstr:match("^{") or _480_()) + return (rootstr:match("^{") or _479_()) end SPECIALS.tset = function(ast, scope, parent) compiler.assert((3 < #ast), "expected table, key, and value arguments", ast) local root = (compiler.compile1(ast[2], scope, parent, {nval = 1}))[1] local keys = {} for i = 3, (#ast - 1) do - local _let_482_ = compiler.compile1(ast[i], scope, parent, {nval = 1}) - local key = _let_482_[1] + local _let_481_ = compiler.compile1(ast[i], scope, parent, {nval = 1}) + local key = _let_481_[1] table.insert(keys, tostring(key)) end local value = (compiler.compile1(ast[#ast], scope, parent, {nval = 1}))[1] @@ -1324,8 +1326,8 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct end local function compile_until(condition, scope, chunk) if condition then - local _let_491_ = compiler.compile1(condition, scope, chunk, {nval = 1}) - local condition_lua = _let_491_[1] + local _let_490_ = compiler.compile1(condition, scope, chunk, {nval = 1}) + local condition_lua = _let_490_[1] return compiler.emit(chunk, ("if %s then break end"):format(tostring(condition_lua)), utils.expr(condition, "expression")) else return nil @@ -1408,10 +1410,10 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct SPECIALS["for"] = for_2a doc_special("for", {"[index start stop step?]", "..."}, "Numeric loop construct.\nEvaluates body once for each value between start and stop (inclusive).", true) local function native_method_call(ast, _scope, _parent, target, args) - local _let_495_ = ast - local _ = _let_495_[1] - local _0 = _let_495_[2] - local method_string = _let_495_[3] + local _let_494_ = ast + local _ = _let_494_[1] + local _0 = _let_494_[2] + local method_string = _let_494_[3] local call_string if ((target.type == "literal") or (target.type == "varg") or (target.type == "expression")) then call_string = "(%s):%s(%s)" @@ -1433,18 +1435,18 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct end local function method_call(ast, scope, parent) compiler.assert((2 < #ast), "expected at least 2 arguments", ast) - local _let_497_ = compiler.compile1(ast[2], scope, parent, {nval = 1}) - local target = _let_497_[1] + local _let_496_ = compiler.compile1(ast[2], scope, parent, {nval = 1}) + local target = _let_496_[1] local args = {} for i = 4, #ast do local subexprs - local _498_ + local _497_ if (i ~= #ast) then - _498_ = 1 + _497_ = 1 else - _498_ = nil + _497_ = nil end - subexprs = compiler.compile1(ast[i], scope, parent, {nval = _498_}) + subexprs = compiler.compile1(ast[i], scope, parent, {nval = _497_}) utils.map(subexprs, tostring, args) end if (utils["string?"](ast[3]) and utils["valid-lua-identifier?"](ast[3])) then @@ -1482,10 +1484,10 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct compiler.assert((#ast == 2), "expected one argument", ast) local f_scope do - local _503_ = compiler["make-scope"](scope) - do end (_503_)["vararg"] = false - _503_["hashfn"] = true - f_scope = _503_ + local _502_ = compiler["make-scope"](scope) + do end (_502_)["vararg"] = false + _502_["hashfn"] = true + f_scope = _502_ end local f_chunk = {} local name = compiler.gensym(scope) @@ -1523,9 +1525,9 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct return utils.expr(name, "sym") end doc_special("hashfn", {"..."}, "Function literal shorthand; args are either $... OR $1, $2, etc.") - local function maybe_short_circuit_protect(ast, i, name, _507_) - local _arg_508_ = _507_ - local mac = _arg_508_["macros"] + local function maybe_short_circuit_protect(ast, i, name, _506_) + local _arg_507_ = _506_ + local mac = _arg_507_["macros"] local call = (utils["list?"](ast) and tostring(ast[1])) if ((("or" == name) or ("and" == name)) and (1 < i) and (mac[call] or ("set" == call) or ("tset" == call) or ("global" == call))) then return utils.list(utils.sym("do"), ast) @@ -1546,40 +1548,40 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct table.insert(operands, tostring(subexprs[1])) end end - local _511_ = #operands - if (_511_ == 0) then - local _513_ + local _510_ = #operands + if (_510_ == 0) then + local _512_ do - local _512_ = zero_arity - compiler.assert(_512_, "Expected more than 0 arguments", ast) - _513_ = _512_ + local _511_ = zero_arity + compiler.assert(_511_, "Expected more than 0 arguments", ast) + _512_ = _511_ end - return utils.expr(_513_, "literal") - elseif (_511_ == 1) then + return utils.expr(_512_, "literal") + elseif (_510_ == 1) then if unary_prefix then return ("(" .. unary_prefix .. padded_op .. operands[1] .. ")") else return operands[1] end elseif true then - local _ = _511_ + local _ = _510_ return ("(" .. table.concat(operands, padded_op) .. ")") else return nil end end local function define_arithmetic_special(name, zero_arity, unary_prefix, _3flua_name) - local _519_ + local _518_ do - local _516_ = (_3flua_name or name) - local _517_ = zero_arity - local _518_ = unary_prefix - local function _520_(...) - return arithmetic_special(_516_, _517_, _518_, ...) + local _515_ = (_3flua_name or name) + local _516_ = zero_arity + local _517_ = unary_prefix + local function _519_(...) + return arithmetic_special(_515_, _516_, _517_, ...) end - _519_ = _520_ + _518_ = _519_ end - SPECIALS[name] = _519_ + SPECIALS[name] = _518_ return doc_special(name, {"a", "b", "..."}, "Arithmetic operator; works the same as Lua but accepts more arguments.") end define_arithmetic_special("+", "0") @@ -1608,13 +1610,13 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct local prefixed_lib_name = ("bit." .. lib_name) for i = 2, len do local subexprs - local _521_ + local _520_ if (i ~= len) then - _521_ = 1 + _520_ = 1 else - _521_ = nil + _520_ = nil end - subexprs = compiler.compile1(ast[i], scope, parent, {nval = _521_}) + subexprs = compiler.compile1(ast[i], scope, parent, {nval = _520_}) utils.map(subexprs, tostring, operands) end if (#operands == 1) then @@ -1633,18 +1635,18 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct end end local function define_bitop_special(name, zero_arity, unary_prefix, native) - local _531_ + local _530_ do - local _527_ = native - local _528_ = name - local _529_ = zero_arity - local _530_ = unary_prefix - local function _532_(...) - return bitop_special(_527_, _528_, _529_, _530_, ...) + local _526_ = native + local _527_ = name + local _528_ = zero_arity + local _529_ = unary_prefix + local function _531_(...) + return bitop_special(_526_, _527_, _528_, _529_, ...) end - _531_ = _532_ + _530_ = _531_ end - SPECIALS[name] = _531_ + SPECIALS[name] = _530_ return nil end define_bitop_special("lshift", nil, "1", "<<") @@ -1658,15 +1660,15 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct doc_special("bor", {"x1", "x2", "..."}, "Bitwise OR of any number of arguments.\nOnly works in Lua 5.3+ or LuaJIT with the --use-bit-lib flag.") doc_special("bxor", {"x1", "x2", "..."}, "Bitwise XOR of any number of arguments.\nOnly works in Lua 5.3+ or LuaJIT with the --use-bit-lib flag.") doc_special("..", {"a", "b", "..."}, "String concatenation operator; works the same as Lua but accepts more arguments.") - local function native_comparator(op, _533_, scope, parent) - local _arg_534_ = _533_ - local _ = _arg_534_[1] - local lhs_ast = _arg_534_[2] - local rhs_ast = _arg_534_[3] - local _let_535_ = compiler.compile1(lhs_ast, scope, parent, {nval = 1}) - local lhs = _let_535_[1] - local _let_536_ = compiler.compile1(rhs_ast, scope, parent, {nval = 1}) - local rhs = _let_536_[1] + local function native_comparator(op, _532_, scope, parent) + local _arg_533_ = _532_ + local _ = _arg_533_[1] + local lhs_ast = _arg_533_[2] + local rhs_ast = _arg_533_[3] + local _let_534_ = compiler.compile1(lhs_ast, scope, parent, {nval = 1}) + local lhs = _let_534_[1] + local _let_535_ = compiler.compile1(rhs_ast, scope, parent, {nval = 1}) + local rhs = _let_535_[1] return string.format("(%s %s %s)", tostring(lhs), op, tostring(rhs)) end local function double_eval_protected_comparator(op, chain_op, ast, scope, parent) @@ -1742,21 +1744,21 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct end local safe_require = nil local function safe_compiler_env() - local _540_ + local _539_ do - local _539_ = rawget(_G, "utf8") - if (nil ~= _539_) then - _540_ = utils.copy(_539_) + local _538_ = rawget(_G, "utf8") + if (nil ~= _538_) then + _539_ = utils.copy(_538_) else - _540_ = _539_ + _539_ = _538_ end end - return {table = utils.copy(table), math = utils.copy(math), string = utils.copy(string), pairs = pairs, ipairs = ipairs, select = select, tostring = tostring, tonumber = tonumber, bit = rawget(_G, "bit"), pcall = pcall, xpcall = xpcall, next = next, print = print, type = type, assert = assert, error = error, setmetatable = setmetatable, getmetatable = safe_getmetatable, require = safe_require, rawlen = rawget(_G, "rawlen"), rawget = rawget, rawset = rawset, rawequal = rawequal, _VERSION = _VERSION, utf8 = _540_} + return {table = utils.copy(table), math = utils.copy(math), string = utils.copy(string), pairs = pairs, ipairs = ipairs, select = select, tostring = tostring, tonumber = tonumber, bit = rawget(_G, "bit"), pcall = pcall, xpcall = xpcall, next = next, print = print, type = type, assert = assert, error = error, setmetatable = setmetatable, getmetatable = safe_getmetatable, require = safe_require, rawlen = rawget(_G, "rawlen"), rawget = rawget, rawset = rawset, rawequal = rawequal, _VERSION = _VERSION, utf8 = _539_} end local function combined_mt_pairs(env) local combined = {} - local _let_542_ = getmetatable(env) - local __index = _let_542_["__index"] + local _let_541_ = getmetatable(env) + local __index = _let_541_["__index"] if ("table" == type(__index)) then for k, v in pairs(__index) do combined[k] = v @@ -1771,42 +1773,42 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct local function make_compiler_env(ast, scope, parent, _3fopts) local provided do - local _544_ = (_3fopts or utils.root.options) - if ((_G.type(_544_) == "table") and ((_544_)["compiler-env"] == "strict")) then + local _543_ = (_3fopts or utils.root.options) + if ((_G.type(_543_) == "table") and ((_543_)["compiler-env"] == "strict")) then provided = safe_compiler_env() - elseif ((_G.type(_544_) == "table") and (nil ~= (_544_).compilerEnv)) then - local compilerEnv = (_544_).compilerEnv + elseif ((_G.type(_543_) == "table") and (nil ~= (_543_).compilerEnv)) then + local compilerEnv = (_543_).compilerEnv provided = compilerEnv - elseif ((_G.type(_544_) == "table") and (nil ~= (_544_)["compiler-env"])) then - local compiler_env = (_544_)["compiler-env"] + elseif ((_G.type(_543_) == "table") and (nil ~= (_543_)["compiler-env"])) then + local compiler_env = (_543_)["compiler-env"] provided = compiler_env elseif true then - local _ = _544_ + local _ = _543_ provided = safe_compiler_env(false) else provided = nil end end local env - local function _546_(base) + local function _545_(base) return utils.sym(compiler.gensym((compiler.scopes.macro or scope), base)) end - local function _547_() + local function _546_() return compiler.scopes.macro end - local function _548_(symbol) + local function _547_(symbol) compiler.assert(compiler.scopes.macro, "must call from macro", ast) return compiler.scopes.macro.manglings[tostring(symbol)] end - local function _549_(form) + local function _548_(form) compiler.assert(compiler.scopes.macro, "must call from macro", ast) return compiler.macroexpand(form, compiler.scopes.macro) end - env = {_AST = ast, _CHUNK = parent, _IS_COMPILER = true, _SCOPE = scope, _SPECIALS = compiler.scopes.global.specials, _VARARG = utils.varg(), ["macro-loaded"] = macro_loaded, unpack = unpack, ["assert-compile"] = compiler.assert, view = view, version = utils.version, metadata = compiler.metadata, ["ast-source"] = utils["ast-source"], list = utils.list, ["list?"] = utils["list?"], ["table?"] = utils["table?"], sequence = utils.sequence, ["sequence?"] = utils["sequence?"], sym = utils.sym, ["sym?"] = utils["sym?"], ["multi-sym?"] = utils["multi-sym?"], comment = utils.comment, ["comment?"] = utils["comment?"], ["varg?"] = utils["varg?"], gensym = _546_, ["get-scope"] = _547_, ["in-scope?"] = _548_, macroexpand = _549_} + env = {_AST = ast, _CHUNK = parent, _IS_COMPILER = true, _SCOPE = scope, _SPECIALS = compiler.scopes.global.specials, _VARARG = utils.varg(), ["macro-loaded"] = macro_loaded, unpack = unpack, ["assert-compile"] = compiler.assert, view = view, version = utils.version, metadata = compiler.metadata, ["ast-source"] = utils["ast-source"], list = utils.list, ["list?"] = utils["list?"], ["table?"] = utils["table?"], sequence = utils.sequence, ["sequence?"] = utils["sequence?"], sym = utils.sym, ["sym?"] = utils["sym?"], ["multi-sym?"] = utils["multi-sym?"], comment = utils.comment, ["comment?"] = utils["comment?"], ["varg?"] = utils["varg?"], gensym = _545_, ["get-scope"] = _546_, ["in-scope?"] = _547_, macroexpand = _548_} env._G = env return setmetatable(env, {__index = provided, __newindex = provided, __pairs = combined_mt_pairs}) end - local function _551_(...) + local function _550_(...) local tbl_14_auto = {} local i_15_auto = #tbl_14_auto for c in string.gmatch((package.config or ""), "([^\n]+)") do @@ -1819,10 +1821,10 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct end return tbl_14_auto end - local _local_550_ = _551_(...) - local dirsep = _local_550_[1] - local pathsep = _local_550_[2] - local pathmark = _local_550_[3] + local _local_549_ = _550_(...) + local dirsep = _local_549_[1] + local pathsep = _local_549_[2] + local pathmark = _local_549_[3] local pkg_config = {dirsep = (dirsep or "/"), pathmark = (pathmark or ";"), pathsep = (pathsep or "?")} local function escapepat(str) return string.gsub(str, "[^%w]", "%%%1") @@ -1835,40 +1837,40 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct local function try_path(path) local filename = path:gsub(escapepat(pkg_config.pathmark), no_dot_module) local filename2 = path:gsub(escapepat(pkg_config.pathmark), modulename) - local _553_ = (io.open(filename) or io.open(filename2)) - if (nil ~= _553_) then - local file = _553_ + local _552_ = (io.open(filename) or io.open(filename2)) + if (nil ~= _552_) then + local file = _552_ file:close() return filename elseif true then - local _ = _553_ + local _ = _552_ return nil, ("no file '" .. filename .. "'") else return nil end end local function find_in_path(start, _3ftried_paths) - local _555_ = fullpath:match(pattern, start) - if (nil ~= _555_) then - local path = _555_ - local _556_, _557_ = try_path(path) - if (nil ~= _556_) then - local filename = _556_ + local _554_ = fullpath:match(pattern, start) + if (nil ~= _554_) then + local path = _554_ + local _555_, _556_ = try_path(path) + if (nil ~= _555_) then + local filename = _555_ return filename - elseif ((_556_ == nil) and (nil ~= _557_)) then - local error = _557_ - local function _559_() - local _558_ = (_3ftried_paths or {}) - table.insert(_558_, error) - return _558_ + elseif ((_555_ == nil) and (nil ~= _556_)) then + local error = _556_ + local function _558_() + local _557_ = (_3ftried_paths or {}) + table.insert(_557_, error) + return _557_ end - return find_in_path((start + #path + 1), _559_()) + return find_in_path((start + #path + 1), _558_()) else return nil end elseif true then - local _ = _555_ - local function _561_() + local _ = _554_ + local function _560_() local tried_paths = table.concat((_3ftried_paths or {}), "\n\9") if (_VERSION < "Lua 5.4") then return ("\n\9" .. tried_paths) @@ -1876,7 +1878,7 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct return tried_paths end end - return nil, _561_() + return nil, _560_() else return nil end @@ -1884,33 +1886,33 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct return find_in_path(1) end local function make_searcher(_3foptions) - local function _564_(module_name) + local function _563_(module_name) local opts = utils.copy(utils.root.options) for k, v in pairs((_3foptions or {})) do opts[k] = v end opts["module-name"] = module_name - local _565_, _566_ = search_module(module_name) - if (nil ~= _565_) then - local filename = _565_ - local _569_ + local _564_, _565_ = search_module(module_name) + if (nil ~= _564_) then + local filename = _564_ + local _568_ do - local _567_ = filename - local _568_ = opts - local function _570_(...) - return utils["fennel-module"].dofile(_567_, _568_, ...) + local _566_ = filename + local _567_ = opts + local function _569_(...) + return utils["fennel-module"].dofile(_566_, _567_, ...) end - _569_ = _570_ + _568_ = _569_ end - return _569_, filename - elseif ((_565_ == nil) and (nil ~= _566_)) then - local error = _566_ + return _568_, filename + elseif ((_564_ == nil) and (nil ~= _565_)) then + local error = _565_ return error else return nil end end - return _564_ + return _563_ end local function dofile_with_searcher(fennel_macro_searcher, filename, opts, ...) local searchers = (package.loaders or package.searchers or {}) @@ -1922,42 +1924,42 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct local function fennel_macro_searcher(module_name) local opts do - local _572_ = utils.copy(utils.root.options) - do end (_572_)["module-name"] = module_name - _572_["env"] = "_COMPILER" - _572_["requireAsInclude"] = false - _572_["allowedGlobals"] = nil - opts = _572_ + local _571_ = utils.copy(utils.root.options) + do end (_571_)["module-name"] = module_name + _571_["env"] = "_COMPILER" + _571_["requireAsInclude"] = false + _571_["allowedGlobals"] = nil + opts = _571_ end - local _573_ = search_module(module_name, utils["fennel-module"]["macro-path"]) - if (nil ~= _573_) then - local filename = _573_ - local _574_ + local _572_ = search_module(module_name, utils["fennel-module"]["macro-path"]) + if (nil ~= _572_) then + local filename = _572_ + local _573_ if (opts["compiler-env"] == _G) then - local _575_ = fennel_macro_searcher - local _576_ = filename - local _577_ = opts - local function _579_(...) - return dofile_with_searcher(_575_, _576_, _577_, ...) + local _574_ = fennel_macro_searcher + local _575_ = filename + local _576_ = opts + local function _578_(...) + return dofile_with_searcher(_574_, _575_, _576_, ...) end - _574_ = _579_ + _573_ = _578_ else - local _580_ = filename - local _581_ = opts - local function _583_(...) - return utils["fennel-module"].dofile(_580_, _581_, ...) + local _579_ = filename + local _580_ = opts + local function _582_(...) + return utils["fennel-module"].dofile(_579_, _580_, ...) end - _574_ = _583_ + _573_ = _582_ end - return _574_, filename + return _573_, filename else return nil end end local function lua_macro_searcher(module_name) - local _586_ = search_module(module_name, package.path) - if (nil ~= _586_) then - local filename = _586_ + local _585_ = search_module(module_name, package.path) + if (nil ~= _585_) then + local filename = _585_ local code do local f = io.open(filename) @@ -1969,10 +1971,10 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct return error(..., 0) end end - local function _588_() + local function _587_() return assert(f:read("*a")) end - code = close_handlers_8_auto(_G.xpcall(_588_, (package.loaded.fennel or debug).traceback)) + code = close_handlers_8_auto(_G.xpcall(_587_, (package.loaded.fennel or debug).traceback)) end local chunk = load_code(code, make_compiler_env(), filename) return chunk, filename @@ -1982,16 +1984,16 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct end local macro_searchers = {fennel_macro_searcher, lua_macro_searcher} local function search_macro_module(modname, n) - local _590_ = macro_searchers[n] - if (nil ~= _590_) then - local f = _590_ - local _591_, _592_ = f(modname) - if ((nil ~= _591_) and true) then - local loader = _591_ - local _3ffilename = _592_ + local _589_ = macro_searchers[n] + if (nil ~= _589_) then + local f = _589_ + local _590_, _591_ = f(modname) + if ((nil ~= _590_) and true) then + local loader = _590_ + local _3ffilename = _591_ return loader, _3ffilename elseif true then - local _ = _591_ + local _ = _590_ return search_macro_module(modname, (n + 1)) else return nil @@ -2007,16 +2009,16 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct return nil end end - local function _596_(modname) - local function _597_() + local function _595_(modname) + local function _596_() local loader, filename = search_macro_module(modname, 1) compiler.assert(loader, (modname .. " module not found.")) do end (macro_loaded)[modname] = loader(modname, filename) return macro_loaded[modname] end - return (macro_loaded[modname] or sandbox_fennel_module(modname) or _597_()) + return (macro_loaded[modname] or sandbox_fennel_module(modname) or _596_()) end - safe_require = _596_ + safe_require = _595_ local function add_macros(macros_2a, ast, scope) compiler.assert(utils["table?"](macros_2a), "expected macros to be table", ast) for k, v in pairs(macros_2a) do @@ -2026,10 +2028,10 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct end return nil end - local function resolve_module_name(_598_, _scope, _parent, opts) - local _arg_599_ = _598_ - local filename = _arg_599_["filename"] - local second = _arg_599_[2] + local function resolve_module_name(_597_, _scope, _parent, opts) + local _arg_598_ = _597_ + local filename = _arg_598_["filename"] + local second = _arg_598_[2] local filename0 = (filename or (utils["table?"](second) and second.filename)) local module_name = utils.root.options["module-name"] local modexpr = compiler.compile(second, opts) @@ -2088,10 +2090,10 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct return error(..., 0) end end - local function _605_() + local function _604_() return assert(f:read("*all")):gsub("[\13\n]*$", "") end - src = close_handlers_8_auto(_G.xpcall(_605_, (package.loaded.fennel or debug).traceback)) + src = close_handlers_8_auto(_G.xpcall(_604_, (package.loaded.fennel or debug).traceback)) end local ret = utils.expr(("require(\"" .. mod .. "\")"), "statement") local target = ("package.preload[%q]"):format(mod) @@ -2123,12 +2125,12 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct compiler.assert((#ast == 2), "expected one argument", ast) local modexpr do - local _608_, _609_ = pcall(resolve_module_name, ast, scope, parent, opts) - if ((_608_ == true) and (nil ~= _609_)) then - local modname = _609_ + local _607_, _608_ = pcall(resolve_module_name, ast, scope, parent, opts) + if ((_607_ == true) and (nil ~= _608_)) then + local modname = _608_ modexpr = utils.expr(string.format("%q", modname), "literal") elseif true then - local _ = _608_ + local _ = _607_ modexpr = (compiler.compile1(ast[2], scope, parent, {nval = 1}))[1] else modexpr = nil @@ -2147,13 +2149,13 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct utils.root.options["module-name"] = mod _ = nil local res - local function _613_() - local _612_ = search_module(mod) - if (nil ~= _612_) then - local fennel_path = _612_ + local function _612_() + local _611_ = search_module(mod) + if (nil ~= _611_) then + local fennel_path = _611_ return include_path(ast, opts, fennel_path, mod, true) elseif true then - local _0 = _612_ + local _0 = _611_ local lua_path = search_module(mod, package.path) if lua_path then return include_path(ast, opts, lua_path, mod, false) @@ -2166,7 +2168,7 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct return nil end end - res = ((utils["member?"](mod, (utils.root.options.skipInclude or {})) and opts.fallback(modexpr, true)) or include_circular_fallback(mod, modexpr, opts.fallback, ast) or utils.root.scope.includes[mod] or _613_()) + res = ((utils["member?"](mod, (utils.root.options.skipInclude or {})) and opts.fallback(modexpr, true)) or include_circular_fallback(mod, modexpr, opts.fallback, ast) or utils.root.scope.includes[mod] or _612_()) utils.root.options["module-name"] = oldmod return res end @@ -2669,14 +2671,13 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct local line = _arg_317_["line"] local bytestart = _arg_317_["bytestart"] local byteend = _arg_317_["byteend"] - if ("table" == type(node)) then + do local src = utils["ast-source"](node) - if (filename ~= src.filename) then + if (("table" == type(node)) and (filename ~= src.filename)) then src.filename, src.line, src["from-macro?"] = filename, line, true src.bytestart, src.byteend = bytestart, byteend else end - else end return ("table" == type(node)) end @@ -2693,8 +2694,8 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct local function quote_literal_nils(index, node, parent) if (parent and utils["list?"](parent)) then for i = 1, max_n(parent) do - local _321_ = parent[i] - if (_321_ == nil) then + local _320_ = parent[i] + if (_320_ == nil) then parent[i] = utils.sym("nil") else end @@ -2704,10 +2705,10 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct return index, node, parent end local function comp(f, g) - local function _324_(...) + local function _323_(...) return f(g(...)) end - return _324_ + return _323_ end local function built_in_3f(m) local found_3f = false @@ -2718,41 +2719,41 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct return found_3f end local function macroexpand_2a(ast, scope, _3fonce) - local _325_ + local _324_ if utils["list?"](ast) then - _325_ = find_macro(ast, scope) + _324_ = find_macro(ast, scope) else - _325_ = nil + _324_ = nil end - if (_325_ == false) then + if (_324_ == false) then return ast - elseif (nil ~= _325_) then - local macro_2a = _325_ + elseif (nil ~= _324_) then + local macro_2a = _324_ local old_scope = scopes.macro local _ scopes.macro = scope _ = nil local ok, transformed = nil, nil - local function _327_() + local function _326_() return macro_2a(unpack(ast, 2)) end - local function _328_() + local function _327_() if built_in_3f(macro_2a) then return tostring else return debug.traceback end end - ok, transformed = xpcall(_327_, _328_()) - local _330_ + ok, transformed = xpcall(_326_, _327_()) + local _329_ do - local _329_ = ast - local function _331_(...) - return propagate_trace_info(_329_, ...) + local _328_ = ast + local function _330_(...) + return propagate_trace_info(_328_, ...) end - _330_ = _331_ + _329_ = _330_ end - utils["walk-tree"](transformed, comp(_330_, quote_literal_nils)) + utils["walk-tree"](transformed, comp(_329_, quote_literal_nils)) scopes.macro = old_scope assert_compile(ok, transformed, ast) if (_3fonce or not transformed) then @@ -2761,7 +2762,7 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct return macroexpand_2a(transformed, scope) end elseif true then - local _ = _325_ + local _ = _324_ return ast else return nil @@ -2795,14 +2796,14 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct assert_compile((utils["sym?"](ast[1]) or utils["list?"](ast[1]) or ("string" == type(ast[1]))), ("cannot call literal value " .. tostring(ast[1])), ast) for i = 2, len do local subexprs - local _337_ + local _336_ if (i ~= len) then - _337_ = 1 + _336_ = 1 else - _337_ = nil + _336_ = nil end - subexprs = compile1(ast[i], scope, parent, {nval = _337_}) - table.insert(fargs, (subexprs[1] or utils.expr("nil", "literal"))) + subexprs = compile1(ast[i], scope, parent, {nval = _336_}) + table.insert(fargs, subexprs[1]) if (i == len) then for j = 2, #subexprs do table.insert(fargs, subexprs[j]) @@ -2839,13 +2840,13 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct end end local function compile_varg(ast, scope, parent, opts) - local _342_ + local _341_ if scope.hashfn then - _342_ = "use $... in hashfn" + _341_ = "use $... in hashfn" else - _342_ = "unexpected vararg" + _341_ = "unexpected vararg" end - assert_compile(scope.vararg, _342_, ast) + assert_compile(scope.vararg, _341_, ast) return handle_compile_opts({utils.expr("...", "varg")}, parent, opts, ast) end local function compile_sym(ast, scope, parent, opts) @@ -2860,20 +2861,20 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct return handle_compile_opts({e}, parent, opts, ast) end local function serialize_number(n) - local _345_ = string.gsub(tostring(n), ",", ".") - return _345_ + local _344_ = string.gsub(tostring(n), ",", ".") + return _344_ end local function compile_scalar(ast, _scope, parent, opts) local serialize do - local _346_ = type(ast) - if (_346_ == "nil") then + local _345_ = type(ast) + if (_345_ == "nil") then serialize = tostring - elseif (_346_ == "boolean") then + elseif (_345_ == "boolean") then serialize = tostring - elseif (_346_ == "string") then + elseif (_345_ == "string") then serialize = serialize_string - elseif (_346_ == "number") then + elseif (_345_ == "number") then serialize = serialize_number else serialize = nil @@ -2888,8 +2889,8 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct if ((type(k) == "string") and utils["valid-lua-identifier?"](k)) then return {k, k} else - local _let_348_ = compile1(k, scope, parent, {nval = 1}) - local compiled = _let_348_[1] + local _let_347_ = compile1(k, scope, parent, {nval = 1}) + local compiled = _let_347_[1] local kstr = ("[" .. tostring(compiled) .. "]") return {kstr, k} end @@ -2912,15 +2913,15 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct end keys = tbl_14_auto end - local function _354_(_352_) - local _arg_353_ = _352_ - local k1 = _arg_353_[1] - local k2 = _arg_353_[2] - local _let_355_ = compile1(ast[k2], scope, parent, {nval = 1}) - local v = _let_355_[1] + local function _353_(_351_) + local _arg_352_ = _351_ + local k1 = _arg_352_[1] + local k2 = _arg_352_[2] + local _let_354_ = compile1(ast[k2], scope, parent, {nval = 1}) + local v = _let_354_[1] return string.format("%s = %s", k1, tostring(v)) end - utils.map(keys, _354_, buffer) + utils.map(keys, _353_, buffer) end for i = 1, #ast do local nval = ((i ~= #ast) and 1) @@ -2947,12 +2948,12 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct end local function destructure(to, from, ast, scope, parent, opts) local opts0 = (opts or {}) - local _let_357_ = opts0 - local isvar = _let_357_["isvar"] - local declaration = _let_357_["declaration"] - local forceglobal = _let_357_["forceglobal"] - local forceset = _let_357_["forceset"] - local symtype = _let_357_["symtype"] + local _let_356_ = opts0 + local isvar = _let_356_["isvar"] + local declaration = _let_356_["declaration"] + local forceglobal = _let_356_["forceglobal"] + local forceset = _let_356_["forceset"] + local symtype = _let_356_["symtype"] local symtype0 = ("_" .. (symtype or "dst")) local setter if declaration then @@ -2991,14 +2992,14 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct end local function compile_top_target(lvalues) local inits - local function _363_(_241) + local function _362_(_241) if scope.manglings[_241] then return _241 else return "nil" end end - inits = utils.map(lvalues, _363_) + inits = utils.map(lvalues, _362_) local init = table.concat(inits, ", ") local lvalue = table.concat(lvalues, ", ") local plast = parent[#parent] @@ -3040,7 +3041,7 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct local unpack_fn = "function (t, k, e)\n local mt = getmetatable(t)\n if 'table' == type(mt) and mt.__fennelrest then\n return mt.__fennelrest(t, k)\n elseif e then\n local rest = {}\n for k, v in pairs(t) do\n if not e[k] then rest[k] = v end\n end\n return rest\n else\n return {(table.unpack or unpack)(t, k)}\n end\n end" local function destructure_kv_rest(s, v, left, excluded_keys, destructure1) local exclude_str - local _370_ + local _369_ do local tbl_14_auto = {} local i_15_auto = #tbl_14_auto @@ -3052,9 +3053,9 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct else end end - _370_ = tbl_14_auto + _369_ = tbl_14_auto end - exclude_str = table.concat(_370_, ", ") + exclude_str = table.concat(_369_, ", ") local subexpr = utils.expr(string.format(string.gsub(("(" .. unpack_fn .. ")(%s, %s, {%s})"), "\n%s*", " "), s, tostring(v), exclude_str), "expression") return destructure1(v, {subexpr}, left) end @@ -3069,16 +3070,16 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct local s = gensym(scope, symtype0) local right do - local _372_ + local _371_ if top_3f then - _372_ = exprs1(compile1(from, scope, parent)) + _371_ = exprs1(compile1(from, scope, parent)) else - _372_ = exprs1(rightexprs) + _371_ = exprs1(rightexprs) end - if (_372_ == "") then + if (_371_ == "") then right = "nil" - elseif (nil ~= _372_) then - local right0 = _372_ + elseif (nil ~= _371_) then + local right0 = _371_ right = right0 else right = nil @@ -3251,14 +3252,14 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct else end if (info.what == "Lua") then - local function _392_() + local function _391_() if info.name then return ("'" .. info.name .. "'") else return "?" end end - return string.format(" %s:%d: in function %s", info.short_src, info.currentline, _392_()) + return string.format(" %s:%d: in function %s", info.short_src, info.currentline, _391_()) elseif (info.short_src == "(tail call)") then return " (tail call)" else @@ -3282,11 +3283,11 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct local done_3f, level = false, (_3fstart or 2) while not done_3f do do - local _396_ = debug.getinfo(level, "Sln") - if (_396_ == nil) then + local _395_ = debug.getinfo(level, "Sln") + if (_395_ == nil) then done_3f = true - elseif (nil ~= _396_) then - local info = _396_ + elseif (nil ~= _395_) then + local info = _395_ table.insert(lines, traceback_frame(info)) else end @@ -3297,14 +3298,14 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct end end local function entry_transform(fk, fv) - local function _399_(k, v) + local function _398_(k, v) if (type(k) == "number") then return k, fv(v) else return fk(k), fv(v) end end - return _399_ + return _398_ end local function mixed_concat(t, joiner) local seen = {} @@ -3350,10 +3351,10 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct return res[1] elseif utils["list?"](form) then local mapped - local function _404_() + local function _403_() return nil end - mapped = utils.kvmap(form, entry_transform(_404_, q)) + mapped = utils.kvmap(form, entry_transform(_403_, q)) local filename if form.filename then filename = string.format("%q", form.filename) @@ -3371,13 +3372,13 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct else filename = "nil" end - local _407_ + local _406_ if source then - _407_ = source.line + _406_ = source.line else - _407_ = "nil" + _406_ = "nil" end - return string.format("setmetatable({%s}, {filename=%s, line=%s, sequence=%s})", mixed_concat(mapped, ", "), filename, _407_, "(getmetatable(sequence()))['sequence']") + return string.format("setmetatable({%s}, {filename=%s, line=%s, sequence=%s})", mixed_concat(mapped, ", "), filename, _406_, "(getmetatable(sequence()))['sequence']") elseif (type(form) == "table") then local mapped = utils.kvmap(form, entry_transform(q, q)) local source = getmetatable(form) @@ -3387,14 +3388,14 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct else filename = "nil" end - local function _410_() + local function _409_() if source then return source.line else return "nil" end end - return string.format("setmetatable({%s}, {filename=%s, line=%s})", mixed_concat(mapped, ", "), filename, _410_()) + return string.format("setmetatable({%s}, {filename=%s, line=%s})", mixed_concat(mapped, ", "), filename, _409_()) elseif (type(form) == "string") then return serialize_string(form) else @@ -4546,7 +4547,7 @@ package.preload["fennel.view"] = package.preload["fennel.view"] or function(...) end package.preload["fennel.utils"] = package.preload["fennel.utils"] or function(...) local view = require("fennel.view") - local version = "1.2.0-dev" + local version = "1.3.0-dev" local function luajit_vm_3f() return ((nil ~= _G.jit) and (type(_G.jit) == "table") and (nil ~= _G.jit.on) and (nil ~= _G.jit.off) and (type(_G.jit.version_num) == "number")) end @@ -5105,14 +5106,14 @@ local function eval(str, options, ...) local env = eval_env(opts.env, opts) local lua_source = compiler["compile-string"](str, opts) local loader - local function _733_(...) + local function _732_(...) if opts.filename then return ("@" .. opts.filename) else return str end end - loader = specials["load-code"](lua_source, env, _733_(...)) + loader = specials["load-code"](lua_source, env, _732_(...)) opts.filename = nil return loader(...) end @@ -5137,10 +5138,10 @@ local function syntax() out[k] = {["macro?"] = true, ["body-form?"] = utils["member?"](k, body_3f), ["binding-form?"] = utils["member?"](k, binding_3f), ["define?"] = utils["member?"](k, define_3f)} end for k, v in pairs(_G) do - local _734_ = type(v) - if (_734_ == "function") then + local _733_ = type(v) + if (_733_ == "function") then out[k] = {["global?"] = true, ["function?"] = true} - elseif (_734_ == "table") then + elseif (_733_ == "table") then for k2, v2 in pairs(v) do if (("function" == type(v2)) and (k ~= "_G")) then out[(k .. "." .. k2)] = {["function?"] = true, ["global?"] = true} @@ -5153,7 +5154,7 @@ local function syntax() end return out end -local mod = {list = utils.list, ["list?"] = utils["list?"], sym = utils.sym, ["sym?"] = utils["sym?"], sequence = utils.sequence, ["sequence?"] = utils["sequence?"], comment = utils.comment, ["comment?"] = utils["comment?"], varg = utils.varg, ["varg?"] = utils["varg?"], ["sym-char?"] = parser["sym-char?"], parser = parser.parser, compile = compiler.compile, ["compile-string"] = compiler["compile-string"], ["compile-stream"] = compiler["compile-stream"], eval = eval, repl = repl, view = view, dofile = dofile_2a, ["load-code"] = specials["load-code"], doc = specials.doc, metadata = compiler.metadata, traceback = compiler.traceback, version = utils.version, ["runtime-version"] = utils["runtime-version"], ["ast-source"] = utils["ast-source"], path = utils.path, ["macro-path"] = utils["macro-path"], ["macro-loaded"] = specials["macro-loaded"], ["macro-searchers"] = specials["macro-searchers"], ["search-module"] = specials["search-module"], ["make-searcher"] = specials["make-searcher"], searcher = specials["make-searcher"](), syntax = syntax, gensym = compiler.gensym, scope = compiler["make-scope"], mangle = compiler["global-mangling"], unmangle = compiler["global-unmangling"], compile1 = compiler.compile1, ["string-stream"] = parser["string-stream"], granulate = parser.granulate, loadCode = specials["load-code"], make_searcher = specials["make-searcher"], makeSearcher = specials["make-searcher"], searchModule = specials["search-module"], macroPath = utils["macro-path"], macroSearchers = specials["macro-searchers"], macroLoaded = specials["macro-loaded"], compileStream = compiler["compile-stream"], compileString = compiler["compile-string"], stringStream = parser["string-stream"], runtimeVersion = utils["runtime-version"]} +local mod = {list = utils.list, ["list?"] = utils["list?"], sym = utils.sym, ["sym?"] = utils["sym?"], ["multi-sym?"] = utils["multi-sym?"], sequence = utils.sequence, ["sequence?"] = utils["sequence?"], comment = utils.comment, ["comment?"] = utils["comment?"], varg = utils.varg, ["varg?"] = utils["varg?"], ["sym-char?"] = parser["sym-char?"], parser = parser.parser, compile = compiler.compile, ["compile-string"] = compiler["compile-string"], ["compile-stream"] = compiler["compile-stream"], eval = eval, repl = repl, view = view, dofile = dofile_2a, ["load-code"] = specials["load-code"], doc = specials.doc, metadata = compiler.metadata, traceback = compiler.traceback, version = utils.version, ["runtime-version"] = utils["runtime-version"], ["ast-source"] = utils["ast-source"], path = utils.path, ["macro-path"] = utils["macro-path"], ["macro-loaded"] = specials["macro-loaded"], ["macro-searchers"] = specials["macro-searchers"], ["search-module"] = specials["search-module"], ["make-searcher"] = specials["make-searcher"], searcher = specials["make-searcher"](), syntax = syntax, gensym = compiler.gensym, scope = compiler["make-scope"], mangle = compiler["global-mangling"], unmangle = compiler["global-unmangling"], compile1 = compiler.compile1, ["string-stream"] = parser["string-stream"], granulate = parser.granulate, loadCode = specials["load-code"], make_searcher = specials["make-searcher"], makeSearcher = specials["make-searcher"], searchModule = specials["search-module"], macroPath = utils["macro-path"], macroSearchers = specials["macro-searchers"], macroLoaded = specials["macro-loaded"], compileStream = compiler["compile-stream"], compileString = compiler["compile-string"], stringStream = parser["string-stream"], runtimeVersion = utils["runtime-version"]} utils["fennel-module"] = mod do local builtin_macros = [===[;; These macros are awkward because their definition cannot rely on the any @@ -5788,17 +5789,17 @@ do ]===] local module_name = "fennel.macros" local _ - local function _737_() + local function _736_() return mod end - package.preload[module_name] = _737_ + package.preload[module_name] = _736_ _ = nil local env do - local _738_ = specials["make-compiler-env"](nil, compiler.scopes.compiler, {}) - do end (_738_)["utils"] = utils - _738_["fennel"] = mod - env = _738_ + local _737_ = specials["make-compiler-env"](nil, compiler.scopes.compiler, {}) + do end (_737_)["utils"] = utils + _737_["fennel"] = mod + env = _737_ end local built_ins = eval(builtin_macros, {env = env, scope = compiler.scopes.compiler, allowedGlobals = false, useMetadata = true, filename = "src/fennel/macros.fnl", moduleName = module_name}) for k, v in pairs(built_ins) do diff --git a/test/completion-test.fnl b/test/completion-test.fnl index a2452a4..24cbbee 100644 --- a/test/completion-test.fnl +++ b/test/completion-test.fnl @@ -28,17 +28,17 @@ (. _G a) (. _G b) (. _G c)) - "oops")))) + "oops"))) - ;; (it "suggests locals in scope" - ;; (local state (doto [] setup-server)) - ;; (open-file state filename "(local x 10)\n(print )") - ;; (let [response (dispatch.handle* state (completion-at filename 1 7))] - ;; (var seen-suggestion false) - ;; (each [_ suggestion (ipairs (. response 1 :result))] - ;; (if (= suggestion.label :x) - ;; (set seen-suggestion true))) - ;; (assert seen-suggestion "x was not suggested")))) + (it "suggests locals in scope" + (local state (doto [] setup-server)) + (open-file state filename "(local x 10)\n(print )") + (let [response (dispatch.handle* state (completion-at filename 1 7))] + (var seen-suggestion false) + (each [_ suggestion (ipairs (. response 1 :result))] + (if (= suggestion.label :x) + (set seen-suggestion true))) + (assert seen-suggestion "x was not suggested")))) ;; (it "treats things in a call position differently") ;; (it "does not suggest locals out of scope")