rufus-lua-moon 0.2.3.2 → 0.2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rufus/lua/moon/version.rb +1 -1
- data/vendor/lua/moon/all.moon +5 -7
- data/vendor/lua/moon/init.moon +6 -8
- data/vendor/lua/moonscript/base.lua +2 -0
- data/vendor/lua/moonscript/compile/statement.lua +25 -26
- data/vendor/lua/moonscript/compile/value.lua +43 -36
- data/vendor/lua/moonscript/compile.lua +69 -128
- data/vendor/lua/moonscript/data.lua +9 -21
- data/vendor/lua/moonscript/dump.lua +6 -6
- data/vendor/lua/moonscript/errors.lua +18 -12
- data/vendor/lua/moonscript/init.lua +15 -13
- data/vendor/lua/moonscript/parse.lua +5 -5
- data/vendor/lua/moonscript/transform/destructure.lua +44 -39
- data/vendor/lua/moonscript/transform/names.lua +12 -41
- data/vendor/lua/moonscript/transform.lua +298 -322
- data/vendor/lua/moonscript/types.lua +18 -11
- data/vendor/lua/moonscript/util.lua +26 -22
- data/vendor/lua/moonscript/version.lua +1 -1
- metadata +2 -1
@@ -1,14 +1,23 @@
|
|
1
1
|
local util = require("moonscript.util")
|
2
|
-
local
|
3
|
-
|
4
|
-
local
|
5
|
-
|
2
|
+
local Set
|
3
|
+
do
|
4
|
+
local _obj_0 = require("moonscript.data")
|
5
|
+
Set = _obj_0.Set
|
6
|
+
end
|
7
|
+
local insert
|
8
|
+
do
|
9
|
+
local _obj_0 = table
|
10
|
+
insert = _obj_0.insert
|
11
|
+
end
|
12
|
+
local unpack
|
13
|
+
unpack = util.unpack
|
14
|
+
local manual_return = Set({
|
6
15
|
"foreach",
|
7
16
|
"for",
|
8
17
|
"while",
|
9
18
|
"return"
|
10
19
|
})
|
11
|
-
local cascading =
|
20
|
+
local cascading = Set({
|
12
21
|
"if",
|
13
22
|
"unless",
|
14
23
|
"with",
|
@@ -232,9 +241,8 @@ build = setmetatable({
|
|
232
241
|
if tbl == nil then
|
233
242
|
tbl = { }
|
234
243
|
end
|
235
|
-
|
236
|
-
|
237
|
-
local tuple = _list_0[_index_0]
|
244
|
+
for _index_0 = 1, #tbl do
|
245
|
+
local tuple = tbl[_index_0]
|
238
246
|
if type(tuple[1]) == "string" then
|
239
247
|
tuple[1] = {
|
240
248
|
"key_literal",
|
@@ -259,9 +267,8 @@ build = setmetatable({
|
|
259
267
|
"chain",
|
260
268
|
base
|
261
269
|
}
|
262
|
-
|
263
|
-
|
264
|
-
local part = _list_0[_index_0]
|
270
|
+
for _index_0 = 1, #parts do
|
271
|
+
local part = parts[_index_0]
|
265
272
|
insert(node, part)
|
266
273
|
end
|
267
274
|
return node
|
@@ -1,4 +1,8 @@
|
|
1
|
-
local concat
|
1
|
+
local concat
|
2
|
+
do
|
3
|
+
local _obj_0 = table
|
4
|
+
concat = _obj_0.concat
|
5
|
+
end
|
2
6
|
local unpack = unpack or table.unpack
|
3
7
|
local type = type
|
4
8
|
local moon = {
|
@@ -73,15 +77,13 @@ split = function(str, delim)
|
|
73
77
|
return { }
|
74
78
|
end
|
75
79
|
str = str .. delim
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
return _accum_0
|
84
|
-
end)()
|
80
|
+
local _accum_0 = { }
|
81
|
+
local _len_0 = 1
|
82
|
+
for m in str:gmatch("(.-)" .. delim) do
|
83
|
+
_accum_0[_len_0] = m
|
84
|
+
_len_0 = _len_0 + 1
|
85
|
+
end
|
86
|
+
return _accum_0
|
85
87
|
end
|
86
88
|
local dump
|
87
89
|
dump = function(what)
|
@@ -100,15 +102,16 @@ dump = function(what)
|
|
100
102
|
end
|
101
103
|
seen[what] = true
|
102
104
|
depth = depth + 1
|
103
|
-
local lines
|
105
|
+
local lines
|
106
|
+
do
|
104
107
|
local _accum_0 = { }
|
105
108
|
local _len_0 = 1
|
106
109
|
for k, v in pairs(what) do
|
107
110
|
_accum_0[_len_0] = (" "):rep(depth * 4) .. "[" .. tostring(k) .. "] = " .. _dump(v, depth)
|
108
111
|
_len_0 = _len_0 + 1
|
109
112
|
end
|
110
|
-
|
111
|
-
end
|
113
|
+
lines = _accum_0
|
114
|
+
end
|
112
115
|
seen[what] = false
|
113
116
|
return "{\n" .. concat(lines) .. (" "):rep((depth - 1) * 4) .. "}\n"
|
114
117
|
else
|
@@ -119,7 +122,8 @@ dump = function(what)
|
|
119
122
|
end
|
120
123
|
local debug_posmap
|
121
124
|
debug_posmap = function(posmap, moon_code, lua_code)
|
122
|
-
local tuples
|
125
|
+
local tuples
|
126
|
+
do
|
123
127
|
local _accum_0 = { }
|
124
128
|
local _len_0 = 1
|
125
129
|
for k, v in pairs(posmap) do
|
@@ -129,17 +133,17 @@ debug_posmap = function(posmap, moon_code, lua_code)
|
|
129
133
|
}
|
130
134
|
_len_0 = _len_0 + 1
|
131
135
|
end
|
132
|
-
|
133
|
-
end
|
136
|
+
tuples = _accum_0
|
137
|
+
end
|
134
138
|
table.sort(tuples, function(a, b)
|
135
139
|
return a[1] < b[1]
|
136
140
|
end)
|
137
|
-
local lines
|
141
|
+
local lines
|
142
|
+
do
|
138
143
|
local _accum_0 = { }
|
139
144
|
local _len_0 = 1
|
140
|
-
|
141
|
-
|
142
|
-
local pair = _list_0[_index_0]
|
145
|
+
for _index_0 = 1, #tuples do
|
146
|
+
local pair = tuples[_index_0]
|
143
147
|
local lua_line, pos = unpack(pair)
|
144
148
|
local moon_line = pos_to_line(moon_code, pos)
|
145
149
|
local lua_text = get_line(lua_code, lua_line)
|
@@ -148,8 +152,8 @@ debug_posmap = function(posmap, moon_code, lua_code)
|
|
148
152
|
_accum_0[_len_0] = _value_0
|
149
153
|
_len_0 = _len_0 + 1
|
150
154
|
end
|
151
|
-
|
152
|
-
end
|
155
|
+
lines = _accum_0
|
156
|
+
end
|
153
157
|
return concat(lines, "\n")
|
154
158
|
end
|
155
159
|
local setfenv = setfenv or function(fn, env)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rufus-lua-moon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stas Ukolov
|
@@ -69,6 +69,7 @@ files:
|
|
69
69
|
- rufus-lua-moon.gemspec
|
70
70
|
- vendor/lua/moon/all.moon
|
71
71
|
- vendor/lua/moon/init.moon
|
72
|
+
- vendor/lua/moonscript/base.lua
|
72
73
|
- vendor/lua/moonscript/compile.lua
|
73
74
|
- vendor/lua/moonscript/compile/statement.lua
|
74
75
|
- vendor/lua/moonscript/compile/value.lua
|