mirror of
https://github.com/leafo/moonscript.git
synced 2024-11-22 02:44:23 +00:00
updated syntax
This commit is contained in:
parent
361feef825
commit
f0b3690362
@ -170,10 +170,10 @@ line_compile = {
|
|||||||
local b = self:block()
|
local b = self:block()
|
||||||
b:stms(block, ret)
|
b:stms(block, ret)
|
||||||
self:add_line(b:render())
|
self:add_line(b:render())
|
||||||
for i, cond in ipairs(node) do
|
local _item_0 = node
|
||||||
if i > 3 then
|
for _index_0=4,#_item_0 do
|
||||||
add_clause(cond)
|
local cond = _item_0[_index_0]
|
||||||
end
|
add_clause(cond)
|
||||||
end
|
end
|
||||||
return self:add_line("end")
|
return self:add_line("end")
|
||||||
end,
|
end,
|
||||||
@ -234,10 +234,10 @@ line_compile = {
|
|||||||
local calling_name = block:get("current_block")
|
local calling_name = block:get("current_block")
|
||||||
local slice = (function()
|
local slice = (function()
|
||||||
local _moon_0 = {}
|
local _moon_0 = {}
|
||||||
for i, item in ipairs(chain) do
|
local _item_0 = chain
|
||||||
if i > 2 then
|
for _index_0=3,#_item_0 do
|
||||||
table.insert(_moon_0, item)
|
local item = _item_0[_index_0]
|
||||||
end
|
table.insert(_moon_0, item)
|
||||||
end
|
end
|
||||||
return _moon_0
|
return _moon_0
|
||||||
end)()
|
end)()
|
||||||
|
@ -130,7 +130,7 @@ line_compile =
|
|||||||
b\stms block, ret
|
b\stms block, ret
|
||||||
@add_line b\render!
|
@add_line b\render!
|
||||||
|
|
||||||
add_clause cond for i, cond in ipairs node when i > 3
|
add_clause cond for cond in *node[4:]
|
||||||
|
|
||||||
@add_line "end"
|
@add_line "end"
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ line_compile =
|
|||||||
|
|
||||||
def_scope\set "super" (block, chain) ->
|
def_scope\set "super" (block, chain) ->
|
||||||
calling_name = block\get"current_block"
|
calling_name = block\get"current_block"
|
||||||
slice = [item for i, item in ipairs chain when i > 2]
|
slice = [item for item in *chain[3:]]
|
||||||
-- inject self
|
-- inject self
|
||||||
slice[1] = {"call", {"self", unpack slice[1][2]}}
|
slice[1] = {"call", {"self", unpack slice[1][2]}}
|
||||||
|
|
||||||
|
@ -33,10 +33,10 @@ local value_compile = {
|
|||||||
end,
|
end,
|
||||||
explist = function(self, node) return concat((function()
|
explist = function(self, node) return concat((function()
|
||||||
local _moon_0 = {}
|
local _moon_0 = {}
|
||||||
for i, v in ipairs(node) do
|
local _item_0 = node
|
||||||
if i > 1 then
|
for _index_0=2,#_item_0 do
|
||||||
table.insert(_moon_0, self:value(v))
|
local v = _item_0[_index_0]
|
||||||
end
|
table.insert(_moon_0, self:value(v))
|
||||||
end
|
end
|
||||||
return _moon_0
|
return _moon_0
|
||||||
end)(), ", ") end,
|
end)(), ", ") end,
|
||||||
@ -90,10 +90,10 @@ local value_compile = {
|
|||||||
end
|
end
|
||||||
local actions = (function()
|
local actions = (function()
|
||||||
local _moon_0 = {}
|
local _moon_0 = {}
|
||||||
for i, act in ipairs(node) do
|
local _item_0 = node
|
||||||
if i > 2 then
|
for _index_0=3,#_item_0 do
|
||||||
table.insert(_moon_0, chain_item(act))
|
local act = _item_0[_index_0]
|
||||||
end
|
table.insert(_moon_0, chain_item(act))
|
||||||
end
|
end
|
||||||
return _moon_0
|
return _moon_0
|
||||||
end)()
|
end)()
|
||||||
|
@ -29,7 +29,7 @@ value_compile =
|
|||||||
@name name
|
@name name
|
||||||
|
|
||||||
explist: (node) =>
|
explist: (node) =>
|
||||||
concat [@value v for i,v in ipairs node when i > 1], ", "
|
concat [@value v for v in *node[2:]], ", "
|
||||||
|
|
||||||
parens: (node) =>
|
parens: (node) =>
|
||||||
"("..(@value node[2])..")"
|
"("..(@value node[2])..")"
|
||||||
@ -82,7 +82,7 @@ value_compile =
|
|||||||
else
|
else
|
||||||
error "Unknown chain action: "..t
|
error "Unknown chain action: "..t
|
||||||
|
|
||||||
actions = [chain_item act for i, act in ipairs node when i > 2]
|
actions = [chain_item act for act in *node[3:]]
|
||||||
|
|
||||||
if ntype(callee) == "self" and node[3] and ntype(node[3]) == "call"
|
if ntype(callee) == "self" and node[3] and ntype(node[3]) == "call"
|
||||||
callee[1] = "self_colon"
|
callee[1] = "self_colon"
|
||||||
|
Loading…
Reference in New Issue
Block a user