rufus-lua-moon 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +51 -0
- data/Rakefile +1 -0
- data/lib/rufus/lua/moon/version.rb +12 -0
- data/lib/rufus/lua/moon.rb +18 -0
- data/rufus-lua-moon.gemspec +25 -0
- data/vendor/lua/moon/all.moon +8 -0
- data/vendor/lua/moon/init.moon +136 -0
- data/vendor/lua/moonscript/compile/format.lua +55 -0
- data/vendor/lua/moonscript/compile/statement.lua +217 -0
- data/vendor/lua/moonscript/compile/value.lua +321 -0
- data/vendor/lua/moonscript/compile.lua +549 -0
- data/vendor/lua/moonscript/data.lua +87 -0
- data/vendor/lua/moonscript/dump.lua +42 -0
- data/vendor/lua/moonscript/errors.lua +65 -0
- data/vendor/lua/moonscript/init.lua +90 -0
- data/vendor/lua/moonscript/parse.lua +505 -0
- data/vendor/lua/moonscript/transform.lua +1174 -0
- data/vendor/lua/moonscript/types.lua +237 -0
- data/vendor/lua/moonscript/util.lua +101 -0
- data/vendor/lua/moonscript/version.lua +7 -0
- metadata +109 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 64a42dafd47150d25613181b8f9898f7456e89ce
|
4
|
+
data.tar.gz: 22e9a59e022d27df880130803b6fa7a2aad8be10
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 602ddba5e7e2abfca7c15ec506332e19ab5ddc7f81a3dc454488ced77b97e6559d9d9381cabbac08dde5cf6a86be575e68155ce7b3a7580a7187e714a0b66b32
|
7
|
+
data.tar.gz: ff8982b11792e45e2d21007527d0b0f84a8f1e58fa2e848caf05e9561255450822bc3868de0e36999b8d5e4662dc19b2b24862a0840a88ab35e8ffc86b044c78
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Stas Ukolov
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# Rufus::Lua::Moon
|
2
|
+
|
3
|
+
[](http://badge.fury.io/rb/rufus-lua-moon)
|
4
|
+
|
5
|
+
Provides MoonScript for Rufus::Lua interpreter
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'rufus-lua-moon'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install rufus-lua-moon
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
After creating Rufus::Lua interpreter patch it to support MoonScript:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
s=Rufus::Lua::State.new
|
27
|
+
s.moon!
|
28
|
+
s.eval <<EOL
|
29
|
+
m=require "moonscript.base"
|
30
|
+
x=m.to_lua "->1"
|
31
|
+
print(x)
|
32
|
+
EOL
|
33
|
+
```
|
34
|
+
You can set `package.moonpath` and require file(s) with moonscript code:
|
35
|
+
```ruby
|
36
|
+
s=Rufus::Lua::State.new.moon!
|
37
|
+
s.eval <<EOL
|
38
|
+
package.moonpath='./?.moon'
|
39
|
+
require 'myfile' -- load 'myfile.moon'
|
40
|
+
EOL
|
41
|
+
```
|
42
|
+
|
43
|
+
## Credits
|
44
|
+
|
45
|
+
* [Lua](http://www.lua.org/)
|
46
|
+
* [MoonScript](http://moonscript.org/)
|
47
|
+
* [Rufus::Lua](https://github.com/jmettraux/rufus-lua)
|
48
|
+
|
49
|
+
## See also
|
50
|
+
|
51
|
+
* [Rufus::Lua::Win](https://github.com/ukoloff/rufus-lua-win) if you run Rufus::Lua on Windows
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Rufus
|
2
|
+
module Lua
|
3
|
+
module Moon
|
4
|
+
root=File.expand_path '../../../../..', __FILE__
|
5
|
+
subV=File.read(File.expand_path '.subversion', root).strip rescue ''
|
6
|
+
subV="."+subV.gsub(/\W+/, '.') if subV.length>0
|
7
|
+
Path=File.expand_path 'vendor/lua', root
|
8
|
+
m=/(["'])(\d+(\.\d+){1,3}(-(?!0)[\da-z])*)\1/i.match File.read File.expand_path 'moonscript/version.lua', Path
|
9
|
+
VERSION = m ? m[2].gsub('-', '.')+subV : '0.0.?'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "rufus/lua/moon/version"
|
2
|
+
|
3
|
+
module Rufus
|
4
|
+
module Lua
|
5
|
+
module Moon
|
6
|
+
|
7
|
+
end
|
8
|
+
class State
|
9
|
+
def moon!
|
10
|
+
self['package']['path']=
|
11
|
+
(['', '/init'].map{|x|File.expand_path "?#{x}.lua", Moon::Path}<<
|
12
|
+
self['package']['path'])*';'
|
13
|
+
eval 'require "moonscript"'
|
14
|
+
self
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rufus/lua/moon/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rufus-lua-moon"
|
8
|
+
spec.version = Rufus::Lua::Moon::VERSION
|
9
|
+
spec.authors = ["Stas Ukolov"]
|
10
|
+
spec.email = ["ukoloff@gmail.com"]
|
11
|
+
spec.description = 'Provides MoonScript for Rufus::Lua interpreter'
|
12
|
+
spec.summary = ''
|
13
|
+
spec.homepage = "https://github.com/ukoloff/rufus-lua-moon"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
|
24
|
+
spec.add_dependency "rufus-lua"
|
25
|
+
end
|
@@ -0,0 +1,136 @@
|
|
1
|
+
|
2
|
+
if not moon or not moon.inject
|
3
|
+
module "moon", package.seeall
|
4
|
+
|
5
|
+
util = require "moonscript.util"
|
6
|
+
|
7
|
+
lua = { :debug, :type }
|
8
|
+
|
9
|
+
export *
|
10
|
+
|
11
|
+
dump = util.dump
|
12
|
+
|
13
|
+
p = (...) ->
|
14
|
+
print dump ...
|
15
|
+
|
16
|
+
is_object = (value) -> -- is a moonscript object
|
17
|
+
lua.type(value) == "table" and value.__class
|
18
|
+
|
19
|
+
type = (value) -> -- class aware type
|
20
|
+
base_type = lua.type value
|
21
|
+
if base_type == "table"
|
22
|
+
cls = value.__class
|
23
|
+
return cls if cls
|
24
|
+
base_type
|
25
|
+
|
26
|
+
debug = setmetatable {
|
27
|
+
upvalue: (fn, k, v) ->
|
28
|
+
upvalues = {}
|
29
|
+
i = 1
|
30
|
+
while true
|
31
|
+
name = lua.debug.getupvalue(fn, i)
|
32
|
+
break if name == nil
|
33
|
+
upvalues[name] = i
|
34
|
+
i += 1
|
35
|
+
|
36
|
+
if not upvalues[k]
|
37
|
+
error "Failed to find upvalue: " .. tostring k
|
38
|
+
|
39
|
+
if not v
|
40
|
+
_, value = lua.debug.getupvalue fn, upvalues[k]
|
41
|
+
value
|
42
|
+
else
|
43
|
+
lua.debug.setupvalue fn, upvalues[k], v
|
44
|
+
}, __index: lua.debug
|
45
|
+
|
46
|
+
-- run a function with scope injected before its function environment
|
47
|
+
run_with_scope = (fn, scope, ...) ->
|
48
|
+
old_env = getfenv fn
|
49
|
+
env = setmetatable {}, {
|
50
|
+
__index: (name) =>
|
51
|
+
val = scope[name]
|
52
|
+
if val != nil
|
53
|
+
val
|
54
|
+
else
|
55
|
+
old_env[name]
|
56
|
+
}
|
57
|
+
setfenv fn, env
|
58
|
+
fn ...
|
59
|
+
|
60
|
+
-- wrap obj such that calls to methods do not need a reference to self
|
61
|
+
bind_methods = (obj) ->
|
62
|
+
setmetatable {}, {
|
63
|
+
__index: (name) =>
|
64
|
+
val = obj[name]
|
65
|
+
if val and lua.type(val) == "function"
|
66
|
+
bound = (...) -> val obj, ...
|
67
|
+
self[name] = bound
|
68
|
+
bound
|
69
|
+
else
|
70
|
+
val
|
71
|
+
}
|
72
|
+
|
73
|
+
-- use a function to provide default values to table
|
74
|
+
-- optionally specify a starting table
|
75
|
+
-- fibanocci table:
|
76
|
+
-- t = defaultbl {[0]: 0, [1]: 1}, (i) -> self[i - 1] + self[i - 2]
|
77
|
+
defaultbl = (t, fn) ->
|
78
|
+
if not fn
|
79
|
+
fn = t
|
80
|
+
t = {}
|
81
|
+
setmetatable t, {
|
82
|
+
__index: (name) =>
|
83
|
+
val = fn self, name
|
84
|
+
rawset self, name, val
|
85
|
+
val
|
86
|
+
}
|
87
|
+
|
88
|
+
-- chain together tables by __index metatables
|
89
|
+
extend = (...) ->
|
90
|
+
tbls = {...}
|
91
|
+
return if #tbls < 2
|
92
|
+
|
93
|
+
for i = 1, #tbls - 1
|
94
|
+
a = tbls[i]
|
95
|
+
b = tbls[i + 1]
|
96
|
+
|
97
|
+
setmetatable a, __index: b
|
98
|
+
|
99
|
+
tbls[1]
|
100
|
+
|
101
|
+
-- shallow copy
|
102
|
+
copy = =>
|
103
|
+
{key,val for key,val in pairs self}
|
104
|
+
|
105
|
+
-- mixin class properties into self, call new
|
106
|
+
mixin = (cls, ...) =>
|
107
|
+
meta = getmetatable cls
|
108
|
+
for key, val in pairs meta.__index
|
109
|
+
self[key] = val if not key\match"^__"
|
110
|
+
cls.__init self, ...
|
111
|
+
|
112
|
+
-- mixin methods from an object into self
|
113
|
+
mixin_object = (object, methods) =>
|
114
|
+
for name in *methods
|
115
|
+
self[name] = (parent, ...) ->
|
116
|
+
object[name](object, ...)
|
117
|
+
|
118
|
+
-- mixin table values into self
|
119
|
+
mixin_table = (tbl, keys) =>
|
120
|
+
if keys
|
121
|
+
for key in *keys
|
122
|
+
self[key] = tbl[key]
|
123
|
+
else
|
124
|
+
for key, val in pairs tbl
|
125
|
+
self[key] = val
|
126
|
+
|
127
|
+
fold = (items, fn)->
|
128
|
+
len = #items
|
129
|
+
if len > 1
|
130
|
+
accum = fn items[1], items[2]
|
131
|
+
for i=3,len
|
132
|
+
accum = fn acum, items[i]
|
133
|
+
accum
|
134
|
+
else
|
135
|
+
items[1]
|
136
|
+
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module("moonscript.compile", package.seeall)
|
2
|
+
local util = require("moonscript.util")
|
3
|
+
local data = require("moonscript.data")
|
4
|
+
local Set
|
5
|
+
do
|
6
|
+
local _table_0 = require("moonscript.data")
|
7
|
+
Set = _table_0.Set
|
8
|
+
end
|
9
|
+
local ntype
|
10
|
+
do
|
11
|
+
local _table_0 = require("moonscript.types")
|
12
|
+
ntype = _table_0.ntype
|
13
|
+
end
|
14
|
+
local concat, insert = table.concat, table.insert
|
15
|
+
indent_char = " "
|
16
|
+
user_error = function(...)
|
17
|
+
return error({
|
18
|
+
"user-error",
|
19
|
+
...
|
20
|
+
})
|
21
|
+
end
|
22
|
+
moonlib = {
|
23
|
+
bind = function(tbl, name)
|
24
|
+
return concat({
|
25
|
+
"moon.bind(",
|
26
|
+
tbl,
|
27
|
+
".",
|
28
|
+
name,
|
29
|
+
", ",
|
30
|
+
tbl,
|
31
|
+
")"
|
32
|
+
})
|
33
|
+
end
|
34
|
+
}
|
35
|
+
non_atomic = Set({
|
36
|
+
"update"
|
37
|
+
})
|
38
|
+
has_value = function(node)
|
39
|
+
if ntype(node) == "chain" then
|
40
|
+
local ctype = ntype(node[#node])
|
41
|
+
return ctype ~= "call" and ctype ~= "colon"
|
42
|
+
else
|
43
|
+
return true
|
44
|
+
end
|
45
|
+
end
|
46
|
+
is_non_atomic = function(node)
|
47
|
+
return non_atomic[ntype(node)]
|
48
|
+
end
|
49
|
+
count_lines = function(str)
|
50
|
+
local count = 1
|
51
|
+
for _ in str:gmatch("\n") do
|
52
|
+
count = count + 1
|
53
|
+
end
|
54
|
+
return count
|
55
|
+
end
|
@@ -0,0 +1,217 @@
|
|
1
|
+
module("moonscript.compile", package.seeall)
|
2
|
+
local util = require("moonscript.util")
|
3
|
+
require("moonscript.compile.format")
|
4
|
+
local dump = require("moonscript.dump")
|
5
|
+
local reversed = util.reversed
|
6
|
+
local ntype
|
7
|
+
do
|
8
|
+
local _table_0 = require("moonscript.types")
|
9
|
+
ntype = _table_0.ntype
|
10
|
+
end
|
11
|
+
local concat, insert = table.concat, table.insert
|
12
|
+
line_compile = {
|
13
|
+
raw = function(self, node)
|
14
|
+
local _, text = unpack(node)
|
15
|
+
return self:add(text)
|
16
|
+
end,
|
17
|
+
declare = function(self, node)
|
18
|
+
local _, names = unpack(node)
|
19
|
+
local undeclared = self:declare(names)
|
20
|
+
if #undeclared > 0 then
|
21
|
+
do
|
22
|
+
local _with_0 = self:line("local ")
|
23
|
+
_with_0:append_list((function()
|
24
|
+
local _accum_0 = { }
|
25
|
+
local _len_0 = 0
|
26
|
+
local _list_0 = names
|
27
|
+
for _index_0 = 1, #_list_0 do
|
28
|
+
local name = _list_0[_index_0]
|
29
|
+
_len_0 = _len_0 + 1
|
30
|
+
_accum_0[_len_0] = self:name(name)
|
31
|
+
end
|
32
|
+
return _accum_0
|
33
|
+
end)(), ", ")
|
34
|
+
return _with_0
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end,
|
38
|
+
assign = function(self, node)
|
39
|
+
local _, names, values = unpack(node)
|
40
|
+
local undeclared = self:declare(names)
|
41
|
+
local declare = "local " .. concat(undeclared, ", ")
|
42
|
+
local has_fndef = false
|
43
|
+
local i = 1
|
44
|
+
while i <= #values do
|
45
|
+
if ntype(values[i]) == "fndef" then
|
46
|
+
has_fndef = true
|
47
|
+
end
|
48
|
+
i = i + 1
|
49
|
+
end
|
50
|
+
do
|
51
|
+
local _with_0 = self:line()
|
52
|
+
if #undeclared == #names and not has_fndef then
|
53
|
+
_with_0:append(declare)
|
54
|
+
else
|
55
|
+
if #undeclared > 0 then
|
56
|
+
self:add(declare)
|
57
|
+
end
|
58
|
+
_with_0:append_list((function()
|
59
|
+
local _accum_0 = { }
|
60
|
+
local _len_0 = 0
|
61
|
+
local _list_0 = names
|
62
|
+
for _index_0 = 1, #_list_0 do
|
63
|
+
local name = _list_0[_index_0]
|
64
|
+
_len_0 = _len_0 + 1
|
65
|
+
_accum_0[_len_0] = self:value(name)
|
66
|
+
end
|
67
|
+
return _accum_0
|
68
|
+
end)(), ", ")
|
69
|
+
end
|
70
|
+
_with_0:append(" = ")
|
71
|
+
_with_0:append_list((function()
|
72
|
+
local _accum_0 = { }
|
73
|
+
local _len_0 = 0
|
74
|
+
local _list_0 = values
|
75
|
+
for _index_0 = 1, #_list_0 do
|
76
|
+
local v = _list_0[_index_0]
|
77
|
+
_len_0 = _len_0 + 1
|
78
|
+
_accum_0[_len_0] = self:value(v)
|
79
|
+
end
|
80
|
+
return _accum_0
|
81
|
+
end)(), ", ")
|
82
|
+
return _with_0
|
83
|
+
end
|
84
|
+
end,
|
85
|
+
["return"] = function(self, node)
|
86
|
+
return self:line("return ", (function()
|
87
|
+
if node[2] ~= "" then
|
88
|
+
return self:value(node[2])
|
89
|
+
end
|
90
|
+
end)())
|
91
|
+
end,
|
92
|
+
["break"] = function(self, node)
|
93
|
+
return "break"
|
94
|
+
end,
|
95
|
+
["if"] = function(self, node)
|
96
|
+
local cond, block = node[2], node[3]
|
97
|
+
local root
|
98
|
+
do
|
99
|
+
local _with_0 = self:block(self:line("if ", self:value(cond), " then"))
|
100
|
+
_with_0:stms(block)
|
101
|
+
root = _with_0
|
102
|
+
end
|
103
|
+
local current = root
|
104
|
+
local add_clause
|
105
|
+
add_clause = function(clause)
|
106
|
+
local type = clause[1]
|
107
|
+
local i = 2
|
108
|
+
local next
|
109
|
+
if type == "else" then
|
110
|
+
next = self:block("else")
|
111
|
+
else
|
112
|
+
i = i + 1
|
113
|
+
next = self:block(self:line("elseif ", self:value(clause[2]), " then"))
|
114
|
+
end
|
115
|
+
next:stms(clause[i])
|
116
|
+
current.next = next
|
117
|
+
current = next
|
118
|
+
end
|
119
|
+
local _list_0 = node
|
120
|
+
for _index_0 = 4, #_list_0 do
|
121
|
+
cond = _list_0[_index_0]
|
122
|
+
add_clause(cond)
|
123
|
+
end
|
124
|
+
return root
|
125
|
+
end,
|
126
|
+
["while"] = function(self, node)
|
127
|
+
local _, cond, block = unpack(node)
|
128
|
+
local out
|
129
|
+
if is_non_atomic(cond) then
|
130
|
+
do
|
131
|
+
local _with_0 = self:block("while true do")
|
132
|
+
_with_0:stm({
|
133
|
+
"if",
|
134
|
+
{
|
135
|
+
"not",
|
136
|
+
cond
|
137
|
+
},
|
138
|
+
{
|
139
|
+
{
|
140
|
+
"break"
|
141
|
+
}
|
142
|
+
}
|
143
|
+
})
|
144
|
+
out = _with_0
|
145
|
+
end
|
146
|
+
else
|
147
|
+
out = self:block(self:line("while ", self:value(cond), " do"))
|
148
|
+
end
|
149
|
+
out:stms(block)
|
150
|
+
return out
|
151
|
+
end,
|
152
|
+
["for"] = function(self, node)
|
153
|
+
local _, name, bounds, block = unpack(node)
|
154
|
+
local loop = self:line("for ", self:name(name), " = ", self:value({
|
155
|
+
"explist",
|
156
|
+
unpack(bounds)
|
157
|
+
}), " do")
|
158
|
+
do
|
159
|
+
local _with_0 = self:block(loop)
|
160
|
+
_with_0:stms(block)
|
161
|
+
return _with_0
|
162
|
+
end
|
163
|
+
end,
|
164
|
+
foreach = function(self, node)
|
165
|
+
local _, names, exp, block = unpack(node)
|
166
|
+
local loop
|
167
|
+
do
|
168
|
+
local _with_0 = self:line()
|
169
|
+
_with_0:append("for ")
|
170
|
+
_with_0:append_list((function()
|
171
|
+
local _accum_0 = { }
|
172
|
+
local _len_0 = 0
|
173
|
+
local _list_0 = names
|
174
|
+
for _index_0 = 1, #_list_0 do
|
175
|
+
local name = _list_0[_index_0]
|
176
|
+
_len_0 = _len_0 + 1
|
177
|
+
_accum_0[_len_0] = self:name(name)
|
178
|
+
end
|
179
|
+
return _accum_0
|
180
|
+
end)(), ", ")
|
181
|
+
_with_0:append(" in ", self:value(exp), " do")
|
182
|
+
loop = _with_0
|
183
|
+
end
|
184
|
+
do
|
185
|
+
local _with_0 = self:block(loop)
|
186
|
+
_with_0:stms(block)
|
187
|
+
return _with_0
|
188
|
+
end
|
189
|
+
end,
|
190
|
+
export = function(self, node)
|
191
|
+
local _, names = unpack(node)
|
192
|
+
if type(names) == "string" then
|
193
|
+
if names == "*" then
|
194
|
+
self.export_all = true
|
195
|
+
elseif names == "^" then
|
196
|
+
self.export_proper = true
|
197
|
+
end
|
198
|
+
else
|
199
|
+
self:declare(names)
|
200
|
+
end
|
201
|
+
return nil
|
202
|
+
end,
|
203
|
+
run = function(self, code)
|
204
|
+
code:call(self)
|
205
|
+
return nil
|
206
|
+
end,
|
207
|
+
group = function(self, node)
|
208
|
+
return self:stms(node[2])
|
209
|
+
end,
|
210
|
+
["do"] = function(self, node)
|
211
|
+
do
|
212
|
+
local _with_0 = self:block()
|
213
|
+
_with_0:stms(node[2])
|
214
|
+
return _with_0
|
215
|
+
end
|
216
|
+
end
|
217
|
+
}
|