Initial commit
This commit is contained in:
commit
29bee0bfb1
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/deps/
|
||||
/test/lua/
|
||||
/doc/tags
|
17
Makefile
Normal file
17
Makefile
Normal file
@ -0,0 +1,17 @@
|
||||
.PHONY: deps compile test
|
||||
|
||||
default: deps compile test
|
||||
|
||||
deps:
|
||||
scripts/dep.sh Olical aniseed origin/master
|
||||
|
||||
compile:
|
||||
rm -rf lua
|
||||
deps/aniseed/scripts/compile.sh
|
||||
|
||||
# Remove this if you only want Aniseed at compile time.
|
||||
deps/aniseed/scripts/embed.sh aniseed conjure-macroexpand
|
||||
|
||||
test:
|
||||
rm -rf test/lua
|
||||
deps/aniseed/scripts/test.sh
|
4
fnl/conjure-macroexpand/main.fnl
Normal file
4
fnl/conjure-macroexpand/main.fnl
Normal file
@ -0,0 +1,4 @@
|
||||
(module conjure-macroexpand.main)
|
||||
|
||||
(defn init []
|
||||
(print "Hello, World!"))
|
78
lua/conjure-macroexpand/aniseed/autoload.lua
Normal file
78
lua/conjure-macroexpand/aniseed/autoload.lua
Normal file
@ -0,0 +1,78 @@
|
||||
local _2afile_2a = "fnl/aniseed/autoload.fnl"
|
||||
local _0_
|
||||
do
|
||||
local name_0_ = "conjure-macroexpand.aniseed.autoload"
|
||||
local module_0_
|
||||
do
|
||||
local x_0_ = package.loaded[name_0_]
|
||||
if ("table" == type(x_0_)) then
|
||||
module_0_ = x_0_
|
||||
else
|
||||
module_0_ = {}
|
||||
end
|
||||
end
|
||||
module_0_["aniseed/module"] = name_0_
|
||||
module_0_["aniseed/locals"] = ((module_0_)["aniseed/locals"] or {})
|
||||
do end (module_0_)["aniseed/local-fns"] = ((module_0_)["aniseed/local-fns"] or {})
|
||||
do end (package.loaded)[name_0_] = module_0_
|
||||
_0_ = module_0_
|
||||
end
|
||||
local autoload
|
||||
local function _1_(...)
|
||||
return (require("conjure-macroexpand.aniseed.autoload")).autoload(...)
|
||||
end
|
||||
autoload = _1_
|
||||
local function _2_(...)
|
||||
local ok_3f_0_, val_0_ = nil, nil
|
||||
local function _2_()
|
||||
return {}
|
||||
end
|
||||
ok_3f_0_, val_0_ = pcall(_2_)
|
||||
if ok_3f_0_ then
|
||||
_0_["aniseed/local-fns"] = {}
|
||||
return val_0_
|
||||
else
|
||||
return print(val_0_)
|
||||
end
|
||||
end
|
||||
local _local_0_ = _2_(...)
|
||||
local _2amodule_2a = _0_
|
||||
local _2amodule_name_2a = "conjure-macroexpand.aniseed.autoload"
|
||||
do local _ = ({nil, _0_, nil, {{}, nil, nil, nil}})[2] end
|
||||
local autoload0
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function autoload1(name)
|
||||
local res = {["aniseed/autoload-enabled?"] = true, ["aniseed/autoload-module"] = false}
|
||||
local function ensure()
|
||||
if res["aniseed/autoload-module"] then
|
||||
return res["aniseed/autoload-module"]
|
||||
else
|
||||
local m = require(name)
|
||||
do end (res)["aniseed/autoload-module"] = m
|
||||
return m
|
||||
end
|
||||
end
|
||||
local function _3_(t, ...)
|
||||
return ensure()(...)
|
||||
end
|
||||
local function _4_(t, k)
|
||||
return ensure()[k]
|
||||
end
|
||||
local function _5_(t, k, v)
|
||||
ensure()[k] = v
|
||||
return nil
|
||||
end
|
||||
return setmetatable(res, {__call = _3_, __index = _4_, __newindex = _5_})
|
||||
end
|
||||
v_0_0 = autoload1
|
||||
_0_["autoload"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["autoload"] = v_0_
|
||||
autoload0 = v_0_
|
||||
end
|
||||
return nil
|
146
lua/conjure-macroexpand/aniseed/compile.lua
Normal file
146
lua/conjure-macroexpand/aniseed/compile.lua
Normal file
@ -0,0 +1,146 @@
|
||||
local _2afile_2a = "fnl/aniseed/compile.fnl"
|
||||
local _0_
|
||||
do
|
||||
local name_0_ = "conjure-macroexpand.aniseed.compile"
|
||||
local module_0_
|
||||
do
|
||||
local x_0_ = package.loaded[name_0_]
|
||||
if ("table" == type(x_0_)) then
|
||||
module_0_ = x_0_
|
||||
else
|
||||
module_0_ = {}
|
||||
end
|
||||
end
|
||||
module_0_["aniseed/module"] = name_0_
|
||||
module_0_["aniseed/locals"] = ((module_0_)["aniseed/locals"] or {})
|
||||
do end (module_0_)["aniseed/local-fns"] = ((module_0_)["aniseed/local-fns"] or {})
|
||||
do end (package.loaded)[name_0_] = module_0_
|
||||
_0_ = module_0_
|
||||
end
|
||||
local autoload
|
||||
local function _1_(...)
|
||||
return (require("conjure-macroexpand.aniseed.autoload")).autoload(...)
|
||||
end
|
||||
autoload = _1_
|
||||
local function _2_(...)
|
||||
local ok_3f_0_, val_0_ = nil, nil
|
||||
local function _2_()
|
||||
return {autoload("conjure-macroexpand.aniseed.core"), autoload("conjure-macroexpand.aniseed.fennel"), autoload("conjure-macroexpand.aniseed.fs"), autoload("conjure-macroexpand.aniseed.nvim")}
|
||||
end
|
||||
ok_3f_0_, val_0_ = pcall(_2_)
|
||||
if ok_3f_0_ then
|
||||
_0_["aniseed/local-fns"] = {autoload = {a = "conjure-macroexpand.aniseed.core", fennel = "conjure-macroexpand.aniseed.fennel", fs = "conjure-macroexpand.aniseed.fs", nvim = "conjure-macroexpand.aniseed.nvim"}}
|
||||
return val_0_
|
||||
else
|
||||
return print(val_0_)
|
||||
end
|
||||
end
|
||||
local _local_0_ = _2_(...)
|
||||
local a = _local_0_[1]
|
||||
local fennel = _local_0_[2]
|
||||
local fs = _local_0_[3]
|
||||
local nvim = _local_0_[4]
|
||||
local _2amodule_2a = _0_
|
||||
local _2amodule_name_2a = "conjure-macroexpand.aniseed.compile"
|
||||
do local _ = ({nil, _0_, nil, {{}, nil, nil, nil}})[2] end
|
||||
local macros_prefix
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function macros_prefix0(code, opts)
|
||||
local macros_module = "conjure-macroexpand.aniseed.macros"
|
||||
local filename
|
||||
do
|
||||
local _3_ = a.get(opts, "filename")
|
||||
if _3_ then
|
||||
filename = string.gsub(_3_, (nvim.fn.getcwd() .. "/"), "")
|
||||
else
|
||||
filename = _3_
|
||||
end
|
||||
end
|
||||
local _4_
|
||||
if filename then
|
||||
_4_ = ("\"" .. filename .. "\"")
|
||||
else
|
||||
_4_ = "nil"
|
||||
end
|
||||
return ("(local *file* " .. _4_ .. ")" .. "(require-macros \"" .. macros_module .. "\")\n" .. code)
|
||||
end
|
||||
v_0_0 = macros_prefix0
|
||||
_0_["macros-prefix"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["macros-prefix"] = v_0_
|
||||
macros_prefix = v_0_
|
||||
end
|
||||
local str
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function str0(code, opts)
|
||||
local fnl = fennel.impl()
|
||||
local function _3_()
|
||||
return fnl.compileString(macros_prefix(code, opts), a.merge({allowedGlobals = false}, opts))
|
||||
end
|
||||
return xpcall(_3_, fnl.traceback)
|
||||
end
|
||||
v_0_0 = str0
|
||||
_0_["str"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["str"] = v_0_
|
||||
str = v_0_
|
||||
end
|
||||
local file
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function file0(src, dest)
|
||||
local code = a.slurp(src)
|
||||
local _3_, _4_ = str(code, {filename = src})
|
||||
if ((_3_ == false) and (nil ~= _4_)) then
|
||||
local err = _4_
|
||||
return nvim.err_writeln(err)
|
||||
elseif ((_3_ == true) and (nil ~= _4_)) then
|
||||
local result = _4_
|
||||
fs.mkdirp(fs.basename(dest))
|
||||
return a.spit(dest, result)
|
||||
end
|
||||
end
|
||||
v_0_0 = file0
|
||||
_0_["file"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["file"] = v_0_
|
||||
file = v_0_
|
||||
end
|
||||
local glob
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function glob0(src_expr, src_dir, dest_dir)
|
||||
for _, path in ipairs(fs.relglob(src_dir, src_expr)) do
|
||||
if fs["macro-file-path?"](path) then
|
||||
a.spit((dest_dir .. path), a.slurp((src_dir .. path)))
|
||||
else
|
||||
file((src_dir .. path), string.gsub((dest_dir .. path), ".fnl$", ".lua"))
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
v_0_0 = glob0
|
||||
_0_["glob"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["glob"] = v_0_
|
||||
glob = v_0_
|
||||
end
|
||||
return nil
|
957
lua/conjure-macroexpand/aniseed/core.lua
Normal file
957
lua/conjure-macroexpand/aniseed/core.lua
Normal file
@ -0,0 +1,957 @@
|
||||
local _2afile_2a = "fnl/aniseed/core.fnl"
|
||||
local _0_
|
||||
do
|
||||
local name_0_ = "conjure-macroexpand.aniseed.core"
|
||||
local module_0_
|
||||
do
|
||||
local x_0_ = package.loaded[name_0_]
|
||||
if ("table" == type(x_0_)) then
|
||||
module_0_ = x_0_
|
||||
else
|
||||
module_0_ = {}
|
||||
end
|
||||
end
|
||||
module_0_["aniseed/module"] = name_0_
|
||||
module_0_["aniseed/locals"] = ((module_0_)["aniseed/locals"] or {})
|
||||
do end (module_0_)["aniseed/local-fns"] = ((module_0_)["aniseed/local-fns"] or {})
|
||||
do end (package.loaded)[name_0_] = module_0_
|
||||
_0_ = module_0_
|
||||
end
|
||||
local autoload
|
||||
local function _1_(...)
|
||||
return (require("conjure-macroexpand.aniseed.autoload")).autoload(...)
|
||||
end
|
||||
autoload = _1_
|
||||
local function _2_(...)
|
||||
local ok_3f_0_, val_0_ = nil, nil
|
||||
local function _2_()
|
||||
return {autoload("conjure-macroexpand.aniseed.view")}
|
||||
end
|
||||
ok_3f_0_, val_0_ = pcall(_2_)
|
||||
if ok_3f_0_ then
|
||||
_0_["aniseed/local-fns"] = {autoload = {view = "conjure-macroexpand.aniseed.view"}}
|
||||
return val_0_
|
||||
else
|
||||
return print(val_0_)
|
||||
end
|
||||
end
|
||||
local _local_0_ = _2_(...)
|
||||
local view = _local_0_[1]
|
||||
local _2amodule_2a = _0_
|
||||
local _2amodule_name_2a = "conjure-macroexpand.aniseed.core"
|
||||
do local _ = ({nil, _0_, nil, {{}, nil, nil, nil}})[2] end
|
||||
math.randomseed(os.time())
|
||||
local rand
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function rand0(n)
|
||||
return (math.random() * (n or 1))
|
||||
end
|
||||
v_0_0 = rand0
|
||||
_0_["rand"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["rand"] = v_0_
|
||||
rand = v_0_
|
||||
end
|
||||
local string_3f
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function string_3f0(x)
|
||||
return ("string" == type(x))
|
||||
end
|
||||
v_0_0 = string_3f0
|
||||
_0_["string?"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["string?"] = v_0_
|
||||
string_3f = v_0_
|
||||
end
|
||||
local nil_3f
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function nil_3f0(x)
|
||||
return (nil == x)
|
||||
end
|
||||
v_0_0 = nil_3f0
|
||||
_0_["nil?"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["nil?"] = v_0_
|
||||
nil_3f = v_0_
|
||||
end
|
||||
local table_3f
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function table_3f0(x)
|
||||
return ("table" == type(x))
|
||||
end
|
||||
v_0_0 = table_3f0
|
||||
_0_["table?"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["table?"] = v_0_
|
||||
table_3f = v_0_
|
||||
end
|
||||
local count
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function count0(xs)
|
||||
if table_3f(xs) then
|
||||
return table.maxn(xs)
|
||||
elseif not xs then
|
||||
return 0
|
||||
else
|
||||
return #xs
|
||||
end
|
||||
end
|
||||
v_0_0 = count0
|
||||
_0_["count"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["count"] = v_0_
|
||||
count = v_0_
|
||||
end
|
||||
local empty_3f
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function empty_3f0(xs)
|
||||
return (0 == count(xs))
|
||||
end
|
||||
v_0_0 = empty_3f0
|
||||
_0_["empty?"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["empty?"] = v_0_
|
||||
empty_3f = v_0_
|
||||
end
|
||||
local first
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function first0(xs)
|
||||
if xs then
|
||||
return xs[1]
|
||||
end
|
||||
end
|
||||
v_0_0 = first0
|
||||
_0_["first"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["first"] = v_0_
|
||||
first = v_0_
|
||||
end
|
||||
local second
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function second0(xs)
|
||||
if xs then
|
||||
return xs[2]
|
||||
end
|
||||
end
|
||||
v_0_0 = second0
|
||||
_0_["second"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["second"] = v_0_
|
||||
second = v_0_
|
||||
end
|
||||
local last
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function last0(xs)
|
||||
if xs then
|
||||
return xs[count(xs)]
|
||||
end
|
||||
end
|
||||
v_0_0 = last0
|
||||
_0_["last"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["last"] = v_0_
|
||||
last = v_0_
|
||||
end
|
||||
local inc
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function inc0(n)
|
||||
return (n + 1)
|
||||
end
|
||||
v_0_0 = inc0
|
||||
_0_["inc"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["inc"] = v_0_
|
||||
inc = v_0_
|
||||
end
|
||||
local dec
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function dec0(n)
|
||||
return (n - 1)
|
||||
end
|
||||
v_0_0 = dec0
|
||||
_0_["dec"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["dec"] = v_0_
|
||||
dec = v_0_
|
||||
end
|
||||
local even_3f
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function even_3f0(n)
|
||||
return ((n % 2) == 0)
|
||||
end
|
||||
v_0_0 = even_3f0
|
||||
_0_["even?"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["even?"] = v_0_
|
||||
even_3f = v_0_
|
||||
end
|
||||
local odd_3f
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function odd_3f0(n)
|
||||
return not even_3f(n)
|
||||
end
|
||||
v_0_0 = odd_3f0
|
||||
_0_["odd?"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["odd?"] = v_0_
|
||||
odd_3f = v_0_
|
||||
end
|
||||
local keys
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function keys0(t)
|
||||
local result = {}
|
||||
if t then
|
||||
for k, _ in pairs(t) do
|
||||
table.insert(result, k)
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
v_0_0 = keys0
|
||||
_0_["keys"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["keys"] = v_0_
|
||||
keys = v_0_
|
||||
end
|
||||
local vals
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function vals0(t)
|
||||
local result = {}
|
||||
if t then
|
||||
for _, v in pairs(t) do
|
||||
table.insert(result, v)
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
v_0_0 = vals0
|
||||
_0_["vals"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["vals"] = v_0_
|
||||
vals = v_0_
|
||||
end
|
||||
local kv_pairs
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function kv_pairs0(t)
|
||||
local result = {}
|
||||
if t then
|
||||
for k, v in pairs(t) do
|
||||
table.insert(result, {k, v})
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
v_0_0 = kv_pairs0
|
||||
_0_["kv-pairs"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["kv-pairs"] = v_0_
|
||||
kv_pairs = v_0_
|
||||
end
|
||||
local run_21
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function run_210(f, xs)
|
||||
if xs then
|
||||
local nxs = count(xs)
|
||||
if (nxs > 0) then
|
||||
for i = 1, nxs do
|
||||
f(xs[i])
|
||||
end
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
v_0_0 = run_210
|
||||
_0_["run!"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["run!"] = v_0_
|
||||
run_21 = v_0_
|
||||
end
|
||||
local filter
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function filter0(f, xs)
|
||||
local result = {}
|
||||
local function _3_(x)
|
||||
if f(x) then
|
||||
return table.insert(result, x)
|
||||
end
|
||||
end
|
||||
run_21(_3_, xs)
|
||||
return result
|
||||
end
|
||||
v_0_0 = filter0
|
||||
_0_["filter"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["filter"] = v_0_
|
||||
filter = v_0_
|
||||
end
|
||||
local map
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function map0(f, xs)
|
||||
local result = {}
|
||||
local function _3_(x)
|
||||
local mapped = f(x)
|
||||
local function _4_()
|
||||
if (0 == select("#", mapped)) then
|
||||
return nil
|
||||
else
|
||||
return mapped
|
||||
end
|
||||
end
|
||||
return table.insert(result, _4_())
|
||||
end
|
||||
run_21(_3_, xs)
|
||||
return result
|
||||
end
|
||||
v_0_0 = map0
|
||||
_0_["map"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["map"] = v_0_
|
||||
map = v_0_
|
||||
end
|
||||
local map_indexed
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function map_indexed0(f, xs)
|
||||
return map(f, kv_pairs(xs))
|
||||
end
|
||||
v_0_0 = map_indexed0
|
||||
_0_["map-indexed"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["map-indexed"] = v_0_
|
||||
map_indexed = v_0_
|
||||
end
|
||||
local identity
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function identity0(x)
|
||||
return x
|
||||
end
|
||||
v_0_0 = identity0
|
||||
_0_["identity"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["identity"] = v_0_
|
||||
identity = v_0_
|
||||
end
|
||||
local reduce
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function reduce0(f, init, xs)
|
||||
local result = init
|
||||
local function _3_(x)
|
||||
result = f(result, x)
|
||||
return nil
|
||||
end
|
||||
run_21(_3_, xs)
|
||||
return result
|
||||
end
|
||||
v_0_0 = reduce0
|
||||
_0_["reduce"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["reduce"] = v_0_
|
||||
reduce = v_0_
|
||||
end
|
||||
local some
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function some0(f, xs)
|
||||
local result = nil
|
||||
local n = 1
|
||||
while (nil_3f(result) and (n <= count(xs))) do
|
||||
local candidate = f(xs[n])
|
||||
if candidate then
|
||||
result = candidate
|
||||
end
|
||||
n = inc(n)
|
||||
end
|
||||
return result
|
||||
end
|
||||
v_0_0 = some0
|
||||
_0_["some"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["some"] = v_0_
|
||||
some = v_0_
|
||||
end
|
||||
local butlast
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function butlast0(xs)
|
||||
local total = count(xs)
|
||||
local function _4_(_3_)
|
||||
local _arg_0_ = _3_
|
||||
local n = _arg_0_[1]
|
||||
local v = _arg_0_[2]
|
||||
return (n ~= total)
|
||||
end
|
||||
return map(second, filter(_4_, kv_pairs(xs)))
|
||||
end
|
||||
v_0_0 = butlast0
|
||||
_0_["butlast"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["butlast"] = v_0_
|
||||
butlast = v_0_
|
||||
end
|
||||
local rest
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function rest0(xs)
|
||||
local function _4_(_3_)
|
||||
local _arg_0_ = _3_
|
||||
local n = _arg_0_[1]
|
||||
local v = _arg_0_[2]
|
||||
return (n ~= 1)
|
||||
end
|
||||
return map(second, filter(_4_, kv_pairs(xs)))
|
||||
end
|
||||
v_0_0 = rest0
|
||||
_0_["rest"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["rest"] = v_0_
|
||||
rest = v_0_
|
||||
end
|
||||
local concat
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function concat0(...)
|
||||
local result = {}
|
||||
local function _3_(xs)
|
||||
local function _4_(x)
|
||||
return table.insert(result, x)
|
||||
end
|
||||
return run_21(_4_, xs)
|
||||
end
|
||||
run_21(_3_, {...})
|
||||
return result
|
||||
end
|
||||
v_0_0 = concat0
|
||||
_0_["concat"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["concat"] = v_0_
|
||||
concat = v_0_
|
||||
end
|
||||
local mapcat
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function mapcat0(f, xs)
|
||||
return concat(unpack(map(f, xs)))
|
||||
end
|
||||
v_0_0 = mapcat0
|
||||
_0_["mapcat"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["mapcat"] = v_0_
|
||||
mapcat = v_0_
|
||||
end
|
||||
local pr_str
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function pr_str0(...)
|
||||
local s
|
||||
local function _3_(x)
|
||||
return view.serialise(x, {["one-line"] = true})
|
||||
end
|
||||
s = table.concat(map(_3_, {...}), " ")
|
||||
if (nil_3f(s) or ("" == s)) then
|
||||
return "nil"
|
||||
else
|
||||
return s
|
||||
end
|
||||
end
|
||||
v_0_0 = pr_str0
|
||||
_0_["pr-str"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["pr-str"] = v_0_
|
||||
pr_str = v_0_
|
||||
end
|
||||
local str
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function str0(...)
|
||||
local function _3_(acc, s)
|
||||
return (acc .. s)
|
||||
end
|
||||
local function _4_(s)
|
||||
if string_3f(s) then
|
||||
return s
|
||||
else
|
||||
return pr_str(s)
|
||||
end
|
||||
end
|
||||
return reduce(_3_, "", map(_4_, {...}))
|
||||
end
|
||||
v_0_0 = str0
|
||||
_0_["str"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["str"] = v_0_
|
||||
str = v_0_
|
||||
end
|
||||
local println
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function println0(...)
|
||||
local function _3_(acc, s)
|
||||
return (acc .. s)
|
||||
end
|
||||
local function _5_(_4_)
|
||||
local _arg_0_ = _4_
|
||||
local i = _arg_0_[1]
|
||||
local s = _arg_0_[2]
|
||||
if (1 == i) then
|
||||
return s
|
||||
else
|
||||
return (" " .. s)
|
||||
end
|
||||
end
|
||||
local function _6_(s)
|
||||
if string_3f(s) then
|
||||
return s
|
||||
else
|
||||
return pr_str(s)
|
||||
end
|
||||
end
|
||||
return print(reduce(_3_, "", map_indexed(_5_, map(_6_, {...}))))
|
||||
end
|
||||
v_0_0 = println0
|
||||
_0_["println"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["println"] = v_0_
|
||||
println = v_0_
|
||||
end
|
||||
local pr
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function pr0(...)
|
||||
return println(pr_str(...))
|
||||
end
|
||||
v_0_0 = pr0
|
||||
_0_["pr"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["pr"] = v_0_
|
||||
pr = v_0_
|
||||
end
|
||||
local slurp
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function slurp0(path, silent_3f)
|
||||
local _3_, _4_ = io.open(path, "r")
|
||||
if ((_3_ == nil) and (nil ~= _4_)) then
|
||||
local msg = _4_
|
||||
return nil
|
||||
elseif (nil ~= _3_) then
|
||||
local f = _3_
|
||||
local content = f:read("*all")
|
||||
f:close()
|
||||
return content
|
||||
end
|
||||
end
|
||||
v_0_0 = slurp0
|
||||
_0_["slurp"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["slurp"] = v_0_
|
||||
slurp = v_0_
|
||||
end
|
||||
local spit
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function spit0(path, content)
|
||||
local _3_, _4_ = io.open(path, "w")
|
||||
if ((_3_ == nil) and (nil ~= _4_)) then
|
||||
local msg = _4_
|
||||
return error(("Could not open file: " .. msg))
|
||||
elseif (nil ~= _3_) then
|
||||
local f = _3_
|
||||
f:write(content)
|
||||
f:close()
|
||||
return nil
|
||||
end
|
||||
end
|
||||
v_0_0 = spit0
|
||||
_0_["spit"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["spit"] = v_0_
|
||||
spit = v_0_
|
||||
end
|
||||
local merge_21
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function merge_210(base, ...)
|
||||
local function _3_(acc, m)
|
||||
if m then
|
||||
for k, v in pairs(m) do
|
||||
acc[k] = v
|
||||
end
|
||||
end
|
||||
return acc
|
||||
end
|
||||
return reduce(_3_, (base or {}), {...})
|
||||
end
|
||||
v_0_0 = merge_210
|
||||
_0_["merge!"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["merge!"] = v_0_
|
||||
merge_21 = v_0_
|
||||
end
|
||||
local merge
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function merge0(...)
|
||||
return merge_21({}, ...)
|
||||
end
|
||||
v_0_0 = merge0
|
||||
_0_["merge"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["merge"] = v_0_
|
||||
merge = v_0_
|
||||
end
|
||||
local select_keys
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function select_keys0(t, ks)
|
||||
if (t and ks) then
|
||||
local function _3_(acc, k)
|
||||
if k then
|
||||
acc[k] = t[k]
|
||||
end
|
||||
return acc
|
||||
end
|
||||
return reduce(_3_, {}, ks)
|
||||
else
|
||||
return {}
|
||||
end
|
||||
end
|
||||
v_0_0 = select_keys0
|
||||
_0_["select-keys"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["select-keys"] = v_0_
|
||||
select_keys = v_0_
|
||||
end
|
||||
local get
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function get0(t, k, d)
|
||||
local res
|
||||
if table_3f(t) then
|
||||
local val = t[k]
|
||||
if not nil_3f(val) then
|
||||
res = val
|
||||
else
|
||||
res = nil
|
||||
end
|
||||
else
|
||||
res = nil
|
||||
end
|
||||
if nil_3f(res) then
|
||||
return d
|
||||
else
|
||||
return res
|
||||
end
|
||||
end
|
||||
v_0_0 = get0
|
||||
_0_["get"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["get"] = v_0_
|
||||
get = v_0_
|
||||
end
|
||||
local get_in
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function get_in0(t, ks, d)
|
||||
local res
|
||||
local function _3_(acc, k)
|
||||
if table_3f(acc) then
|
||||
return get(acc, k)
|
||||
end
|
||||
end
|
||||
res = reduce(_3_, t, ks)
|
||||
if nil_3f(res) then
|
||||
return d
|
||||
else
|
||||
return res
|
||||
end
|
||||
end
|
||||
v_0_0 = get_in0
|
||||
_0_["get-in"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["get-in"] = v_0_
|
||||
get_in = v_0_
|
||||
end
|
||||
local assoc
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function assoc0(t, ...)
|
||||
local _let_0_ = {...}
|
||||
local k = _let_0_[1]
|
||||
local v = _let_0_[2]
|
||||
local xs = {(table.unpack or unpack)(_let_0_, 3)}
|
||||
local rem = count(xs)
|
||||
local t0 = (t or {})
|
||||
if odd_3f(rem) then
|
||||
error("assoc expects even number of arguments after table, found odd number")
|
||||
end
|
||||
if not nil_3f(k) then
|
||||
t0[k] = v
|
||||
end
|
||||
if (rem > 0) then
|
||||
assoc0(t0, unpack(xs))
|
||||
end
|
||||
return t0
|
||||
end
|
||||
v_0_0 = assoc0
|
||||
_0_["assoc"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["assoc"] = v_0_
|
||||
assoc = v_0_
|
||||
end
|
||||
local assoc_in
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function assoc_in0(t, ks, v)
|
||||
local path = butlast(ks)
|
||||
local final = last(ks)
|
||||
local t0 = (t or {})
|
||||
local function _3_(acc, k)
|
||||
local step = get(acc, k)
|
||||
if nil_3f(step) then
|
||||
return get(assoc(acc, k, {}), k)
|
||||
else
|
||||
return step
|
||||
end
|
||||
end
|
||||
assoc(reduce(_3_, t0, path), final, v)
|
||||
return t0
|
||||
end
|
||||
v_0_0 = assoc_in0
|
||||
_0_["assoc-in"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["assoc-in"] = v_0_
|
||||
assoc_in = v_0_
|
||||
end
|
||||
local update
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function update0(t, k, f)
|
||||
return assoc(t, k, f(get(t, k)))
|
||||
end
|
||||
v_0_0 = update0
|
||||
_0_["update"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["update"] = v_0_
|
||||
update = v_0_
|
||||
end
|
||||
local update_in
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function update_in0(t, ks, f)
|
||||
return assoc_in(t, ks, f(get_in(t, ks)))
|
||||
end
|
||||
v_0_0 = update_in0
|
||||
_0_["update-in"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["update-in"] = v_0_
|
||||
update_in = v_0_
|
||||
end
|
||||
local constantly
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function constantly0(v)
|
||||
local function _3_()
|
||||
return v
|
||||
end
|
||||
return _3_
|
||||
end
|
||||
v_0_0 = constantly0
|
||||
_0_["constantly"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["constantly"] = v_0_
|
||||
constantly = v_0_
|
||||
end
|
||||
return nil
|
4267
lua/conjure-macroexpand/aniseed/deps/fennel.lua
Normal file
4267
lua/conjure-macroexpand/aniseed/deps/fennel.lua
Normal file
File diff suppressed because it is too large
Load Diff
382
lua/conjure-macroexpand/aniseed/deps/fennelview.lua
Normal file
382
lua/conjure-macroexpand/aniseed/deps/fennelview.lua
Normal file
@ -0,0 +1,382 @@
|
||||
local type_order = {["function"] = 5, boolean = 2, number = 1, string = 3, table = 4, thread = 7, userdata = 6}
|
||||
local function sort_keys(_0_0, _1_0)
|
||||
local _1_ = _0_0
|
||||
local a = _1_[1]
|
||||
local _2_ = _1_0
|
||||
local b = _2_[1]
|
||||
local ta = type(a)
|
||||
local tb = type(b)
|
||||
if ((ta == tb) and ((ta == "string") or (ta == "number"))) then
|
||||
return (a < b)
|
||||
else
|
||||
local dta = type_order[ta]
|
||||
local dtb = type_order[tb]
|
||||
if (dta and dtb) then
|
||||
return (dta < dtb)
|
||||
elseif dta then
|
||||
return true
|
||||
elseif dtb then
|
||||
return false
|
||||
else
|
||||
return (ta < tb)
|
||||
end
|
||||
end
|
||||
end
|
||||
local function table_kv_pairs(t)
|
||||
local assoc_3f = false
|
||||
local i = 1
|
||||
local kv = {}
|
||||
local insert = table.insert
|
||||
for k, v in pairs(t) do
|
||||
if ((type(k) ~= "number") or (k ~= i)) then
|
||||
assoc_3f = true
|
||||
end
|
||||
i = (i + 1)
|
||||
insert(kv, {k, v})
|
||||
end
|
||||
table.sort(kv, sort_keys)
|
||||
if (#kv == 0) then
|
||||
return kv, "empty"
|
||||
else
|
||||
local function _2_()
|
||||
if assoc_3f then
|
||||
return "table"
|
||||
else
|
||||
return "seq"
|
||||
end
|
||||
end
|
||||
return kv, _2_()
|
||||
end
|
||||
end
|
||||
local function count_table_appearances(t, appearances)
|
||||
if (type(t) == "table") then
|
||||
if not appearances[t] then
|
||||
appearances[t] = 1
|
||||
for k, v in pairs(t) do
|
||||
count_table_appearances(k, appearances)
|
||||
count_table_appearances(v, appearances)
|
||||
end
|
||||
else
|
||||
appearances[t] = ((appearances[t] or 0) + 1)
|
||||
end
|
||||
end
|
||||
return appearances
|
||||
end
|
||||
local function save_table(t, seen)
|
||||
local seen0 = (seen or {len = 0})
|
||||
local id = (seen0.len + 1)
|
||||
if not seen0[t] then
|
||||
seen0[t] = id
|
||||
seen0.len = id
|
||||
end
|
||||
return seen0
|
||||
end
|
||||
local function detect_cycle(t, seen, _3fk)
|
||||
if ("table" == type(t)) then
|
||||
seen[t] = true
|
||||
local _2_0, _3_0 = next(t, _3fk)
|
||||
if ((nil ~= _2_0) and (nil ~= _3_0)) then
|
||||
local k = _2_0
|
||||
local v = _3_0
|
||||
return (seen[k] or detect_cycle(k, seen) or seen[v] or detect_cycle(v, seen) or detect_cycle(t, seen, k))
|
||||
end
|
||||
end
|
||||
end
|
||||
local function visible_cycle_3f(t, options)
|
||||
return (options["detect-cycles?"] and detect_cycle(t, {}) and save_table(t, options.seen) and (1 < (options.appearances[t] or 0)))
|
||||
end
|
||||
local function table_indent(t, indent, id)
|
||||
local opener_length = nil
|
||||
if id then
|
||||
opener_length = (#tostring(id) + 2)
|
||||
else
|
||||
opener_length = 1
|
||||
end
|
||||
return (indent + opener_length)
|
||||
end
|
||||
local pp = nil
|
||||
local function concat_table_lines(elements, options, multiline_3f, indent, table_type, prefix)
|
||||
local indent_str = ("\n" .. string.rep(" ", indent))
|
||||
local open = nil
|
||||
local function _2_()
|
||||
if ("seq" == table_type) then
|
||||
return "["
|
||||
else
|
||||
return "{"
|
||||
end
|
||||
end
|
||||
open = ((prefix or "") .. _2_())
|
||||
local close = nil
|
||||
if ("seq" == table_type) then
|
||||
close = "]"
|
||||
else
|
||||
close = "}"
|
||||
end
|
||||
local oneline = (open .. table.concat(elements, " ") .. close)
|
||||
if (not options["one-line?"] and (multiline_3f or ((indent + #oneline) > options["line-length"]))) then
|
||||
return (open .. table.concat(elements, indent_str) .. close)
|
||||
else
|
||||
return oneline
|
||||
end
|
||||
end
|
||||
local function pp_associative(t, kv, options, indent, key_3f)
|
||||
local multiline_3f = false
|
||||
local id = options.seen[t]
|
||||
if (options.level >= options.depth) then
|
||||
return "{...}"
|
||||
elseif (id and options["detect-cycles?"]) then
|
||||
return ("@" .. id .. "{...}")
|
||||
else
|
||||
local visible_cycle_3f0 = visible_cycle_3f(t, options)
|
||||
local id0 = (visible_cycle_3f0 and options.seen[t])
|
||||
local indent0 = table_indent(t, indent, id0)
|
||||
local slength = nil
|
||||
local function _3_()
|
||||
local _2_0 = rawget(_G, "utf8")
|
||||
if _2_0 then
|
||||
return _2_0.len
|
||||
else
|
||||
return _2_0
|
||||
end
|
||||
end
|
||||
local function _4_(_241)
|
||||
return #_241
|
||||
end
|
||||
slength = ((options["utf8?"] and _3_()) or _4_)
|
||||
local prefix = nil
|
||||
if visible_cycle_3f0 then
|
||||
prefix = ("@" .. id0)
|
||||
else
|
||||
prefix = ""
|
||||
end
|
||||
local items = nil
|
||||
do
|
||||
local tbl_0_ = {}
|
||||
for _, _6_0 in pairs(kv) do
|
||||
local _7_ = _6_0
|
||||
local k = _7_[1]
|
||||
local v = _7_[2]
|
||||
local _8_
|
||||
do
|
||||
local k0 = pp(k, options, (indent0 + 1), true)
|
||||
local v0 = pp(v, options, (indent0 + slength(k0) + 1))
|
||||
multiline_3f = (multiline_3f or k0:find("\n") or v0:find("\n"))
|
||||
_8_ = (k0 .. " " .. v0)
|
||||
end
|
||||
tbl_0_[(#tbl_0_ + 1)] = _8_
|
||||
end
|
||||
items = tbl_0_
|
||||
end
|
||||
return concat_table_lines(items, options, multiline_3f, indent0, "table", prefix)
|
||||
end
|
||||
end
|
||||
local function pp_sequence(t, kv, options, indent)
|
||||
local multiline_3f = false
|
||||
local id = options.seen[t]
|
||||
if (options.level >= options.depth) then
|
||||
return "[...]"
|
||||
elseif (id and options["detect-cycles?"]) then
|
||||
return ("@" .. id .. "[...]")
|
||||
else
|
||||
local visible_cycle_3f0 = visible_cycle_3f(t, options)
|
||||
local id0 = (visible_cycle_3f0 and options.seen[t])
|
||||
local indent0 = table_indent(t, indent, id0)
|
||||
local prefix = nil
|
||||
if visible_cycle_3f0 then
|
||||
prefix = ("@" .. id0)
|
||||
else
|
||||
prefix = ""
|
||||
end
|
||||
local items = nil
|
||||
do
|
||||
local tbl_0_ = {}
|
||||
for _, _3_0 in pairs(kv) do
|
||||
local _4_ = _3_0
|
||||
local _0 = _4_[1]
|
||||
local v = _4_[2]
|
||||
local _5_
|
||||
do
|
||||
local v0 = pp(v, options, indent0)
|
||||
multiline_3f = (multiline_3f or v0:find("\n"))
|
||||
_5_ = v0
|
||||
end
|
||||
tbl_0_[(#tbl_0_ + 1)] = _5_
|
||||
end
|
||||
items = tbl_0_
|
||||
end
|
||||
return concat_table_lines(items, options, multiline_3f, indent0, "seq", prefix)
|
||||
end
|
||||
end
|
||||
local function concat_lines(lines, options, indent, force_multi_line_3f)
|
||||
if (#lines == 0) then
|
||||
if options["empty-as-sequence?"] then
|
||||
return "[]"
|
||||
else
|
||||
return "{}"
|
||||
end
|
||||
else
|
||||
local oneline = nil
|
||||
local _2_
|
||||
do
|
||||
local tbl_0_ = {}
|
||||
for _, line in ipairs(lines) do
|
||||
tbl_0_[(#tbl_0_ + 1)] = line:gsub("^%s+", "")
|
||||
end
|
||||
_2_ = tbl_0_
|
||||
end
|
||||
oneline = table.concat(_2_, " ")
|
||||
if (not options["one-line?"] and (force_multi_line_3f or oneline:find("\n") or ((indent + #oneline) > options["line-length"]))) then
|
||||
return table.concat(lines, ("\n" .. string.rep(" ", indent)))
|
||||
else
|
||||
return oneline
|
||||
end
|
||||
end
|
||||
end
|
||||
local function pp_metamethod(t, metamethod, options, indent)
|
||||
if (options.level >= options.depth) then
|
||||
if options["empty-as-sequence?"] then
|
||||
return "[...]"
|
||||
else
|
||||
return "{...}"
|
||||
end
|
||||
else
|
||||
local _ = nil
|
||||
local function _2_(_241)
|
||||
return visible_cycle_3f(_241, options)
|
||||
end
|
||||
options["visible-cycle?"] = _2_
|
||||
_ = nil
|
||||
local lines, force_multi_line_3f = metamethod(t, pp, options, indent)
|
||||
options["visible-cycle?"] = nil
|
||||
local _3_0 = type(lines)
|
||||
if (_3_0 == "string") then
|
||||
return lines
|
||||
elseif (_3_0 == "table") then
|
||||
return concat_lines(lines, options, indent, force_multi_line_3f)
|
||||
else
|
||||
local _0 = _3_0
|
||||
return error("__fennelview metamethod must return a table of lines")
|
||||
end
|
||||
end
|
||||
end
|
||||
local function pp_table(x, options, indent)
|
||||
options.level = (options.level + 1)
|
||||
local x0 = nil
|
||||
do
|
||||
local _2_0 = nil
|
||||
if options["metamethod?"] then
|
||||
local _3_0 = x
|
||||
if _3_0 then
|
||||
local _4_0 = getmetatable(_3_0)
|
||||
if _4_0 then
|
||||
_2_0 = _4_0.__fennelview
|
||||
else
|
||||
_2_0 = _4_0
|
||||
end
|
||||
else
|
||||
_2_0 = _3_0
|
||||
end
|
||||
else
|
||||
_2_0 = nil
|
||||
end
|
||||
if (nil ~= _2_0) then
|
||||
local metamethod = _2_0
|
||||
x0 = pp_metamethod(x, metamethod, options, indent)
|
||||
else
|
||||
local _ = _2_0
|
||||
local _4_0, _5_0 = table_kv_pairs(x)
|
||||
if (true and (_5_0 == "empty")) then
|
||||
local _0 = _4_0
|
||||
if options["empty-as-sequence?"] then
|
||||
x0 = "[]"
|
||||
else
|
||||
x0 = "{}"
|
||||
end
|
||||
elseif ((nil ~= _4_0) and (_5_0 == "table")) then
|
||||
local kv = _4_0
|
||||
x0 = pp_associative(x, kv, options, indent)
|
||||
elseif ((nil ~= _4_0) and (_5_0 == "seq")) then
|
||||
local kv = _4_0
|
||||
x0 = pp_sequence(x, kv, options, indent)
|
||||
else
|
||||
x0 = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
options.level = (options.level - 1)
|
||||
return x0
|
||||
end
|
||||
local function number__3estring(n)
|
||||
local _2_0 = string.gsub(tostring(n), ",", ".")
|
||||
return _2_0
|
||||
end
|
||||
local function colon_string_3f(s)
|
||||
return s:find("^[-%w?^_!$%&*+./@|<=>]+$")
|
||||
end
|
||||
local function pp_string(str, options, indent)
|
||||
local escs = nil
|
||||
local _2_
|
||||
if (options["escape-newlines?"] and (#str < (options["line-length"] - indent))) then
|
||||
_2_ = "\\n"
|
||||
else
|
||||
_2_ = "\n"
|
||||
end
|
||||
local function _4_(_241, _242)
|
||||
return ("\\%03d"):format(_242:byte())
|
||||
end
|
||||
escs = setmetatable({["\""] = "\\\"", ["\11"] = "\\v", ["\12"] = "\\f", ["\13"] = "\\r", ["\7"] = "\\a", ["\8"] = "\\b", ["\9"] = "\\t", ["\\"] = "\\\\", ["\n"] = _2_}, {__index = _4_})
|
||||
return ("\"" .. str:gsub("[%c\\\"]", escs) .. "\"")
|
||||
end
|
||||
local function make_options(t, options)
|
||||
local defaults = {["detect-cycles?"] = true, ["empty-as-sequence?"] = false, ["escape-newlines?"] = false, ["line-length"] = 80, ["metamethod?"] = true, ["one-line?"] = false, ["prefer-colon?"] = false, ["utf8?"] = true, depth = 128}
|
||||
local overrides = {appearances = count_table_appearances(t, {}), level = 0, seen = {len = 0}}
|
||||
for k, v in pairs((options or {})) do
|
||||
defaults[k] = v
|
||||
end
|
||||
for k, v in pairs(overrides) do
|
||||
defaults[k] = v
|
||||
end
|
||||
return defaults
|
||||
end
|
||||
local function _2_(x, options, indent, colon_3f)
|
||||
local indent0 = (indent or 0)
|
||||
local options0 = (options or make_options(x))
|
||||
local tv = type(x)
|
||||
local function _4_()
|
||||
local _3_0 = getmetatable(x)
|
||||
if _3_0 then
|
||||
return _3_0.__fennelview
|
||||
else
|
||||
return _3_0
|
||||
end
|
||||
end
|
||||
if ((tv == "table") or ((tv == "userdata") and _4_())) then
|
||||
return pp_table(x, options0, indent0)
|
||||
elseif (tv == "number") then
|
||||
return number__3estring(x)
|
||||
else
|
||||
local function _5_()
|
||||
if (colon_3f ~= nil) then
|
||||
return colon_3f
|
||||
elseif ("function" == type(options0["prefer-colon?"])) then
|
||||
return options0["prefer-colon?"](x)
|
||||
else
|
||||
return options0["prefer-colon?"]
|
||||
end
|
||||
end
|
||||
if ((tv == "string") and colon_string_3f(x) and _5_()) then
|
||||
return (":" .. x)
|
||||
elseif (tv == "string") then
|
||||
return pp_string(x, options0, indent0)
|
||||
elseif ((tv == "boolean") or (tv == "nil")) then
|
||||
return tostring(x)
|
||||
else
|
||||
return ("#<" .. tostring(x) .. ">")
|
||||
end
|
||||
end
|
||||
end
|
||||
pp = _2_
|
||||
local function view(x, options)
|
||||
return pp(x, make_options(x, options), 0)
|
||||
end
|
||||
return view
|
220
lua/conjure-macroexpand/aniseed/deps/nvim.lua
Normal file
220
lua/conjure-macroexpand/aniseed/deps/nvim.lua
Normal file
@ -0,0 +1,220 @@
|
||||
-- Bring vim into local scope.
|
||||
local vim = vim
|
||||
local api = vim.api
|
||||
local inspect = vim.inspect
|
||||
|
||||
local function extend(t, o)
|
||||
local mt = getmetatable(t)
|
||||
for k, v in pairs(o) do
|
||||
rawset(mt, k, v)
|
||||
end
|
||||
return t
|
||||
end
|
||||
|
||||
-- Equivalent to `echo vim.inspect(...)`
|
||||
local function nvim_print(...)
|
||||
if select("#", ...) == 1 then
|
||||
api.nvim_out_write(inspect((...)))
|
||||
else
|
||||
api.nvim_out_write(inspect {...})
|
||||
end
|
||||
api.nvim_out_write("\n")
|
||||
end
|
||||
|
||||
--- Equivalent to `echo` EX command
|
||||
local function nvim_echo(...)
|
||||
for i = 1, select("#", ...) do
|
||||
local part = select(i, ...)
|
||||
api.nvim_out_write(tostring(part))
|
||||
-- vim.api.nvim_out_write("\n")
|
||||
api.nvim_out_write(" ")
|
||||
end
|
||||
api.nvim_out_write("\n")
|
||||
end
|
||||
|
||||
local window_options = {
|
||||
arab = true; arabic = true; breakindent = true; breakindentopt = true;
|
||||
bri = true; briopt = true; cc = true; cocu = true;
|
||||
cole = true; colorcolumn = true; concealcursor = true; conceallevel = true;
|
||||
crb = true; cuc = true; cul = true; cursorbind = true;
|
||||
cursorcolumn = true; cursorline = true; diff = true; fcs = true;
|
||||
fdc = true; fde = true; fdi = true; fdl = true;
|
||||
fdm = true; fdn = true; fdt = true; fen = true;
|
||||
fillchars = true; fml = true; fmr = true; foldcolumn = true;
|
||||
foldenable = true; foldexpr = true; foldignore = true; foldlevel = true;
|
||||
foldmarker = true; foldmethod = true; foldminlines = true; foldnestmax = true;
|
||||
foldtext = true; lbr = true; lcs = true; linebreak = true;
|
||||
list = true; listchars = true; nu = true; number = true;
|
||||
numberwidth = true; nuw = true; previewwindow = true; pvw = true;
|
||||
relativenumber = true; rightleft = true; rightleftcmd = true; rl = true;
|
||||
rlc = true; rnu = true; scb = true; scl = true;
|
||||
scr = true; scroll = true; scrollbind = true; signcolumn = true;
|
||||
spell = true; statusline = true; stl = true; wfh = true;
|
||||
wfw = true; winbl = true; winblend = true; winfixheight = true;
|
||||
winfixwidth = true; winhighlight = true; winhl = true; wrap = true;
|
||||
}
|
||||
|
||||
local function validate(conf)
|
||||
assert(type(conf) == 'table')
|
||||
local type_names = {
|
||||
t='table', s='string', n='number', b='boolean', f='function', c='callable',
|
||||
['table']='table', ['string']='string', ['number']='number',
|
||||
['boolean']='boolean', ['function']='function', ['callable']='callable',
|
||||
['nil']='nil', ['thread']='thread', ['userdata']='userdata',
|
||||
}
|
||||
for k, v in pairs(conf) do
|
||||
if not (v[3] and v[1] == nil) and type(v[1]) ~= type_names[v[2]] then
|
||||
error(string.format("validation_failed: %q: expected %s, received %s", k, type_names[v[2]], type(v[1])))
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
local function make_meta_accessor(get, set, del)
|
||||
validate {
|
||||
get = {get, 'f'};
|
||||
set = {set, 'f'};
|
||||
del = {del, 'f', true};
|
||||
}
|
||||
local mt = {}
|
||||
if del then
|
||||
function mt:__newindex(k, v)
|
||||
if v == nil then
|
||||
return del(k)
|
||||
end
|
||||
return set(k, v)
|
||||
end
|
||||
else
|
||||
function mt:__newindex(k, v)
|
||||
return set(k, v)
|
||||
end
|
||||
end
|
||||
function mt:__index(k)
|
||||
return get(k)
|
||||
end
|
||||
return setmetatable({}, mt)
|
||||
end
|
||||
|
||||
local function pcall_ret(status, ...)
|
||||
if status then return ... end
|
||||
end
|
||||
|
||||
local function nil_wrap(fn)
|
||||
return function(...)
|
||||
return pcall_ret(pcall(fn, ...))
|
||||
end
|
||||
end
|
||||
|
||||
local fn = setmetatable({}, {
|
||||
__index = function(t, k)
|
||||
local f = function(...) return api.nvim_call_function(k, {...}) end
|
||||
rawset(t, k, f)
|
||||
return f
|
||||
end
|
||||
})
|
||||
|
||||
local function getenv(k)
|
||||
local v = fn.getenv(k)
|
||||
if v == vim.NIL then
|
||||
return nil
|
||||
end
|
||||
return v
|
||||
end
|
||||
|
||||
local function new_win_accessor(winnr)
|
||||
local function get(k)
|
||||
if winnr == nil and type(k) == 'number' then
|
||||
return new_win_accessor(k)
|
||||
end
|
||||
return api.nvim_win_get_var(winnr or 0, k)
|
||||
end
|
||||
local function set(k, v) return api.nvim_win_set_var(winnr or 0, k, v) end
|
||||
local function del(k) return api.nvim_win_del_var(winnr or 0, k) end
|
||||
return make_meta_accessor(nil_wrap(get), set, del)
|
||||
end
|
||||
|
||||
local function new_win_opt_accessor(winnr)
|
||||
local function get(k)
|
||||
if winnr == nil and type(k) == 'number' then
|
||||
return new_win_opt_accessor(k)
|
||||
end
|
||||
return api.nvim_win_get_option(winnr or 0, k)
|
||||
end
|
||||
local function set(k, v) return api.nvim_win_set_option(winnr or 0, k, v) end
|
||||
return make_meta_accessor(nil_wrap(get), set)
|
||||
end
|
||||
|
||||
local function new_buf_accessor(bufnr)
|
||||
local function get(k)
|
||||
if bufnr == nil and type(k) == 'number' then
|
||||
return new_buf_accessor(k)
|
||||
end
|
||||
return api.nvim_buf_get_var(bufnr or 0, k)
|
||||
end
|
||||
local function set(k, v) return api.nvim_buf_set_var(bufnr or 0, k, v) end
|
||||
local function del(k) return api.nvim_buf_del_var(bufnr or 0, k) end
|
||||
return make_meta_accessor(nil_wrap(get), set, del)
|
||||
end
|
||||
|
||||
local function new_buf_opt_accessor(bufnr)
|
||||
local function get(k)
|
||||
if window_options[k] then
|
||||
return api.nvim_err_writeln(k.." is a window option, not a buffer option")
|
||||
end
|
||||
if bufnr == nil and type(k) == 'number' then
|
||||
return new_buf_opt_accessor(k)
|
||||
end
|
||||
return api.nvim_buf_get_option(bufnr or 0, k)
|
||||
end
|
||||
local function set(k, v)
|
||||
if window_options[k] then
|
||||
return api.nvim_err_writeln(k.." is a window option, not a buffer option")
|
||||
end
|
||||
return api.nvim_buf_set_option(bufnr or 0, k, v)
|
||||
end
|
||||
return make_meta_accessor(nil_wrap(get), set)
|
||||
end
|
||||
|
||||
-- `nvim.$method(...)` redirects to `nvim.api.nvim_$method(...)`
|
||||
-- `nvim.fn.$method(...)` redirects to `vim.api.nvim_call_function($method, {...})`
|
||||
-- TODO `nvim.ex.$command(...)` is approximately `:$command {...}.join(" ")`
|
||||
-- `nvim.print(...)` is approximately `echo vim.inspect(...)`
|
||||
-- `nvim.echo(...)` is approximately `echo table.concat({...}, '\n')`
|
||||
-- Both methods cache the inital lookup in the metatable, but there is api small overhead regardless.
|
||||
return setmetatable({
|
||||
print = nvim_print;
|
||||
echo = nvim_echo;
|
||||
fn = rawget(vim, "fn") or fn;
|
||||
validate = validate;
|
||||
g = rawget(vim, 'g') or make_meta_accessor(nil_wrap(api.nvim_get_var), api.nvim_set_var, api.nvim_del_var);
|
||||
v = rawget(vim, 'v') or make_meta_accessor(nil_wrap(api.nvim_get_vvar), api.nvim_set_vvar);
|
||||
o = rawget(vim, 'o') or make_meta_accessor(api.nvim_get_option, api.nvim_set_option);
|
||||
w = new_win_accessor(nil);
|
||||
b = new_buf_accessor(nil);
|
||||
env = rawget(vim, "env") or make_meta_accessor(getenv, fn.setenv);
|
||||
wo = rawget(vim, "wo") or new_win_opt_accessor(nil);
|
||||
bo = rawget(vim, "bo") or new_buf_opt_accessor(nil);
|
||||
buf = {
|
||||
line = api.nvim_get_current_line;
|
||||
nr = api.nvim_get_current_buf;
|
||||
};
|
||||
ex = setmetatable({}, {
|
||||
__index = function(t, k)
|
||||
local command = k:gsub("_$", "!")
|
||||
local f = function(...)
|
||||
return api.nvim_command(table.concat(vim.tbl_flatten {command, ...}, " "))
|
||||
end
|
||||
rawset(t, k, f)
|
||||
return f
|
||||
end
|
||||
});
|
||||
}, {
|
||||
__index = function(t, k)
|
||||
local f = api['nvim_'..k]
|
||||
if f then
|
||||
rawset(t, k, f)
|
||||
end
|
||||
return f
|
||||
end
|
||||
})
|
||||
-- vim:et ts=2 sw=2
|
108
lua/conjure-macroexpand/aniseed/env.lua
Normal file
108
lua/conjure-macroexpand/aniseed/env.lua
Normal file
@ -0,0 +1,108 @@
|
||||
local _2afile_2a = "fnl/aniseed/env.fnl"
|
||||
local _0_
|
||||
do
|
||||
local name_0_ = "conjure-macroexpand.aniseed.env"
|
||||
local module_0_
|
||||
do
|
||||
local x_0_ = package.loaded[name_0_]
|
||||
if ("table" == type(x_0_)) then
|
||||
module_0_ = x_0_
|
||||
else
|
||||
module_0_ = {}
|
||||
end
|
||||
end
|
||||
module_0_["aniseed/module"] = name_0_
|
||||
module_0_["aniseed/locals"] = ((module_0_)["aniseed/locals"] or {})
|
||||
do end (module_0_)["aniseed/local-fns"] = ((module_0_)["aniseed/local-fns"] or {})
|
||||
do end (package.loaded)[name_0_] = module_0_
|
||||
_0_ = module_0_
|
||||
end
|
||||
local autoload
|
||||
local function _1_(...)
|
||||
return (require("conjure-macroexpand.aniseed.autoload")).autoload(...)
|
||||
end
|
||||
autoload = _1_
|
||||
local function _2_(...)
|
||||
local ok_3f_0_, val_0_ = nil, nil
|
||||
local function _2_()
|
||||
return {autoload("conjure-macroexpand.aniseed.compile"), autoload("conjure-macroexpand.aniseed.fennel"), autoload("conjure-macroexpand.aniseed.fs"), autoload("conjure-macroexpand.aniseed.nvim")}
|
||||
end
|
||||
ok_3f_0_, val_0_ = pcall(_2_)
|
||||
if ok_3f_0_ then
|
||||
_0_["aniseed/local-fns"] = {autoload = {compile = "conjure-macroexpand.aniseed.compile", fennel = "conjure-macroexpand.aniseed.fennel", fs = "conjure-macroexpand.aniseed.fs", nvim = "conjure-macroexpand.aniseed.nvim"}}
|
||||
return val_0_
|
||||
else
|
||||
return print(val_0_)
|
||||
end
|
||||
end
|
||||
local _local_0_ = _2_(...)
|
||||
local compile = _local_0_[1]
|
||||
local fennel = _local_0_[2]
|
||||
local fs = _local_0_[3]
|
||||
local nvim = _local_0_[4]
|
||||
local _2amodule_2a = _0_
|
||||
local _2amodule_name_2a = "conjure-macroexpand.aniseed.env"
|
||||
do local _ = ({nil, _0_, nil, {{}, nil, nil, nil}})[2] end
|
||||
local config_dir
|
||||
do
|
||||
local v_0_ = string.gsub(nvim.fn.stdpath("config"), "\\", "/")
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["config-dir"] = v_0_
|
||||
config_dir = v_0_
|
||||
end
|
||||
local quiet_require
|
||||
do
|
||||
local v_0_
|
||||
local function quiet_require0(m)
|
||||
local ok_3f, err = nil, nil
|
||||
local function _3_()
|
||||
return require(m)
|
||||
end
|
||||
ok_3f, err = pcall(_3_)
|
||||
if (not ok_3f and not err:find(("module '" .. m .. "' not found"))) then
|
||||
return nvim.ex.echoerr(err)
|
||||
end
|
||||
end
|
||||
v_0_ = quiet_require0
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["quiet-require"] = v_0_
|
||||
quiet_require = v_0_
|
||||
end
|
||||
local init
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function init0(opts)
|
||||
local opts0
|
||||
if ("table" == type(opts)) then
|
||||
opts0 = opts
|
||||
else
|
||||
opts0 = {}
|
||||
end
|
||||
local glob_expr = "**/*.fnl"
|
||||
local fnl_dir = (opts0.input or (config_dir .. "/fnl"))
|
||||
local lua_dir = (opts0.output or (config_dir .. "/lua"))
|
||||
package.path = (package.path .. ";" .. lua_dir .. "/?.lua")
|
||||
local function _4_(path)
|
||||
if fs["macro-file-path?"](path) then
|
||||
return path
|
||||
else
|
||||
return string.gsub(path, ".fnl$", ".lua")
|
||||
end
|
||||
end
|
||||
if (((false ~= opts0.compile) or os.getenv("ANISEED_ENV_COMPILE")) and fs["glob-dir-newer?"](fnl_dir, lua_dir, glob_expr, _4_)) then
|
||||
fennel["add-path"]((fnl_dir .. "/?.fnl"))
|
||||
compile.glob(glob_expr, fnl_dir, lua_dir, opts0)
|
||||
end
|
||||
return quiet_require((opts0.module or "init"))
|
||||
end
|
||||
v_0_0 = init0
|
||||
_0_["init"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["init"] = v_0_
|
||||
init = v_0_
|
||||
end
|
||||
return nil
|
67
lua/conjure-macroexpand/aniseed/eval.lua
Normal file
67
lua/conjure-macroexpand/aniseed/eval.lua
Normal file
@ -0,0 +1,67 @@
|
||||
local _2afile_2a = "fnl/aniseed/eval.fnl"
|
||||
local _0_
|
||||
do
|
||||
local name_0_ = "conjure-macroexpand.aniseed.eval"
|
||||
local module_0_
|
||||
do
|
||||
local x_0_ = package.loaded[name_0_]
|
||||
if ("table" == type(x_0_)) then
|
||||
module_0_ = x_0_
|
||||
else
|
||||
module_0_ = {}
|
||||
end
|
||||
end
|
||||
module_0_["aniseed/module"] = name_0_
|
||||
module_0_["aniseed/locals"] = ((module_0_)["aniseed/locals"] or {})
|
||||
do end (module_0_)["aniseed/local-fns"] = ((module_0_)["aniseed/local-fns"] or {})
|
||||
do end (package.loaded)[name_0_] = module_0_
|
||||
_0_ = module_0_
|
||||
end
|
||||
local autoload
|
||||
local function _1_(...)
|
||||
return (require("conjure-macroexpand.aniseed.autoload")).autoload(...)
|
||||
end
|
||||
autoload = _1_
|
||||
local function _2_(...)
|
||||
local ok_3f_0_, val_0_ = nil, nil
|
||||
local function _2_()
|
||||
return {autoload("conjure-macroexpand.aniseed.core"), autoload("conjure-macroexpand.aniseed.compile"), autoload("conjure-macroexpand.aniseed.fennel"), autoload("conjure-macroexpand.aniseed.fs"), autoload("conjure-macroexpand.aniseed.nvim")}
|
||||
end
|
||||
ok_3f_0_, val_0_ = pcall(_2_)
|
||||
if ok_3f_0_ then
|
||||
_0_["aniseed/local-fns"] = {autoload = {a = "conjure-macroexpand.aniseed.core", compile = "conjure-macroexpand.aniseed.compile", fennel = "conjure-macroexpand.aniseed.fennel", fs = "conjure-macroexpand.aniseed.fs", nvim = "conjure-macroexpand.aniseed.nvim"}}
|
||||
return val_0_
|
||||
else
|
||||
return print(val_0_)
|
||||
end
|
||||
end
|
||||
local _local_0_ = _2_(...)
|
||||
local a = _local_0_[1]
|
||||
local compile = _local_0_[2]
|
||||
local fennel = _local_0_[3]
|
||||
local fs = _local_0_[4]
|
||||
local nvim = _local_0_[5]
|
||||
local _2amodule_2a = _0_
|
||||
local _2amodule_name_2a = "conjure-macroexpand.aniseed.eval"
|
||||
do local _ = ({nil, _0_, nil, {{}, nil, nil, nil}})[2] end
|
||||
local str
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function str0(code, opts)
|
||||
local fnl = fennel.impl()
|
||||
local function _3_()
|
||||
return fnl.eval(compile["macros-prefix"](code, opts), a.merge({["compiler-env"] = _G}, opts))
|
||||
end
|
||||
return xpcall(_3_, fnl.traceback)
|
||||
end
|
||||
v_0_0 = str0
|
||||
_0_["str"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["str"] = v_0_
|
||||
str = v_0_
|
||||
end
|
||||
return nil
|
110
lua/conjure-macroexpand/aniseed/fennel.lua
Normal file
110
lua/conjure-macroexpand/aniseed/fennel.lua
Normal file
@ -0,0 +1,110 @@
|
||||
local _2afile_2a = "fnl/aniseed/fennel.fnl"
|
||||
local _0_
|
||||
do
|
||||
local name_0_ = "conjure-macroexpand.aniseed.fennel"
|
||||
local module_0_
|
||||
do
|
||||
local x_0_ = package.loaded[name_0_]
|
||||
if ("table" == type(x_0_)) then
|
||||
module_0_ = x_0_
|
||||
else
|
||||
module_0_ = {}
|
||||
end
|
||||
end
|
||||
module_0_["aniseed/module"] = name_0_
|
||||
module_0_["aniseed/locals"] = ((module_0_)["aniseed/locals"] or {})
|
||||
do end (module_0_)["aniseed/local-fns"] = ((module_0_)["aniseed/local-fns"] or {})
|
||||
do end (package.loaded)[name_0_] = module_0_
|
||||
_0_ = module_0_
|
||||
end
|
||||
local autoload
|
||||
local function _1_(...)
|
||||
return (require("conjure-macroexpand.aniseed.autoload")).autoload(...)
|
||||
end
|
||||
autoload = _1_
|
||||
local function _2_(...)
|
||||
local ok_3f_0_, val_0_ = nil, nil
|
||||
local function _2_()
|
||||
return {autoload("conjure-macroexpand.aniseed.nvim")}
|
||||
end
|
||||
ok_3f_0_, val_0_ = pcall(_2_)
|
||||
if ok_3f_0_ then
|
||||
_0_["aniseed/local-fns"] = {autoload = {nvim = "conjure-macroexpand.aniseed.nvim"}}
|
||||
return val_0_
|
||||
else
|
||||
return print(val_0_)
|
||||
end
|
||||
end
|
||||
local _local_0_ = _2_(...)
|
||||
local nvim = _local_0_[1]
|
||||
local _2amodule_2a = _0_
|
||||
local _2amodule_name_2a = "conjure-macroexpand.aniseed.fennel"
|
||||
do local _ = ({nil, _0_, nil, {{}, nil, nil, nil}})[2] end
|
||||
local sync_rtp
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function sync_rtp0(compiler)
|
||||
local fnl_suffix = "/fnl/?.fnl"
|
||||
local rtp = nvim.o.runtimepath
|
||||
local fnl_path = (rtp:gsub(",", (fnl_suffix .. ";")) .. fnl_suffix)
|
||||
local lua_path = fnl_path:gsub("/fnl/", "/lua/")
|
||||
do end (compiler)["path"] = (fnl_path .. ";" .. lua_path)
|
||||
return nil
|
||||
end
|
||||
v_0_0 = sync_rtp0
|
||||
_0_["sync-rtp"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["sync-rtp"] = v_0_
|
||||
sync_rtp = v_0_
|
||||
end
|
||||
local state
|
||||
do
|
||||
local v_0_ = {["compiler-loaded?"] = false}
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["state"] = v_0_
|
||||
state = v_0_
|
||||
end
|
||||
local impl
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function impl0()
|
||||
local compiler = require("conjure-macroexpand.aniseed.deps.fennel")
|
||||
if not state["compiler-loaded?"] then
|
||||
state["compiler-loaded?"] = true
|
||||
sync_rtp(compiler)
|
||||
end
|
||||
return compiler
|
||||
end
|
||||
v_0_0 = impl0
|
||||
_0_["impl"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["impl"] = v_0_
|
||||
impl = v_0_
|
||||
end
|
||||
local add_path
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function add_path0(path)
|
||||
local fnl = impl()
|
||||
do end (fnl)["path"] = (fnl.path .. ";" .. path)
|
||||
return nil
|
||||
end
|
||||
v_0_0 = add_path0
|
||||
_0_["add-path"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["add-path"] = v_0_
|
||||
add_path = v_0_
|
||||
end
|
||||
return nil
|
134
lua/conjure-macroexpand/aniseed/fs.lua
Normal file
134
lua/conjure-macroexpand/aniseed/fs.lua
Normal file
@ -0,0 +1,134 @@
|
||||
local _2afile_2a = "fnl/aniseed/fs.fnl"
|
||||
local _0_
|
||||
do
|
||||
local name_0_ = "conjure-macroexpand.aniseed.fs"
|
||||
local module_0_
|
||||
do
|
||||
local x_0_ = package.loaded[name_0_]
|
||||
if ("table" == type(x_0_)) then
|
||||
module_0_ = x_0_
|
||||
else
|
||||
module_0_ = {}
|
||||
end
|
||||
end
|
||||
module_0_["aniseed/module"] = name_0_
|
||||
module_0_["aniseed/locals"] = ((module_0_)["aniseed/locals"] or {})
|
||||
do end (module_0_)["aniseed/local-fns"] = ((module_0_)["aniseed/local-fns"] or {})
|
||||
do end (package.loaded)[name_0_] = module_0_
|
||||
_0_ = module_0_
|
||||
end
|
||||
local autoload
|
||||
local function _1_(...)
|
||||
return (require("conjure-macroexpand.aniseed.autoload")).autoload(...)
|
||||
end
|
||||
autoload = _1_
|
||||
local function _2_(...)
|
||||
local ok_3f_0_, val_0_ = nil, nil
|
||||
local function _2_()
|
||||
return {autoload("conjure-macroexpand.aniseed.core"), autoload("conjure-macroexpand.aniseed.nvim")}
|
||||
end
|
||||
ok_3f_0_, val_0_ = pcall(_2_)
|
||||
if ok_3f_0_ then
|
||||
_0_["aniseed/local-fns"] = {autoload = {a = "conjure-macroexpand.aniseed.core", nvim = "conjure-macroexpand.aniseed.nvim"}}
|
||||
return val_0_
|
||||
else
|
||||
return print(val_0_)
|
||||
end
|
||||
end
|
||||
local _local_0_ = _2_(...)
|
||||
local a = _local_0_[1]
|
||||
local nvim = _local_0_[2]
|
||||
local _2amodule_2a = _0_
|
||||
local _2amodule_name_2a = "conjure-macroexpand.aniseed.fs"
|
||||
do local _ = ({nil, _0_, nil, {{}, nil, nil, nil}})[2] end
|
||||
local basename
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function basename0(path)
|
||||
return nvim.fn.fnamemodify(path, ":h")
|
||||
end
|
||||
v_0_0 = basename0
|
||||
_0_["basename"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["basename"] = v_0_
|
||||
basename = v_0_
|
||||
end
|
||||
local mkdirp
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function mkdirp0(dir)
|
||||
return nvim.fn.mkdir(dir, "p")
|
||||
end
|
||||
v_0_0 = mkdirp0
|
||||
_0_["mkdirp"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["mkdirp"] = v_0_
|
||||
mkdirp = v_0_
|
||||
end
|
||||
local relglob
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function relglob0(dir, expr)
|
||||
local dir_len = a.inc(string.len(dir))
|
||||
local function _3_(_241)
|
||||
return string.sub(_241, dir_len)
|
||||
end
|
||||
return a.map(_3_, nvim.fn.globpath(dir, expr, true, true))
|
||||
end
|
||||
v_0_0 = relglob0
|
||||
_0_["relglob"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["relglob"] = v_0_
|
||||
relglob = v_0_
|
||||
end
|
||||
local glob_dir_newer_3f
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function glob_dir_newer_3f0(a_dir, b_dir, expr, b_dir_path_fn)
|
||||
local newer_3f = false
|
||||
for _, path in ipairs(relglob(a_dir, expr)) do
|
||||
if (nvim.fn.getftime((a_dir .. path)) > nvim.fn.getftime((b_dir .. b_dir_path_fn(path)))) then
|
||||
newer_3f = true
|
||||
end
|
||||
end
|
||||
return newer_3f
|
||||
end
|
||||
v_0_0 = glob_dir_newer_3f0
|
||||
_0_["glob-dir-newer?"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["glob-dir-newer?"] = v_0_
|
||||
glob_dir_newer_3f = v_0_
|
||||
end
|
||||
local macro_file_path_3f
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function macro_file_path_3f0(path)
|
||||
return string.match(path, "macros.fnl$")
|
||||
end
|
||||
v_0_0 = macro_file_path_3f0
|
||||
_0_["macro-file-path?"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["macro-file-path?"] = v_0_
|
||||
macro_file_path_3f = v_0_
|
||||
end
|
||||
return nil
|
144
lua/conjure-macroexpand/aniseed/macros.fnl
Normal file
144
lua/conjure-macroexpand/aniseed/macros.fnl
Normal file
@ -0,0 +1,144 @@
|
||||
;; All of Aniseed's macros in one place.
|
||||
;; Can't be compiled to Lua directly.
|
||||
|
||||
;; Automatically loaded through require-macros for all Aniseed based evaluations.
|
||||
|
||||
(local module-sym (gensym))
|
||||
|
||||
(fn sorted-each [f x]
|
||||
(let [acc []]
|
||||
(each [k v (pairs x)]
|
||||
(table.insert acc [k v]))
|
||||
(table.sort
|
||||
acc
|
||||
(fn [a b]
|
||||
(< (. a 1) (. b 1))))
|
||||
(each [_ [k v] (ipairs acc)]
|
||||
(f k v))))
|
||||
|
||||
(fn module [name new-local-fns initial-mod]
|
||||
`(-> [(local ,module-sym
|
||||
(let [name# ,(tostring name)
|
||||
module# (let [x# (. package.loaded name#)]
|
||||
(if (= :table (type x#))
|
||||
x#
|
||||
,(or initial-mod {})))]
|
||||
(tset module# :aniseed/module name#)
|
||||
(tset module# :aniseed/locals (or (. module# :aniseed/locals) {}))
|
||||
(tset module# :aniseed/local-fns (or (. module# :aniseed/local-fns) {}))
|
||||
(tset package.loaded name# module#)
|
||||
module#))
|
||||
|
||||
,module-sym
|
||||
|
||||
;; Meta! Autoload the autoload function, so it's only loaded when used.
|
||||
(local ,(sym :autoload)
|
||||
(fn [...] ((. (require :aniseed.autoload) :autoload) ...)))
|
||||
|
||||
,(let [aliases []
|
||||
vals []
|
||||
effects []
|
||||
pkg (let [x (. package.loaded (tostring name))]
|
||||
(when (= :table (type x))
|
||||
x))
|
||||
locals (-?> pkg (. :aniseed/locals))
|
||||
local-fns (or (and (not new-local-fns)
|
||||
(?. pkg :aniseed/local-fns))
|
||||
{})]
|
||||
|
||||
(when new-local-fns
|
||||
(each [action binds (pairs new-local-fns)]
|
||||
(let [action-str (tostring action)
|
||||
current (or (. local-fns action-str) {})]
|
||||
(tset local-fns action-str current)
|
||||
(each [alias module (pairs binds)]
|
||||
(if (= :number (type alias))
|
||||
(tset current (tostring module) true)
|
||||
(tset current (tostring alias) (tostring module)))))))
|
||||
|
||||
(sorted-each
|
||||
(fn [action binds]
|
||||
(sorted-each
|
||||
(fn [alias-or-val val]
|
||||
(if (= true val)
|
||||
|
||||
;; {require-macros [bar]}
|
||||
(table.insert effects `(,(sym action) ,alias-or-val))
|
||||
|
||||
;; {require {foo bar}}
|
||||
(do
|
||||
(table.insert aliases (sym alias-or-val))
|
||||
(table.insert vals `(,(sym action) ,val)))))
|
||||
|
||||
binds))
|
||||
local-fns)
|
||||
|
||||
(when locals
|
||||
(sorted-each
|
||||
(fn [alias val]
|
||||
(table.insert aliases (sym alias))
|
||||
(table.insert vals `(. ,module-sym :aniseed/locals ,alias)))
|
||||
locals))
|
||||
|
||||
`[,effects
|
||||
(local ,aliases
|
||||
(let [(ok?# val#)
|
||||
(pcall
|
||||
(fn [] ,vals))]
|
||||
(if ok?#
|
||||
(do
|
||||
(tset ,module-sym :aniseed/local-fns ,local-fns)
|
||||
val#)
|
||||
(print val#))))
|
||||
(local ,(sym "*module*") ,module-sym)
|
||||
(local ,(sym "*module-name*") ,(tostring name))])]
|
||||
(. 2)))
|
||||
|
||||
(fn def- [name value]
|
||||
`(local ,name
|
||||
(let [v# ,value
|
||||
t# (. ,module-sym :aniseed/locals)]
|
||||
(tset t# ,(tostring name) v#)
|
||||
v#)))
|
||||
|
||||
(fn def [name value]
|
||||
`(def- ,name
|
||||
(do
|
||||
(let [v# ,value]
|
||||
(tset ,module-sym ,(tostring name) v#)
|
||||
v#))))
|
||||
|
||||
(fn defn- [name ...]
|
||||
`(def- ,name (fn ,name ,...)))
|
||||
|
||||
(fn defn [name ...]
|
||||
`(def ,name (fn ,name ,...)))
|
||||
|
||||
(fn defonce- [name value]
|
||||
`(def- ,name
|
||||
(or (. ,module-sym :aniseed/locals ,(tostring name))
|
||||
,value)))
|
||||
|
||||
(fn defonce [name value]
|
||||
`(def ,name
|
||||
(or (. ,module-sym ,(tostring name))
|
||||
,value)))
|
||||
|
||||
(fn deftest [name ...]
|
||||
`(let [tests# (or (. ,module-sym :aniseed/tests) {})]
|
||||
(tset tests# ,(tostring name) (fn [,(sym :t)] ,...))
|
||||
(tset ,module-sym :aniseed/tests tests#)))
|
||||
|
||||
(fn time [...]
|
||||
`(let [start# (vim.loop.hrtime)
|
||||
result# (do ,...)
|
||||
end# (vim.loop.hrtime)]
|
||||
(print (.. "Elapsed time: " (/ (- end# start#) 1000000) " msecs"))
|
||||
result#))
|
||||
|
||||
{:module module
|
||||
:def- def- :def def
|
||||
:defn- defn- :defn defn
|
||||
:defonce- defonce- :defonce defonce
|
||||
:deftest deftest
|
||||
:time time}
|
41
lua/conjure-macroexpand/aniseed/nvim.lua
Normal file
41
lua/conjure-macroexpand/aniseed/nvim.lua
Normal file
@ -0,0 +1,41 @@
|
||||
local _2afile_2a = "fnl/aniseed/nvim.fnl"
|
||||
local _0_
|
||||
do
|
||||
local name_0_ = "conjure-macroexpand.aniseed.nvim"
|
||||
local module_0_
|
||||
do
|
||||
local x_0_ = package.loaded[name_0_]
|
||||
if ("table" == type(x_0_)) then
|
||||
module_0_ = x_0_
|
||||
else
|
||||
module_0_ = require("conjure-macroexpand.aniseed.deps.nvim")
|
||||
end
|
||||
end
|
||||
module_0_["aniseed/module"] = name_0_
|
||||
module_0_["aniseed/locals"] = ((module_0_)["aniseed/locals"] or {})
|
||||
do end (module_0_)["aniseed/local-fns"] = ((module_0_)["aniseed/local-fns"] or {})
|
||||
do end (package.loaded)[name_0_] = module_0_
|
||||
_0_ = module_0_
|
||||
end
|
||||
local autoload
|
||||
local function _1_(...)
|
||||
return (require("conjure-macroexpand.aniseed.autoload")).autoload(...)
|
||||
end
|
||||
autoload = _1_
|
||||
local function _2_(...)
|
||||
local ok_3f_0_, val_0_ = nil, nil
|
||||
local function _2_()
|
||||
return {}
|
||||
end
|
||||
ok_3f_0_, val_0_ = pcall(_2_)
|
||||
if ok_3f_0_ then
|
||||
_0_["aniseed/local-fns"] = {}
|
||||
return val_0_
|
||||
else
|
||||
return print(val_0_)
|
||||
end
|
||||
end
|
||||
local _local_0_ = _2_(...)
|
||||
local _2amodule_2a = _0_
|
||||
local _2amodule_name_2a = "conjure-macroexpand.aniseed.nvim"
|
||||
return ({nil, _0_, nil, {{}, nil, nil, nil}})[2]
|
122
lua/conjure-macroexpand/aniseed/nvim/util.lua
Normal file
122
lua/conjure-macroexpand/aniseed/nvim/util.lua
Normal file
@ -0,0 +1,122 @@
|
||||
local _2afile_2a = "fnl/aniseed/nvim/util.fnl"
|
||||
local _0_
|
||||
do
|
||||
local name_0_ = "conjure-macroexpand.aniseed.nvim.util"
|
||||
local module_0_
|
||||
do
|
||||
local x_0_ = package.loaded[name_0_]
|
||||
if ("table" == type(x_0_)) then
|
||||
module_0_ = x_0_
|
||||
else
|
||||
module_0_ = {}
|
||||
end
|
||||
end
|
||||
module_0_["aniseed/module"] = name_0_
|
||||
module_0_["aniseed/locals"] = ((module_0_)["aniseed/locals"] or {})
|
||||
do end (module_0_)["aniseed/local-fns"] = ((module_0_)["aniseed/local-fns"] or {})
|
||||
do end (package.loaded)[name_0_] = module_0_
|
||||
_0_ = module_0_
|
||||
end
|
||||
local autoload
|
||||
local function _1_(...)
|
||||
return (require("conjure-macroexpand.aniseed.autoload")).autoload(...)
|
||||
end
|
||||
autoload = _1_
|
||||
local function _2_(...)
|
||||
local ok_3f_0_, val_0_ = nil, nil
|
||||
local function _2_()
|
||||
return {autoload("conjure-macroexpand.aniseed.nvim")}
|
||||
end
|
||||
ok_3f_0_, val_0_ = pcall(_2_)
|
||||
if ok_3f_0_ then
|
||||
_0_["aniseed/local-fns"] = {autoload = {nvim = "conjure-macroexpand.aniseed.nvim"}}
|
||||
return val_0_
|
||||
else
|
||||
return print(val_0_)
|
||||
end
|
||||
end
|
||||
local _local_0_ = _2_(...)
|
||||
local nvim = _local_0_[1]
|
||||
local _2amodule_2a = _0_
|
||||
local _2amodule_name_2a = "conjure-macroexpand.aniseed.nvim.util"
|
||||
do local _ = ({nil, _0_, nil, {{}, nil, nil, nil}})[2] end
|
||||
local normal
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function normal0(keys)
|
||||
return nvim.ex.silent(("exe \"normal! " .. keys .. "\""))
|
||||
end
|
||||
v_0_0 = normal0
|
||||
_0_["normal"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["normal"] = v_0_
|
||||
normal = v_0_
|
||||
end
|
||||
local fn_bridge
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function fn_bridge0(viml_name, mod, lua_name, opts)
|
||||
local _let_0_ = (opts or {})
|
||||
local range = _let_0_["range"]
|
||||
local _return = _let_0_["return"]
|
||||
local _3_
|
||||
if range then
|
||||
_3_ = " range"
|
||||
else
|
||||
_3_ = ""
|
||||
end
|
||||
local _5_
|
||||
if (_return ~= false) then
|
||||
_5_ = "return"
|
||||
else
|
||||
_5_ = "call"
|
||||
end
|
||||
local _7_
|
||||
if range then
|
||||
_7_ = "\" . a:firstline . \", \" . a:lastline . \", "
|
||||
else
|
||||
_7_ = ""
|
||||
end
|
||||
return nvim.ex.function_((viml_name .. "(...)" .. _3_ .. "\n " .. _5_ .. " luaeval(\"require('" .. mod .. "')['" .. lua_name .. "'](" .. _7_ .. "unpack(_A))\", a:000)\n endfunction"))
|
||||
end
|
||||
v_0_0 = fn_bridge0
|
||||
_0_["fn-bridge"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["fn-bridge"] = v_0_
|
||||
fn_bridge = v_0_
|
||||
end
|
||||
local with_out_str
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function with_out_str0(f)
|
||||
nvim.ex.redir("=> g:aniseed_nvim_util_out_str")
|
||||
do
|
||||
local ok_3f, err = pcall(f)
|
||||
nvim.ex.redir("END")
|
||||
nvim.ex.echon("")
|
||||
nvim.ex.redraw()
|
||||
if not ok_3f then
|
||||
error(err)
|
||||
end
|
||||
end
|
||||
return string.gsub(nvim.g.aniseed_nvim_util_out_str, "^(\n?)(.*)$", "%2%1")
|
||||
end
|
||||
v_0_0 = with_out_str0
|
||||
_0_["with-out-str"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["with-out-str"] = v_0_
|
||||
with_out_str = v_0_
|
||||
end
|
||||
return nil
|
182
lua/conjure-macroexpand/aniseed/string.lua
Normal file
182
lua/conjure-macroexpand/aniseed/string.lua
Normal file
@ -0,0 +1,182 @@
|
||||
local _2afile_2a = "fnl/aniseed/string.fnl"
|
||||
local _0_
|
||||
do
|
||||
local name_0_ = "conjure-macroexpand.aniseed.string"
|
||||
local module_0_
|
||||
do
|
||||
local x_0_ = package.loaded[name_0_]
|
||||
if ("table" == type(x_0_)) then
|
||||
module_0_ = x_0_
|
||||
else
|
||||
module_0_ = {}
|
||||
end
|
||||
end
|
||||
module_0_["aniseed/module"] = name_0_
|
||||
module_0_["aniseed/locals"] = ((module_0_)["aniseed/locals"] or {})
|
||||
do end (module_0_)["aniseed/local-fns"] = ((module_0_)["aniseed/local-fns"] or {})
|
||||
do end (package.loaded)[name_0_] = module_0_
|
||||
_0_ = module_0_
|
||||
end
|
||||
local autoload
|
||||
local function _1_(...)
|
||||
return (require("conjure-macroexpand.aniseed.autoload")).autoload(...)
|
||||
end
|
||||
autoload = _1_
|
||||
local function _2_(...)
|
||||
local ok_3f_0_, val_0_ = nil, nil
|
||||
local function _2_()
|
||||
return {autoload("conjure-macroexpand.aniseed.core")}
|
||||
end
|
||||
ok_3f_0_, val_0_ = pcall(_2_)
|
||||
if ok_3f_0_ then
|
||||
_0_["aniseed/local-fns"] = {autoload = {a = "conjure-macroexpand.aniseed.core"}}
|
||||
return val_0_
|
||||
else
|
||||
return print(val_0_)
|
||||
end
|
||||
end
|
||||
local _local_0_ = _2_(...)
|
||||
local a = _local_0_[1]
|
||||
local _2amodule_2a = _0_
|
||||
local _2amodule_name_2a = "conjure-macroexpand.aniseed.string"
|
||||
do local _ = ({nil, _0_, nil, {{}, nil, nil, nil}})[2] end
|
||||
local join
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function join0(...)
|
||||
local args = {...}
|
||||
local function _3_(...)
|
||||
if (2 == a.count(args)) then
|
||||
return args
|
||||
else
|
||||
return {"", a.first(args)}
|
||||
end
|
||||
end
|
||||
local _let_0_ = _3_(...)
|
||||
local sep = _let_0_[1]
|
||||
local xs = _let_0_[2]
|
||||
local len = a.count(xs)
|
||||
local result = {}
|
||||
if (len > 0) then
|
||||
for i = 1, len do
|
||||
local x = xs[i]
|
||||
local _4_
|
||||
if ("string" == type(x)) then
|
||||
_4_ = x
|
||||
elseif (nil == x) then
|
||||
_4_ = x
|
||||
else
|
||||
_4_ = a["pr-str"](x)
|
||||
end
|
||||
if _4_ then
|
||||
table.insert(result, _4_)
|
||||
else
|
||||
end
|
||||
end
|
||||
end
|
||||
return table.concat(result, sep)
|
||||
end
|
||||
v_0_0 = join0
|
||||
_0_["join"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["join"] = v_0_
|
||||
join = v_0_
|
||||
end
|
||||
local split
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function split0(s, pat)
|
||||
local done_3f = false
|
||||
local acc = {}
|
||||
local index = 1
|
||||
while not done_3f do
|
||||
local start, _end = string.find(s, pat, index)
|
||||
if ("nil" == type(start)) then
|
||||
table.insert(acc, string.sub(s, index))
|
||||
done_3f = true
|
||||
else
|
||||
table.insert(acc, string.sub(s, index, (start - 1)))
|
||||
index = (_end + 1)
|
||||
end
|
||||
end
|
||||
return acc
|
||||
end
|
||||
v_0_0 = split0
|
||||
_0_["split"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["split"] = v_0_
|
||||
split = v_0_
|
||||
end
|
||||
local blank_3f
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function blank_3f0(s)
|
||||
return (a["empty?"](s) or not string.find(s, "[^%s]"))
|
||||
end
|
||||
v_0_0 = blank_3f0
|
||||
_0_["blank?"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["blank?"] = v_0_
|
||||
blank_3f = v_0_
|
||||
end
|
||||
local triml
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function triml0(s)
|
||||
return string.gsub(s, "^%s*(.-)", "%1")
|
||||
end
|
||||
v_0_0 = triml0
|
||||
_0_["triml"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["triml"] = v_0_
|
||||
triml = v_0_
|
||||
end
|
||||
local trimr
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function trimr0(s)
|
||||
return string.gsub(s, "(.-)%s*$", "%1")
|
||||
end
|
||||
v_0_0 = trimr0
|
||||
_0_["trimr"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["trimr"] = v_0_
|
||||
trimr = v_0_
|
||||
end
|
||||
local trim
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function trim0(s)
|
||||
return string.gsub(s, "^%s*(.-)%s*$", "%1")
|
||||
end
|
||||
v_0_0 = trim0
|
||||
_0_["trim"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["trim"] = v_0_
|
||||
trim = v_0_
|
||||
end
|
||||
return nil
|
231
lua/conjure-macroexpand/aniseed/test.lua
Normal file
231
lua/conjure-macroexpand/aniseed/test.lua
Normal file
@ -0,0 +1,231 @@
|
||||
local _2afile_2a = "fnl/aniseed/test.fnl"
|
||||
local _0_
|
||||
do
|
||||
local name_0_ = "conjure-macroexpand.aniseed.test"
|
||||
local module_0_
|
||||
do
|
||||
local x_0_ = package.loaded[name_0_]
|
||||
if ("table" == type(x_0_)) then
|
||||
module_0_ = x_0_
|
||||
else
|
||||
module_0_ = {}
|
||||
end
|
||||
end
|
||||
module_0_["aniseed/module"] = name_0_
|
||||
module_0_["aniseed/locals"] = ((module_0_)["aniseed/locals"] or {})
|
||||
do end (module_0_)["aniseed/local-fns"] = ((module_0_)["aniseed/local-fns"] or {})
|
||||
do end (package.loaded)[name_0_] = module_0_
|
||||
_0_ = module_0_
|
||||
end
|
||||
local autoload
|
||||
local function _1_(...)
|
||||
return (require("conjure-macroexpand.aniseed.autoload")).autoload(...)
|
||||
end
|
||||
autoload = _1_
|
||||
local function _2_(...)
|
||||
local ok_3f_0_, val_0_ = nil, nil
|
||||
local function _2_()
|
||||
return {autoload("conjure-macroexpand.aniseed.core"), autoload("conjure-macroexpand.aniseed.nvim"), autoload("conjure-macroexpand.aniseed.string")}
|
||||
end
|
||||
ok_3f_0_, val_0_ = pcall(_2_)
|
||||
if ok_3f_0_ then
|
||||
_0_["aniseed/local-fns"] = {autoload = {a = "conjure-macroexpand.aniseed.core", nvim = "conjure-macroexpand.aniseed.nvim", str = "conjure-macroexpand.aniseed.string"}}
|
||||
return val_0_
|
||||
else
|
||||
return print(val_0_)
|
||||
end
|
||||
end
|
||||
local _local_0_ = _2_(...)
|
||||
local a = _local_0_[1]
|
||||
local nvim = _local_0_[2]
|
||||
local str = _local_0_[3]
|
||||
local _2amodule_2a = _0_
|
||||
local _2amodule_name_2a = "conjure-macroexpand.aniseed.test"
|
||||
do local _ = ({nil, _0_, nil, {{}, nil, nil, nil}})[2] end
|
||||
local ok_3f
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function ok_3f0(_3_)
|
||||
local _arg_0_ = _3_
|
||||
local tests = _arg_0_["tests"]
|
||||
local tests_passed = _arg_0_["tests-passed"]
|
||||
return (tests == tests_passed)
|
||||
end
|
||||
v_0_0 = ok_3f0
|
||||
_0_["ok?"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["ok?"] = v_0_
|
||||
ok_3f = v_0_
|
||||
end
|
||||
local display_results
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function display_results0(results, prefix)
|
||||
do
|
||||
local _let_0_ = results
|
||||
local assertions = _let_0_["assertions"]
|
||||
local assertions_passed = _let_0_["assertions-passed"]
|
||||
local tests = _let_0_["tests"]
|
||||
local tests_passed = _let_0_["tests-passed"]
|
||||
local _3_
|
||||
if ok_3f(results) then
|
||||
_3_ = "OK"
|
||||
else
|
||||
_3_ = "FAILED"
|
||||
end
|
||||
a.println((prefix .. " " .. _3_ .. " " .. tests_passed .. "/" .. tests .. " tests and " .. assertions_passed .. "/" .. assertions .. " assertions passed"))
|
||||
end
|
||||
return results
|
||||
end
|
||||
v_0_0 = display_results0
|
||||
_0_["display-results"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["display-results"] = v_0_
|
||||
display_results = v_0_
|
||||
end
|
||||
local run
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function run0(mod_name)
|
||||
local mod = package.loaded[mod_name]
|
||||
local tests = (a["table?"](mod) and mod["aniseed/tests"])
|
||||
if a["table?"](tests) then
|
||||
local results = {["assertions-passed"] = 0, ["tests-passed"] = 0, assertions = 0, tests = #tests}
|
||||
for label, f in pairs(tests) do
|
||||
local test_failed = false
|
||||
a.update(results, "tests", a.inc)
|
||||
do
|
||||
local prefix = ("[" .. mod_name .. "/" .. label .. "]")
|
||||
local fail
|
||||
local function _3_(desc, ...)
|
||||
test_failed = true
|
||||
local function _4_(...)
|
||||
if desc then
|
||||
return (" (" .. desc .. ")")
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end
|
||||
return a.println((str.join({prefix, " ", ...}) .. _4_(...)))
|
||||
end
|
||||
fail = _3_
|
||||
local begin
|
||||
local function _4_()
|
||||
return a.update(results, "assertions", a.inc)
|
||||
end
|
||||
begin = _4_
|
||||
local pass
|
||||
local function _5_()
|
||||
return a.update(results, "assertions-passed", a.inc)
|
||||
end
|
||||
pass = _5_
|
||||
local t
|
||||
local function _6_(e, r, desc)
|
||||
begin()
|
||||
if (e == r) then
|
||||
return pass()
|
||||
else
|
||||
return fail(desc, "Expected '", a["pr-str"](e), "' but received '", a["pr-str"](r), "'")
|
||||
end
|
||||
end
|
||||
local function _7_(r, desc)
|
||||
begin()
|
||||
if r then
|
||||
return pass()
|
||||
else
|
||||
return fail(desc, "Expected truthy result but received '", a["pr-str"](r), "'")
|
||||
end
|
||||
end
|
||||
local function _8_(e, r, desc)
|
||||
begin()
|
||||
local se = a["pr-str"](e)
|
||||
local sr = a["pr-str"](r)
|
||||
if (se == sr) then
|
||||
return pass()
|
||||
else
|
||||
return fail(desc, "Expected (with pr) '", se, "' but received '", sr, "'")
|
||||
end
|
||||
end
|
||||
t = {["="] = _6_, ["ok?"] = _7_, ["pr="] = _8_}
|
||||
local _9_, _10_ = nil, nil
|
||||
local function _11_()
|
||||
return f(t)
|
||||
end
|
||||
_9_, _10_ = pcall(_11_)
|
||||
if ((_9_ == false) and (nil ~= _10_)) then
|
||||
local err = _10_
|
||||
fail("Exception: ", err)
|
||||
end
|
||||
end
|
||||
if not test_failed then
|
||||
a.update(results, "tests-passed", a.inc)
|
||||
end
|
||||
end
|
||||
return display_results(results, ("[" .. mod_name .. "]"))
|
||||
end
|
||||
end
|
||||
v_0_0 = run0
|
||||
_0_["run"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["run"] = v_0_
|
||||
run = v_0_
|
||||
end
|
||||
local run_all
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function run_all0()
|
||||
local function _3_(totals, results)
|
||||
for k, v in pairs(results) do
|
||||
totals[k] = (v + totals[k])
|
||||
end
|
||||
return totals
|
||||
end
|
||||
return display_results(a.reduce(_3_, {["assertions-passed"] = 0, ["tests-passed"] = 0, assertions = 0, tests = 0}, a.filter(a["table?"], a.map(run, a.keys(package.loaded)))), "[total]")
|
||||
end
|
||||
v_0_0 = run_all0
|
||||
_0_["run-all"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["run-all"] = v_0_
|
||||
run_all = v_0_
|
||||
end
|
||||
local suite
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function suite0()
|
||||
local function _3_(path)
|
||||
return require(string.gsub(string.match(path, "^test/fnl/(.-).fnl$"), "/", "."))
|
||||
end
|
||||
a["run!"](_3_, nvim.fn.globpath("test/fnl", "**/*-test.fnl", false, true))
|
||||
if ok_3f(run_all()) then
|
||||
return nvim.ex.q()
|
||||
else
|
||||
return nvim.ex.cq()
|
||||
end
|
||||
end
|
||||
v_0_0 = suite0
|
||||
_0_["suite"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["suite"] = v_0_
|
||||
suite = v_0_
|
||||
end
|
||||
return nil
|
58
lua/conjure-macroexpand/aniseed/view.lua
Normal file
58
lua/conjure-macroexpand/aniseed/view.lua
Normal file
@ -0,0 +1,58 @@
|
||||
local _2afile_2a = "fnl/aniseed/view.fnl"
|
||||
local _0_
|
||||
do
|
||||
local name_0_ = "conjure-macroexpand.aniseed.view"
|
||||
local module_0_
|
||||
do
|
||||
local x_0_ = package.loaded[name_0_]
|
||||
if ("table" == type(x_0_)) then
|
||||
module_0_ = x_0_
|
||||
else
|
||||
module_0_ = {}
|
||||
end
|
||||
end
|
||||
module_0_["aniseed/module"] = name_0_
|
||||
module_0_["aniseed/locals"] = ((module_0_)["aniseed/locals"] or {})
|
||||
do end (module_0_)["aniseed/local-fns"] = ((module_0_)["aniseed/local-fns"] or {})
|
||||
do end (package.loaded)[name_0_] = module_0_
|
||||
_0_ = module_0_
|
||||
end
|
||||
local autoload
|
||||
local function _1_(...)
|
||||
return (require("conjure-macroexpand.aniseed.autoload")).autoload(...)
|
||||
end
|
||||
autoload = _1_
|
||||
local function _2_(...)
|
||||
local ok_3f_0_, val_0_ = nil, nil
|
||||
local function _2_()
|
||||
return {}
|
||||
end
|
||||
ok_3f_0_, val_0_ = pcall(_2_)
|
||||
if ok_3f_0_ then
|
||||
_0_["aniseed/local-fns"] = {}
|
||||
return val_0_
|
||||
else
|
||||
return print(val_0_)
|
||||
end
|
||||
end
|
||||
local _local_0_ = _2_(...)
|
||||
local _2amodule_2a = _0_
|
||||
local _2amodule_name_2a = "conjure-macroexpand.aniseed.view"
|
||||
do local _ = ({nil, _0_, nil, {{}, nil, nil, nil}})[2] end
|
||||
local serialise
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function _3_(...)
|
||||
return require("conjure-macroexpand.aniseed.deps.fennelview")(...)
|
||||
end
|
||||
v_0_0 = _3_
|
||||
_0_["serialise"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["serialise"] = v_0_
|
||||
serialise = v_0_
|
||||
end
|
||||
return nil
|
58
lua/conjure-macroexpand/main.lua
Normal file
58
lua/conjure-macroexpand/main.lua
Normal file
@ -0,0 +1,58 @@
|
||||
local _2afile_2a = "fnl/conjure-macroexpand/main.fnl"
|
||||
local _0_
|
||||
do
|
||||
local name_0_ = "conjure-macroexpand.main"
|
||||
local module_0_
|
||||
do
|
||||
local x_0_ = package.loaded[name_0_]
|
||||
if ("table" == type(x_0_)) then
|
||||
module_0_ = x_0_
|
||||
else
|
||||
module_0_ = {}
|
||||
end
|
||||
end
|
||||
module_0_["aniseed/module"] = name_0_
|
||||
module_0_["aniseed/locals"] = ((module_0_)["aniseed/locals"] or {})
|
||||
do end (module_0_)["aniseed/local-fns"] = ((module_0_)["aniseed/local-fns"] or {})
|
||||
do end (package.loaded)[name_0_] = module_0_
|
||||
_0_ = module_0_
|
||||
end
|
||||
local autoload
|
||||
local function _1_(...)
|
||||
return (require("conjure-macroexpand.aniseed.autoload")).autoload(...)
|
||||
end
|
||||
autoload = _1_
|
||||
local function _2_(...)
|
||||
local ok_3f_0_, val_0_ = nil, nil
|
||||
local function _2_()
|
||||
return {}
|
||||
end
|
||||
ok_3f_0_, val_0_ = pcall(_2_)
|
||||
if ok_3f_0_ then
|
||||
_0_["aniseed/local-fns"] = {}
|
||||
return val_0_
|
||||
else
|
||||
return print(val_0_)
|
||||
end
|
||||
end
|
||||
local _local_0_ = _2_(...)
|
||||
local _2amodule_2a = _0_
|
||||
local _2amodule_name_2a = "conjure-macroexpand.main"
|
||||
do local _ = ({nil, _0_, nil, {{}, nil, nil, nil}})[2] end
|
||||
local init
|
||||
do
|
||||
local v_0_
|
||||
do
|
||||
local v_0_0
|
||||
local function init0()
|
||||
return print("Hello, World!")
|
||||
end
|
||||
v_0_0 = init0
|
||||
_0_["init"] = v_0_0
|
||||
v_0_ = v_0_0
|
||||
end
|
||||
local t_0_ = (_0_)["aniseed/locals"]
|
||||
t_0_["init"] = v_0_
|
||||
init = v_0_
|
||||
end
|
||||
return nil
|
3
plugin/conjure-macroexpand.vim
Normal file
3
plugin/conjure-macroexpand.vim
Normal file
@ -0,0 +1,3 @@
|
||||
if has("nvim")
|
||||
lua require("conjure-macroexpand.main").init()
|
||||
endif
|
15
scripts/dep.sh
Executable file
15
scripts/dep.sh
Executable file
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Clones a GitHub repo into deps/{name} if it's not there already.
|
||||
# Will update the repository each time and ensure the right commit is checked out.
|
||||
# Args: GitHub user, repository name, checkout target.
|
||||
# Usage (after copying to your scripts directory): scripts/dep.sh Olical aniseed vX.Y.Z
|
||||
|
||||
mkdir -p deps
|
||||
|
||||
if [ ! -d "deps/$2" ]; then
|
||||
git clone "https://github.com/$1/$2.git" "deps/$2"
|
||||
fi
|
||||
|
||||
cd "deps/$2" && git fetch && git checkout "$3"
|
||||
|
4
test/fnl/conjure-macroexpand/main-test.fnl
Normal file
4
test/fnl/conjure-macroexpand/main-test.fnl
Normal file
@ -0,0 +1,4 @@
|
||||
(module conjure-macroexpand.main-test)
|
||||
|
||||
(deftest something-simple
|
||||
(t.= 1 1 "1 should equal 1, I hope!"))
|
Loading…
x
Reference in New Issue
Block a user