Update to 0.9.1
This commit is contained in:
parent
6ca50f19fe
commit
d124a52904
61
lib/fennel
61
lib/fennel
|
@ -1038,32 +1038,8 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct
|
||||||
return _0_, not multi, 3
|
return _0_, not multi, 3
|
||||||
else
|
else
|
||||||
return nil, true, 2
|
return nil, true, 2
|
||||||
<<<<<<< HEAD
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local function compile_named_fn(ast, f_scope, f_chunk, parent, index, fn_name, local_3f, arg_name_list, arg_list, docstring)
|
|
||||||
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 _0_
|
|
||||||
if local_3f then
|
|
||||||
_0_ = "local function %s(%s)"
|
|
||||||
else
|
|
||||||
_0_ = "%s = function(%s)"
|
|
||||||
=======
|
|
||||||
>>>>>>> technomancy/min-love2d-fennel-0.9.0
|
|
||||||
end
|
|
||||||
compiler.emit(parent, string.format(_0_, fn_name, table.concat(arg_name_list, ", ")), ast)
|
|
||||||
compiler.emit(parent, f_chunk, ast)
|
|
||||||
compiler.emit(parent, "end", ast)
|
|
||||||
set_fn_metadata(arg_list, docstring, parent, fn_name)
|
|
||||||
utils.hook("fn", ast, f_scope)
|
|
||||||
return utils.expr(fn_name, "sym")
|
|
||||||
end
|
|
||||||
local function compile_anonymous_fn(ast, f_scope, f_chunk, parent, index, arg_name_list, arg_list, docstring, scope)
|
|
||||||
local fn_name = compiler.gensym(scope)
|
|
||||||
return compile_named_fn(ast, f_scope, f_chunk, parent, index, fn_name, true, arg_name_list, arg_list, docstring)
|
|
||||||
end
|
|
||||||
local function compile_named_fn(ast, f_scope, f_chunk, parent, index, fn_name, local_3f, arg_name_list, arg_list, docstring)
|
local function compile_named_fn(ast, f_scope, f_chunk, parent, index, fn_name, local_3f, arg_name_list, arg_list, docstring)
|
||||||
for i = (index + 1), #ast do
|
for i = (index + 1), #ast do
|
||||||
compiler.compile1(ast[i], f_scope, f_chunk, {nval = (((i ~= #ast) and 0) or nil), tail = (i == #ast)})
|
compiler.compile1(ast[i], f_scope, f_chunk, {nval = (((i ~= #ast) and 0) or nil), tail = (i == #ast)})
|
||||||
|
@ -1571,7 +1547,6 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct
|
||||||
_0_ = 1
|
_0_ = 1
|
||||||
else
|
else
|
||||||
_0_ = nil
|
_0_ = nil
|
||||||
<<<<<<< HEAD
|
|
||||||
end
|
end
|
||||||
subexprs = compiler.compile1(ast[i], scope, parent, {nval = _0_})
|
subexprs = compiler.compile1(ast[i], scope, parent, {nval = _0_})
|
||||||
utils.map(subexprs, tostring, operands)
|
utils.map(subexprs, tostring, operands)
|
||||||
|
@ -1591,27 +1566,6 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct
|
||||||
local function _0_(...)
|
local function _0_(...)
|
||||||
return arithmetic_special((lua_name or name), zero_arity, unary_prefix, ...)
|
return arithmetic_special((lua_name or name), zero_arity, unary_prefix, ...)
|
||||||
end
|
end
|
||||||
=======
|
|
||||||
end
|
|
||||||
subexprs = compiler.compile1(ast[i], scope, parent, {nval = _0_})
|
|
||||||
utils.map(subexprs, tostring, operands)
|
|
||||||
end
|
|
||||||
if (#operands == 1) then
|
|
||||||
if unary_prefix then
|
|
||||||
return ("(" .. unary_prefix .. padded_op .. operands[1] .. ")")
|
|
||||||
else
|
|
||||||
return operands[1]
|
|
||||||
end
|
|
||||||
else
|
|
||||||
return ("(" .. table.concat(operands, padded_op) .. ")")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local function define_arithmetic_special(name, zero_arity, unary_prefix, lua_name)
|
|
||||||
local function _0_(...)
|
|
||||||
return arithmetic_special((lua_name or name), zero_arity, unary_prefix, ...)
|
|
||||||
end
|
|
||||||
>>>>>>> technomancy/min-love2d-fennel-0.9.0
|
|
||||||
SPECIALS[name] = _0_
|
SPECIALS[name] = _0_
|
||||||
return doc_special(name, {"a", "b", "..."}, "Arithmetic operator; works the same as Lua but accepts more arguments.")
|
return doc_special(name, {"a", "b", "..."}, "Arithmetic operator; works the same as Lua but accepts more arguments.")
|
||||||
end
|
end
|
||||||
|
@ -2422,18 +2376,7 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct
|
||||||
if ((se.type == "expression") and (se[1] ~= "nil")) then
|
if ((se.type == "expression") and (se[1] ~= "nil")) then
|
||||||
emit(chunk, string.format("do local _ = %s end", tostring(se)), ast)
|
emit(chunk, string.format("do local _ = %s end", tostring(se)), ast)
|
||||||
elseif (se.type == "statement") then
|
elseif (se.type == "statement") then
|
||||||
<<<<<<< HEAD
|
|
||||||
emit(chunk, disambiguate_parens(tostring(se), chunk), ast)
|
emit(chunk, disambiguate_parens(tostring(se), chunk), ast)
|
||||||
=======
|
|
||||||
local code = tostring(se)
|
|
||||||
local unambiguous_code = nil
|
|
||||||
if (code:byte() == 40) then
|
|
||||||
unambiguous_code = ("; " .. code)
|
|
||||||
else
|
|
||||||
unambiguous_code = code
|
|
||||||
end
|
|
||||||
emit(chunk, unambiguous_code, ast)
|
|
||||||
>>>>>>> technomancy/min-love2d-fennel-0.9.0
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
|
@ -3904,11 +3847,7 @@ package.preload["fennel"] = package.preload["fennel"] or function(...)
|
||||||
opts.filename = filename
|
opts.filename = filename
|
||||||
return eval(source, opts, ...)
|
return eval(source, opts, ...)
|
||||||
end
|
end
|
||||||
<<<<<<< HEAD
|
|
||||||
local mod = {["comment?"] = utils["comment?"], ["compile-stream"] = compiler["compile-stream"], ["compile-string"] = compiler["compile-string"], ["list?"] = utils["list?"], ["load-code"] = specials["load-code"], ["macro-loaded"] = specials["macro-loaded"], ["macro-searchers"] = specials["macro-searchers"], ["make-searcher"] = specials["make-searcher"], ["search-module"] = specials["search-module"], ["sequence?"] = utils["sequence?"], ["string-stream"] = parser["string-stream"], ["sym-char?"] = parser["sym-char?"], ["sym?"] = utils["sym?"], comment = utils.comment, compile = compiler.compile, compile1 = compiler.compile1, compileStream = compiler["compile-stream"], compileString = compiler["compile-string"], doc = specials.doc, dofile = dofile_2a, eval = eval, gensym = compiler.gensym, granulate = parser.granulate, list = utils.list, loadCode = specials["load-code"], macroLoaded = specials["macro-loaded"], makeSearcher = specials["make-searcher"], make_searcher = specials["make-searcher"], mangle = compiler["global-mangling"], metadata = compiler.metadata, parser = parser.parser, path = utils.path, repl = repl, scope = compiler["make-scope"], searchModule = specials["search-module"], searcher = specials["make-searcher"](), sequence = utils.sequence, stringStream = parser["string-stream"], sym = utils.sym, traceback = compiler.traceback, unmangle = compiler["global-unmangling"], varg = utils.varg, version = "0.9.1", view = view}
|
local mod = {["comment?"] = utils["comment?"], ["compile-stream"] = compiler["compile-stream"], ["compile-string"] = compiler["compile-string"], ["list?"] = utils["list?"], ["load-code"] = specials["load-code"], ["macro-loaded"] = specials["macro-loaded"], ["macro-searchers"] = specials["macro-searchers"], ["make-searcher"] = specials["make-searcher"], ["search-module"] = specials["search-module"], ["sequence?"] = utils["sequence?"], ["string-stream"] = parser["string-stream"], ["sym-char?"] = parser["sym-char?"], ["sym?"] = utils["sym?"], comment = utils.comment, compile = compiler.compile, compile1 = compiler.compile1, compileStream = compiler["compile-stream"], compileString = compiler["compile-string"], doc = specials.doc, dofile = dofile_2a, eval = eval, gensym = compiler.gensym, granulate = parser.granulate, list = utils.list, loadCode = specials["load-code"], macroLoaded = specials["macro-loaded"], makeSearcher = specials["make-searcher"], make_searcher = specials["make-searcher"], mangle = compiler["global-mangling"], metadata = compiler.metadata, parser = parser.parser, path = utils.path, repl = repl, scope = compiler["make-scope"], searchModule = specials["search-module"], searcher = specials["make-searcher"](), sequence = utils.sequence, stringStream = parser["string-stream"], sym = utils.sym, traceback = compiler.traceback, unmangle = compiler["global-unmangling"], varg = utils.varg, version = "0.9.1", view = view}
|
||||||
=======
|
|
||||||
local mod = {["comment?"] = utils["comment?"], ["compile-stream"] = compiler["compile-stream"], ["compile-string"] = compiler["compile-string"], ["list?"] = utils["list?"], ["load-code"] = specials["load-code"], ["macro-loaded"] = specials["macro-loaded"], ["macro-searchers"] = specials["macro-searchers"], ["make-searcher"] = specials["make-searcher"], ["search-module"] = specials["search-module"], ["sequence?"] = utils["sequence?"], ["string-stream"] = parser["string-stream"], ["sym-char?"] = parser["sym-char?"], ["sym?"] = utils["sym?"], comment = utils.comment, compile = compiler.compile, compile1 = compiler.compile1, compileStream = compiler["compile-stream"], compileString = compiler["compile-string"], doc = specials.doc, dofile = dofile_2a, eval = eval, gensym = compiler.gensym, granulate = parser.granulate, list = utils.list, loadCode = specials["load-code"], macroLoaded = specials["macro-loaded"], makeSearcher = specials["make-searcher"], make_searcher = specials["make-searcher"], mangle = compiler["global-mangling"], metadata = compiler.metadata, parser = parser.parser, path = utils.path, repl = repl, scope = compiler["make-scope"], searchModule = specials["search-module"], searcher = specials["make-searcher"](), sequence = utils.sequence, stringStream = parser["string-stream"], sym = utils.sym, traceback = compiler.traceback, unmangle = compiler["global-unmangling"], varg = utils.varg, version = "0.9.0", view = view}
|
|
||||||
>>>>>>> technomancy/min-love2d-fennel-0.9.0
|
|
||||||
utils["fennel-module"] = mod
|
utils["fennel-module"] = mod
|
||||||
do
|
do
|
||||||
local builtin_macros = [===[;; This module contains all the built-in Fennel macros. Unlike all the other
|
local builtin_macros = [===[;; This module contains all the built-in Fennel macros. Unlike all the other
|
||||||
|
|
|
@ -898,16 +898,6 @@ package.preload["fennel.specials"] = package.preload["fennel.specials"] or funct
|
||||||
else
|
else
|
||||||
return nil, true, 2
|
return nil, true, 2
|
||||||
end
|
end
|
||||||
compiler.emit(parent, string.format(_0_, fn_name, table.concat(arg_name_list, ", ")), ast)
|
|
||||||
compiler.emit(parent, f_chunk, ast)
|
|
||||||
compiler.emit(parent, "end", ast)
|
|
||||||
set_fn_metadata(arg_list, docstring, parent, fn_name)
|
|
||||||
utils.hook("fn", ast, f_scope)
|
|
||||||
return utils.expr(fn_name, "sym")
|
|
||||||
end
|
|
||||||
local function compile_anonymous_fn(ast, f_scope, f_chunk, parent, index, arg_name_list, arg_list, docstring, scope)
|
|
||||||
local fn_name = compiler.gensym(scope)
|
|
||||||
return compile_named_fn(ast, f_scope, f_chunk, parent, index, fn_name, true, arg_name_list, arg_list, docstring)
|
|
||||||
end
|
end
|
||||||
local function compile_named_fn(ast, f_scope, f_chunk, parent, index, fn_name, local_3f, arg_name_list, arg_list, docstring)
|
local function compile_named_fn(ast, f_scope, f_chunk, parent, index, fn_name, local_3f, arg_name_list, arg_list, docstring)
|
||||||
for i = (index + 1), #ast do
|
for i = (index + 1), #ast do
|
||||||
|
@ -2245,14 +2235,7 @@ package.preload["fennel.compiler"] = package.preload["fennel.compiler"] or funct
|
||||||
if ((se.type == "expression") and (se[1] ~= "nil")) then
|
if ((se.type == "expression") and (se[1] ~= "nil")) then
|
||||||
emit(chunk, string.format("do local _ = %s end", tostring(se)), ast)
|
emit(chunk, string.format("do local _ = %s end", tostring(se)), ast)
|
||||||
elseif (se.type == "statement") then
|
elseif (se.type == "statement") then
|
||||||
local code = tostring(se)
|
emit(chunk, disambiguate_parens(tostring(se), chunk), ast)
|
||||||
local unambiguous_code = nil
|
|
||||||
if (code:byte() == 40) then
|
|
||||||
unambiguous_code = ("; " .. code)
|
|
||||||
else
|
|
||||||
unambiguous_code = code
|
|
||||||
end
|
|
||||||
emit(chunk, unambiguous_code, ast)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
|
@ -3723,7 +3706,7 @@ local function dofile_2a(filename, options, ...)
|
||||||
opts.filename = filename
|
opts.filename = filename
|
||||||
return eval(source, opts, ...)
|
return eval(source, opts, ...)
|
||||||
end
|
end
|
||||||
local mod = {["comment?"] = utils["comment?"], ["compile-stream"] = compiler["compile-stream"], ["compile-string"] = compiler["compile-string"], ["list?"] = utils["list?"], ["load-code"] = specials["load-code"], ["macro-loaded"] = specials["macro-loaded"], ["macro-searchers"] = specials["macro-searchers"], ["make-searcher"] = specials["make-searcher"], ["search-module"] = specials["search-module"], ["sequence?"] = utils["sequence?"], ["string-stream"] = parser["string-stream"], ["sym-char?"] = parser["sym-char?"], ["sym?"] = utils["sym?"], comment = utils.comment, compile = compiler.compile, compile1 = compiler.compile1, compileStream = compiler["compile-stream"], compileString = compiler["compile-string"], doc = specials.doc, dofile = dofile_2a, eval = eval, gensym = compiler.gensym, granulate = parser.granulate, list = utils.list, loadCode = specials["load-code"], macroLoaded = specials["macro-loaded"], makeSearcher = specials["make-searcher"], make_searcher = specials["make-searcher"], mangle = compiler["global-mangling"], metadata = compiler.metadata, parser = parser.parser, path = utils.path, repl = repl, scope = compiler["make-scope"], searchModule = specials["search-module"], searcher = specials["make-searcher"](), sequence = utils.sequence, stringStream = parser["string-stream"], sym = utils.sym, traceback = compiler.traceback, unmangle = compiler["global-unmangling"], varg = utils.varg, version = "0.9.0", view = view}
|
local mod = {["comment?"] = utils["comment?"], ["compile-stream"] = compiler["compile-stream"], ["compile-string"] = compiler["compile-string"], ["list?"] = utils["list?"], ["load-code"] = specials["load-code"], ["macro-loaded"] = specials["macro-loaded"], ["macro-searchers"] = specials["macro-searchers"], ["make-searcher"] = specials["make-searcher"], ["search-module"] = specials["search-module"], ["sequence?"] = utils["sequence?"], ["string-stream"] = parser["string-stream"], ["sym-char?"] = parser["sym-char?"], ["sym?"] = utils["sym?"], comment = utils.comment, compile = compiler.compile, compile1 = compiler.compile1, compileStream = compiler["compile-stream"], compileString = compiler["compile-string"], doc = specials.doc, dofile = dofile_2a, eval = eval, gensym = compiler.gensym, granulate = parser.granulate, list = utils.list, loadCode = specials["load-code"], macroLoaded = specials["macro-loaded"], makeSearcher = specials["make-searcher"], make_searcher = specials["make-searcher"], mangle = compiler["global-mangling"], metadata = compiler.metadata, parser = parser.parser, path = utils.path, repl = repl, scope = compiler["make-scope"], searchModule = specials["search-module"], searcher = specials["make-searcher"](), sequence = utils.sequence, stringStream = parser["string-stream"], sym = utils.sym, traceback = compiler.traceback, unmangle = compiler["global-unmangling"], varg = utils.varg, version = "0.9.1", view = view}
|
||||||
utils["fennel-module"] = mod
|
utils["fennel-module"] = mod
|
||||||
do
|
do
|
||||||
local builtin_macros = [===[;; This module contains all the built-in Fennel macros. Unlike all the other
|
local builtin_macros = [===[;; This module contains all the built-in Fennel macros. Unlike all the other
|
||||||
|
|
Loading…
Reference in a new issue