moonscript/tests/outputs/syntax.lua

187 lines
3.0 KiB
Lua
Raw Normal View History

local x
2011-07-14 07:02:07 +00:00
x = function()
return print(what)
end
2011-06-13 05:38:42 +00:00
local _
_ = function() end
2011-07-14 07:02:07 +00:00
_ = function()
return function()
return function() end
end
end
2011-05-21 22:26:46 +00:00
go(to(the(barn)))
2011-07-14 07:02:07 +00:00
open(function()
return the(function()
return door
end)
end)
2011-05-21 22:26:46 +00:00
open(function()
the(door)
local hello
2011-07-14 07:02:07 +00:00
hello = function()
return my(func)
end
2011-05-21 22:26:46 +00:00
end)
local h
2011-07-14 07:02:07 +00:00
h = function()
return hi
end
2011-05-21 22:26:46 +00:00
eat(function() end, world)
local a = 1 + 2 * 3 / 6
2011-05-29 23:25:52 +00:00
local bunch, go, here
a, bunch, go, here = another, world
2011-05-22 07:58:17 +00:00
func(arg1, arg2, another, arg3)
2011-05-29 23:25:52 +00:00
local we
here, we = function() end, yeah
local the, different
2011-07-14 07:02:07 +00:00
the, different = function()
return approach
end, yeah
2011-05-21 22:26:46 +00:00
dad()
dad(lord)
hello(one, two)();
2011-05-21 22:26:46 +00:00
(5 + 5)(world)
fun(a)(b)
fun(a)(b)
fun(a)(b, bad(hello))
hello(world(what(are(you(doing(here))))))
what(the)[3243](world, yeck(heck))
2011-06-13 05:38:42 +00:00
hairy[hands][are](gross)(okay(okay[world]))
_ = (get[something] + 5)[years]
2011-05-29 23:25:52 +00:00
local i
i, x = 200, 300
local yeah = (1 + 5) * 3
yeah = ((1 + 5) * 3) / 2
yeah = ((1 + 5) * 3) / 2 + i % 100
local whoa = (1 + 2) * (3 + 4) * (4 + 5);
(function() end)()
2011-07-14 07:02:07 +00:00
return(5 + function()
return 4 + 2
end)
return(5 + (function()
return 4
end) + 2)
print(5 + function()
_ = 34
2011-06-02 04:11:03 +00:00
return good(nads)
2011-05-23 02:28:25 +00:00
end)
something('else', "ya")
something('else')
something("else")
2011-06-13 05:38:42 +00:00
_ = here(we)("go")[12123]
2011-07-14 07:02:07 +00:00
local something = {
test = 12323,
what = function()
return print("hello world")
end
}
2011-05-24 06:58:10 +00:00
print(something.test)
2011-07-14 07:02:07 +00:00
local frick = {
hello = "world"
}
local argon = {
num = 100,
world = function(self)
2011-05-24 06:58:10 +00:00
print(self.num)
2011-07-14 07:02:07 +00:00
return {
something = function()
return print("hi from something")
end
}
end,
somethin = function(self, str)
2011-05-24 06:58:10 +00:00
print("string is", str)
2011-07-14 07:02:07 +00:00
return {
world = function(a, b)
return print("sum", a + b)
end
}
end
}
2011-05-24 06:58:10 +00:00
something.what()
argon:world().something()
argon:somethin("200").world(1, 2)
x = -434
x = -hello(world(one(two)))
local hi = -"herfef"
x = -(function()
2011-07-14 07:02:07 +00:00
local _accum_0 = { }
for x in x do
2011-07-14 07:02:07 +00:00
table.insert(_accum_0, x)
end
2011-07-14 07:02:07 +00:00
return _accum_0
end)()
if cool then
print("hello")
end
print("nutjob")
if hello then
_ = 343
end
if cool then
print("what")
else
_ = whack
end
2011-07-14 07:02:07 +00:00
local arg = {
...
}
x = function(...)
return dump({
...
})
end
x = not true
local y = not (5 + 5)
y = #"hello"
2011-07-14 07:02:07 +00:00
x = #{
#{ },
#{
1
},
#{
1,
2
}
}
_ = hello, world
something:hello(what)(a, b)
something:hello(what)
something.hello:world(a, b)
something.hello:world(1, 2, 3)(a, b)
x = 1232
x = x + 10 + 3
local j = j - "hello"
y = y * 2
y = y / 100
2011-06-13 15:44:17 +00:00
local m = m % 2
x = 0
2011-07-14 07:02:07 +00:00
do
local _item_0 = values
for _index_0 = 1, #_item_0 do
local v = _item_0[_index_0]
_ = ((function()
if ntype(v) == "fndef" then
x = x + 1
return x
end
end)())
end
2011-06-19 20:00:27 +00:00
end
local hello = {
something = world,
["if"] = "hello",
["else"] = 3434,
["function"] = "okay",
good = 230203
}
_ = 5 + what(wack)
what(whack + 5)
_ = 5 - what(wack)
what(whack - 5)
2011-06-21 03:35:05 +00:00
x = hello - world - something
hello()
hello.world()
_ = hello().something
_ = what()["ofefe"]
what()(the()(heck()))