recompiled

This commit is contained in:
leaf corcoran 2011-07-14 23:29:06 -07:00
parent 4634b76ad0
commit a57efb3511
4 changed files with 658 additions and 226 deletions

View File

@ -13,11 +13,13 @@ Line = (function(_parent_0)
local _base_0 = {
_append_single = function(self, item)
if util.moon.type(item) == Line then
do
local _item_0 = item
for _index_0 = 1, #_item_0 do
local value = _item_0[_index_0]
self:_append_single(value)
end
end
else
insert(self, item)
end
@ -32,11 +34,15 @@ Line = (function(_parent_0)
end
end,
append = function(self, ...)
local _item_0 = { ... }
do
local _item_0 = {
...
}
for _index_0 = 1, #_item_0 do
local item = _item_0[_index_0]
self:_append_single(item)
end
end
return nil
end,
render = function(self)
@ -55,15 +61,23 @@ Line = (function(_parent_0)
end
}
_base_0.__index = _base_0
local _class_0 = setmetatable({ __init = function(self, ...)
if _parent_0 then
setmetatable(_base_0, getmetatable(_parent_0).__index)
end
local _class_0 = setmetatable({
__init = function(self, ...)
if _parent_0 then
return _parent_0.__init(self, ...)
end
end }, { __index = _base_0, __call = function(mt, ...)
end
}, {
__index = _base_0,
__call = function(mt, ...)
local self = setmetatable({}, _base_0)
mt.__init(self, ...)
return self
end })
end
})
_base_0.__class = _class_0
return _class_0
end)()
@ -72,36 +86,57 @@ Block_ = (function(_parent_0)
local _base_0 = {
header = "do",
footer = "end",
line_table = function(self) return self._posmap end,
set = function(self, name, value) self._state[name] = value end,
get = function(self, name) return self._state[name] end,
line_table = function(self)
return self._posmap
end,
set = function(self, name, value)
self._state[name] = value
end,
get = function(self, name)
return self._state[name]
end,
declare = function(self, names)
local undeclared = (function()
local _moon_0 = {}
local _accum_0 = { }
do
local _item_0 = names
for _index_0 = 1, #_item_0 do
local name = _item_0[_index_0]
if type(name) == "string" and not self:has_name(name) then
table.insert(_moon_0, name)
table.insert(_accum_0, name)
end
end
return _moon_0
end
return _accum_0
end)()
do
local _item_0 = undeclared
for _index_0 = 1, #_item_0 do
local name = _item_0[_index_0]
self:put_name(name)
end
end
return undeclared
end,
put_name = function(self, name) self._names[name] = true end,
has_name = function(self, name) return self._names[name] end,
put_name = function(self, name)
self._names[name] = true
end,
has_name = function(self, name)
return self._names[name]
end,
shadow_name = function(self, name)
self._names[name] = false
end,
free_name = function(self, prefix, dont_put)
prefix = prefix or "moon"
local searching = true
local name, i = nil, 0
while searching do
name = concat({ "", prefix, i }, "_")
name = concat({
"",
prefix,
i
}, "_")
i = i + 1
searching = self:has_name(name)
end
@ -112,7 +147,15 @@ Block_ = (function(_parent_0)
end,
init_free_var = function(self, prefix, value)
local name = self:free_name(prefix, true)
self:stm({ "assign", { name }, { value } })
self:stm({
"assign",
{
name
},
{
value
}
})
return name
end,
mark_pos = function(self, node)
@ -137,8 +180,14 @@ Block_ = (function(_parent_0)
return error("Adding unknown item")
end
end,
push = function(self) self._names = setmetatable({ }, { __index = self._names }) end,
pop = function(self) self._names = getmetatable(self._names).__index end,
push = function(self)
self._names = setmetatable({ }, {
__index = self._names
})
end,
pop = function(self)
self._names = getmetatable(self._names).__index
end,
_insert_breaks = function(self)
for i = 1, #self._lines - 1 do
local left, right = self._lines[i], self._lines[i + 1]
@ -159,22 +208,31 @@ Block_ = (function(_parent_0)
local header = flatten(self.header)
if #self._lines == 0 then
local footer = flatten(self.footer)
return(concat({ header, footer }, " "))
return(concat({
header,
footer
}, " "))
end
local indent = indent_char:rep(self.indent)
if not self.delim then
self:_insert_breaks()
end
local body = indent .. concat(self._lines, (self.delim or "") .. "\n" .. indent)
return concat({ header, body, indent_char:rep(self.indent - 1) .. (function()
return concat({
header,
body,
indent_char:rep(self.indent - 1) .. (function()
if self.next then
return self.next:render()
else
return flatten(self.footer)
end
end)() }, "\n")
end)()
}, "\n")
end,
block = function(self, header, footer)
return Block(self, header, footer)
end,
block = function(self, header, footer) return Block(self, header, footer) end,
line = function(self, ...)
do
local _with_0 = Line()
@ -182,12 +240,16 @@ Block_ = (function(_parent_0)
return _with_0
end
end,
is_stm = function(self, node) return line_compile[ntype(node)] ~= nil end,
is_stm = function(self, node)
return line_compile[ntype(node)] ~= nil
end,
is_value = function(self, node)
local t = ntype(node)
return value_compile[t] ~= nil or t == "value"
end,
name = function(self, node) return self:value(node) end,
name = function(self, node)
return self:value(node)
end,
value = function(self, node, ...)
if type(node) ~= "table" then
return(tostring(node))
@ -204,13 +266,15 @@ Block_ = (function(_parent_0)
do
local _with_0 = Line()
_with_0:append_list((function()
local _moon_0 = {}
local _accum_0 = { }
do
local _item_0 = values
for _index_0 = 1, #_item_0 do
local v = _item_0[_index_0]
table.insert(_moon_0, self:value(v))
table.insert(_accum_0, self:value(v))
end
return _moon_0
end
return _accum_0
end)(), delim)
return _with_0
end
@ -219,7 +283,15 @@ Block_ = (function(_parent_0)
local fn = line_compile[ntype(node)]
if not fn then
if has_value(node) then
return self:stm({ "assign", { "_" }, { node } })
return self:stm({
"assign",
{
"_"
},
{
node
}
})
else
return self:add(self:value(node))
end
@ -260,17 +332,23 @@ Block_ = (function(_parent_0)
if ret then
self:ret_stms(stms, ret)
else
do
local _item_0 = stms
for _index_0 = 1, #_item_0 do
local stm = _item_0[_index_0]
self:stm(stm)
end
end
end
return nil
end
}
_base_0.__index = _base_0
local _class_0 = setmetatable({ __init = function(self, parent, header, footer)
if _parent_0 then
setmetatable(_base_0, getmetatable(_parent_0).__index)
end
local _class_0 = setmetatable({
__init = function(self, parent, header, footer)
self.parent, self.header, self.footer = parent, header, footer
self.line_offset = 1
self._lines = { }
@ -279,38 +357,53 @@ Block_ = (function(_parent_0)
self._state = { }
if self.parent then
self.indent = self.parent.indent + 1
setmetatable(self._state, { __index = self.parent._state })
return setmetatable(self._names, { __index = self.parent._names })
setmetatable(self._state, {
__index = self.parent._state
})
return setmetatable(self._names, {
__index = self.parent._names
})
else
self.indent = 0
end
end }, { __index = _base_0, __call = function(mt, ...)
end
}, {
__index = _base_0,
__call = function(mt, ...)
local self = setmetatable({}, _base_0)
mt.__init(self, ...)
return self
end })
end
})
_base_0.__class = _class_0
return _class_0
end)()
local RootBlock
RootBlock = (function(_parent_0)
local _base_0 = { render = function(self)
local _base_0 = {
render = function(self)
self:_insert_breaks()
return concat(self._lines, "\n")
end }
end
}
_base_0.__index = _base_0
if _parent_0 then
setmetatable(_base_0, getmetatable(_parent_0).__index)
end
local _class_0 = setmetatable({ __init = function(self, ...)
local _class_0 = setmetatable({
__init = function(self, ...)
if _parent_0 then
return _parent_0.__init(self, ...)
end
end }, { __index = _base_0, __call = function(mt, ...)
end
}, {
__index = _base_0,
__call = function(mt, ...)
local self = setmetatable({}, _base_0)
mt.__init(self, ...)
return self
end })
end
})
_base_0.__class = _class_0
return _class_0
end)(Block_)
@ -318,16 +411,21 @@ Block = Block_
format_error = function(msg, pos, file_str)
local line = pos_to_line(file_str, pos)
local line_str = get_line(file_str, line) or ""
return concat({ msg, ("On line [%d]:\n\t%s"):format(line, trim(line_str, line)) }, "\n")
return concat({
msg,
("On line [%d]:\n\t%s"):format(line, trim(line_str, line))
}, "\n")
end
tree = function(tree)
local scope = RootBlock()
local runner = coroutine.create(function()
do
local _item_0 = tree
for _index_0 = 1, #_item_0 do
local line = _item_0[_index_0]
scope:stm(line)
end
end
return scope:render()
end)
local success, result = coroutine.resume(runner)

View File

@ -7,18 +7,30 @@ local concat, insert = table.concat, table.insert
indent_char = " "
returner = function(exp)
if ntype(exp) == "chain" and exp[2] == "return" then
local items = { "explist" }
local items = {
"explist"
}
do
local _item_0 = exp[3][2]
for _index_0 = 1, #_item_0 do
local v = _item_0[_index_0]
insert(items, v)
end
return { "return", items }
end
return {
"return",
items
}
else
return { "return", exp }
return {
"return",
exp
}
end
end
moonlib = { bind = function(tbl, name) return concat({
moonlib = {
bind = function(tbl, name)
return concat({
"moon.bind(",
tbl,
".",
@ -26,9 +38,16 @@ moonlib = { bind = function(tbl, name) return concat({
", ",
tbl,
")"
}) end }
cascading = Set({ "if", "with" })
non_atomic = Set({ "update" })
})
end
}
cascading = Set({
"if",
"with"
})
non_atomic = Set({
"update"
})
has_value = function(node)
if ntype(node) == "chain" then
local ctype = ntype(node[#node])
@ -37,8 +56,12 @@ has_value = function(node)
return true
end
end
is_non_atomic = function(node) return non_atomic[ntype(node)] end
is_slice = function(node) return ntype(node) == "chain" and ntype(node[#node]) == "slice" end
is_non_atomic = function(node)
return non_atomic[ntype(node)]
end
is_slice = function(node)
return ntype(node) == "chain" and ntype(node[#node]) == "slice"
end
count_lines = function(str)
local count = 1
for _ in str:gmatch("\n") do

View File

@ -19,13 +19,15 @@ line_compile = {
do
local _with_0 = self:line("local ")
_with_0:append_list((function()
local _moon_0 = {}
local _accum_0 = { }
do
local _item_0 = names
for _index_0 = 1, #_item_0 do
local name = _item_0[_index_0]
table.insert(_moon_0, self:name(name))
table.insert(_accum_0, self:name(name))
end
return _moon_0
end
return _accum_0
end)(), ", ")
return _with_0
end
@ -41,7 +43,15 @@ line_compile = {
end
if cascading[ntype(values)] then
local decorate
decorate = function(value) return { "assign", names, { value } } end
decorate = function(value)
return {
"assign",
names,
{
value
}
}
end
return self:stm(values, decorate)
else
return error("Assigning unsupported statement")
@ -64,24 +74,28 @@ line_compile = {
self:add(declare)
end
_with_0:append_list((function()
local _moon_0 = {}
local _accum_0 = { }
do
local _item_0 = names
for _index_0 = 1, #_item_0 do
local name = _item_0[_index_0]
table.insert(_moon_0, self:value(name))
table.insert(_accum_0, self:value(name))
end
return _moon_0
end
return _accum_0
end)(), ", ")
end
_with_0:append(" = ")
_with_0:append_list((function()
local _moon_0 = {}
local _accum_0 = { }
do
local _item_0 = values
for _index_0 = 1, #_item_0 do
local v = _item_0[_index_0]
table.insert(_moon_0, self:value(v))
table.insert(_accum_0, self:value(v))
end
return _moon_0
end
return _accum_0
end)(), ", ")
return _with_0
end
@ -93,15 +107,27 @@ line_compile = {
if not op_final then
_ = error("unknown op: ") .. op
end
return self:stm({ "assign", { name }, { {
return self:stm({
"assign",
{
name
},
{
{
"exp",
name,
op_final,
exp
} } })
}
}
})
end,
["return"] = function(self, node)
return self:line("return ", self:value(node[2]))
end,
["break"] = function(self, node)
return "break"
end,
["return"] = function(self, node) return self:line("return ", self:value(node[2])) end,
["break"] = function(self, node) return "break" end,
import = function(self, node)
local _, names, source = unpack(node)
local to_bind = { }
@ -116,19 +142,23 @@ line_compile = {
end
end
local final_names = (function()
local _moon_0 = {}
local _accum_0 = { }
do
local _item_0 = names
for _index_0 = 1, #_item_0 do
local n = _item_0[_index_0]
table.insert(_moon_0, get_name(n))
table.insert(_accum_0, get_name(n))
end
return _moon_0
end
return _accum_0
end)()
do
local _item_0 = final_names
for _index_0 = 1, #_item_0 do
local name = _item_0[_index_0]
self:put_name(name)
end
end
local get_value
get_value = function(name)
if to_bind[name] then
@ -139,13 +169,15 @@ line_compile = {
end
if type(source) == "string" then
local values = (function()
local _moon_0 = {}
local _accum_0 = { }
do
local _item_0 = final_names
for _index_0 = 1, #_item_0 do
local name = _item_0[_index_0]
table.insert(_moon_0, get_value(name))
table.insert(_accum_0, get_value(name))
end
return _moon_0
end
return _accum_0
end)()
local line
do
@ -159,10 +191,20 @@ line_compile = {
do
local _with_0 = self:block("do")
source = _with_0:init_free_var("table", source)
do
local _item_0 = final_names
for _index_0 = 1, #_item_0 do
local name = _item_0[_index_0]
_with_0:stm({ "assign", { name }, { get_value(name) } })
_with_0:stm({
"assign",
{
name
},
{
get_value(name)
}
})
end
end
return _with_0
end
@ -191,11 +233,13 @@ line_compile = {
current.next = next
current = next
end
do
local _item_0 = node
for _index_0 = 4, #_item_0 do
local cond = _item_0[_index_0]
add_clause(cond)
end
end
return root
end,
["while"] = function(self, node)
@ -204,7 +248,18 @@ line_compile = {
if is_non_atomic(cond) then
do
local _with_0 = self:block("while true do")
_with_0:stm({ "if", { "not", cond }, { { "break" } } })
_with_0:stm({
"if",
{
"not",
cond
},
{
{
"break"
}
}
})
out = _with_0
end
else
@ -215,7 +270,10 @@ line_compile = {
end,
["for"] = function(self, node)
local _, name, bounds, block = unpack(node)
local loop = self:line("for ", self:name(name), " = ", self:value({ "explist", unpack(bounds) }), " do")
local loop = self:line("for ", self:name(name), " = ", self:value({
"explist",
unpack(bounds)
}), " do")
do
local _with_0 = self:block(loop)
_with_0:stms(block)
@ -243,31 +301,73 @@ line_compile = {
"<",
0,
"and",
{ "length", items_tmp },
{
"length",
items_tmp
},
"+",
max_tmp,
"or",
max_tmp
}
else
slice[2] = { "length", items_tmp }
slice[2] = {
"length",
items_tmp
}
end
bounds = slice
else
bounds = { 1, { "length", items_tmp } }
bounds = {
1,
{
"length",
items_tmp
}
}
end
local index_tmp = _with_0:free_name("index")
_with_0:stm({ "assign", { items_tmp }, { iter } })
_with_0:stm({
"assign",
{
items_tmp
},
{
iter
}
})
block = (function()
local _moon_0 = {}
local _accum_0 = { }
do
local _item_0 = block
for _index_0 = 1, #_item_0 do
local s = _item_0[_index_0]
table.insert(_moon_0, s)
table.insert(_accum_0, s)
end
return _moon_0
end
return _accum_0
end)()
insert(block, 1, { "assign", names, { { "chain", items_tmp, { "index", index_tmp } } } })
do
local _item_0 = names
for _index_0 = 1, #_item_0 do
local name = _item_0[_index_0]
_with_0:shadow_name(name)
end
end
insert(block, 1, {
"assign",
names,
{
{
"chain",
items_tmp,
{
"index",
index_tmp
}
}
}
})
_with_0:stm({
"for",
index_tmp,
@ -283,13 +383,15 @@ line_compile = {
local _with_0 = self:line()
_with_0:append("for ")
_with_0:append_list((function()
local _moon_0 = {}
local _accum_0 = { }
do
local _item_0 = names
for _index_0 = 1, #_item_0 do
local name = _item_0[_index_0]
table.insert(_moon_0, self:name(name))
table.insert(_accum_0, self:name(name))
end
return _moon_0
end
return _accum_0
end)(), ", ")
_with_0:append(" in ", self:value(exp), " do")
loop = _with_0
@ -314,22 +416,46 @@ line_compile = {
if name == constructor_name then
constructor = value
else
return insert(final_properties, { name, value })
return insert(final_properties, {
name,
value
})
end
end
do
local _item_0 = tbl[2]
for _index_0 = 1, #_item_0 do
local entry = _item_0[_index_0]
find_special(unpack(entry))
end
end
tbl[2] = final_properties
local parent_loc = self:free_name("parent", true)
if not constructor then
constructor = {
"fndef",
{ "..." },
{
"..."
},
"fat",
{ { "if", parent_loc, { { "chain", "super", { "call", { "..." } } } } } }
{
{
"if",
parent_loc,
{
{
"chain",
"super",
{
"call",
{
"..."
}
}
}
}
}
}
}
end
local self_args = { }
@ -342,27 +468,38 @@ line_compile = {
return arg
end
constructor[2] = (function()
local _moon_0 = {}
local _accum_0 = { }
do
local _item_0 = constructor[2]
for _index_0 = 1, #_item_0 do
local arg = _item_0[_index_0]
table.insert(_moon_0, get_initializers(arg))
table.insert(_accum_0, get_initializers(arg))
end
return _moon_0
end
return _accum_0
end)()
constructor[3] = "fat"
local body = constructor[4]
local dests = (function()
local _moon_0 = {}
local _accum_0 = { }
do
local _item_0 = self_args
for _index_0 = 1, #_item_0 do
local name = _item_0[_index_0]
table.insert(_moon_0, { "self", name })
table.insert(_accum_0, {
"self",
name
})
end
return _moon_0
end
return _accum_0
end)()
if #self_args > 0 then
insert(body, 1, { "assign", dests, self_args })
insert(body, 1, {
"assign",
dests,
self_args
})
end
local def_scope
do
@ -376,15 +513,23 @@ line_compile = {
_with_0:set("super", function(block, chain)
local calling_name = block:get("current_block")
local slice = (function()
local _moon_0 = {}
local _accum_0 = { }
do
local _item_0 = chain
for _index_0 = 3, #_item_0 do
local item = _item_0[_index_0]
table.insert(_moon_0, item)
table.insert(_accum_0, item)
end
return _moon_0
end
return _accum_0
end)()
slice[1] = { "call", { "self", unpack(slice[1][2]) } }
slice[1] = {
"call",
{
"self",
unpack(slice[1][2])
}
}
local act
if ntype(calling_name) ~= "value" then
act = "index"
@ -394,37 +539,154 @@ line_compile = {
return {
"chain",
parent_loc,
{ act, calling_name },
{
act,
calling_name
},
unpack(slice)
}
end)
local base_name = _with_0:init_free_var("base", tbl)
_with_0:stm({ "assign", { { "chain", base_name, { "dot", "__index" } } }, { base_name } })
_with_0:stm({ "if", parent_loc, { { "chain", "setmetatable", { "call", { base_name, {
_with_0:stm({
"assign",
{
{
"chain",
base_name,
{
"dot",
"__index"
}
}
},
{
base_name
}
})
_with_0:stm({
"if",
parent_loc,
{
{
"chain",
"setmetatable",
{
"call",
{
base_name,
{
"chain",
"getmetatable",
{ "call", { parent_loc } },
{ "dot", "__index" }
} } } } } })
local cls = { "table", { { "__init", constructor } } }
local cls_mt = { "table", { { "__index", base_name }, { "__call", {
{
"call",
{
parent_loc
}
},
{
"dot",
"__index"
}
}
}
}
}
}
})
local cls = {
"table",
{
{
"__init",
constructor
}
}
}
local cls_mt = {
"table",
{
{
"__index",
base_name
},
{
"__call",
{
"fndef",
{ "mt", "..." },
{
"mt",
"..."
},
"slim",
{ { "raw", ("local self = setmetatable({}, %s)"):format(base_name) }, { "chain", "mt.__init", { "call", { "self", "..." } } }, "self" }
} } } }
local cls_name = _with_0:init_free_var("class", { "chain", "setmetatable", { "call", { cls, cls_mt } } })
_with_0:stm({ "assign", { { "chain", base_name, { "dot", "__class" } } }, { cls_name } })
_with_0:stm({ "return", cls_name })
{
{
"raw",
("local self = setmetatable({}, %s)"):format(base_name)
},
{
"chain",
"mt.__init",
{
"call",
{
"self",
"..."
}
}
},
"self"
}
}
}
}
}
local cls_name = _with_0:init_free_var("class", {
"chain",
"setmetatable",
{
"call",
{
cls,
cls_mt
}
}
})
_with_0:stm({
"assign",
{
{
"chain",
base_name,
{
"dot",
"__class"
}
}
},
{
cls_name
}
})
_with_0:stm({
"return",
cls_name
})
def_scope = _with_0
end
self:stm({ "declare", { name } })
self:stm({
"declare",
{
name
}
})
return self:line(name, " = ", def_scope)
end,
comprehension = function(self, node, action)
local _, exp, clauses = unpack(node)
if not action then
action = function(exp) return exp end
action = function(exp)
return exp
end
end
local statement = action(exp)
local build_clause
@ -437,12 +699,20 @@ line_compile = {
"foreach",
names,
iter,
{ statement }
{
statement
}
}
elseif t == "when" then
local cond
_, cond = unpack(clause)
statement = { "if", cond, { statement } }
statement = {
"if",
cond,
{
statement
}
}
else
statement = error("Unknown comprehension clause: " .. t)
end

View File

@ -17,13 +17,13 @@ value_compile = {
do
local _with_0 = self:line()
_with_0:append_list((function()
local _moon_0 = {}
local _accum_0 = { }
for i, v in ipairs(node) do
if i > 1 then
table.insert(_moon_0, _comp(i, v))
table.insert(_accum_0, _comp(i, v))
end
end
return _moon_0
return _accum_0
end)(), " ")
return _with_0
end
@ -37,18 +37,22 @@ value_compile = {
do
local _with_0 = self:line()
_with_0:append_list((function()
local _moon_0 = {}
local _accum_0 = { }
do
local _item_0 = node
for _index_0 = 2, #_item_0 do
local v = _item_0[_index_0]
table.insert(_moon_0, self:value(v))
table.insert(_accum_0, self:value(v))
end
return _moon_0
end
return _accum_0
end)(), ", ")
return _with_0
end
end,
parens = function(self, node) return self:line("(", self:value(node[2]), ")") end,
parens = function(self, node)
return self:line("(", self:value(node[2]), ")")
end,
string = function(self, node)
local _, delim, inner, delim_end = unpack(node)
return delim .. inner .. (delim_end or delim)
@ -64,11 +68,28 @@ value_compile = {
local exp = node[2]
do
local _with_0 = self:block("(function()", "end)()")
local tmp_name = _with_0:init_free_var("accum", { "table" })
local tmp_name = _with_0:init_free_var("accum", {
"table"
})
local action
action = function(value) return { "chain", "table.insert", { "call", { tmp_name, value } } } end
action = function(value)
return {
"chain",
"table.insert",
{
"call",
{
tmp_name,
value
}
}
}
end
_with_0:stm(node, action)
_with_0:stm({ "return", tmp_name })
_with_0:stm({
"return",
tmp_name
})
return _with_0
end
end,
@ -104,11 +125,13 @@ value_compile = {
local actions
do
local _with_0 = self:line()
do
local _item_0 = node
for _index_0 = 3, #_item_0 do
local action = _item_0[_index_0]
_with_0:append(chain_item(action))
end
end
actions = _with_0
end
if ntype(callee) == "self" and node[3] and ntype(node[3]) == "call" then
@ -127,11 +150,13 @@ value_compile = {
end
do
local _with_0 = self:block("function(" .. concat(args, ", ") .. ")")
do
local _item_0 = args
for _index_0 = 1, #_item_0 do
local name = _item_0[_index_0]
_with_0:put_name(name)
end
end
_with_0:ret_stms(block)
return _with_0
end
@ -146,7 +171,11 @@ value_compile = {
if #tuple == 2 then
local key, value = unpack(tuple)
if type(key) == "string" and data.lua_keywords[key] then
key = { "string", '"', key }
key = {
"string",
'"',
key
}
end
local assign
if type(key) ~= "string" then
@ -163,18 +192,30 @@ value_compile = {
end
end
if items then
do
local _item_0 = items
for _index_0 = 1, #_item_0 do
local line = _item_0[_index_0]
_with_0:add(format_line(line))
end
end
end
return _with_0
end
end,
minus = function(self, node) return self:line("-", self:value(node[2])) end,
length = function(self, node) return self:line("#", self:value(node[2])) end,
["not"] = function(self, node) return self:line("not ", self:value(node[2])) end,
self = function(self, node) return "self." .. self:value(node[2]) end,
self_colon = function(self, node) return "self:" .. self:value(node[2]) end
minus = function(self, node)
return self:line("-", self:value(node[2]))
end,
length = function(self, node)
return self:line("#", self:value(node[2]))
end,
["not"] = function(self, node)
return self:line("not ", self:value(node[2]))
end,
self = function(self, node)
return "self." .. self:value(node[2])
end,
self_colon = function(self, node)
return "self:" .. self:value(node[2])
end
}