sweet-moon 0.0.1 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +7 -0
- data/README.md +156 -13
- data/components/interpreters/50/function.rb +8 -5
- data/components/interpreters/50/interpreter.rb +39 -23
- data/components/interpreters/50/reader.rb +11 -9
- data/components/interpreters/50/table.rb +20 -18
- data/components/interpreters/50/writer.rb +7 -7
- data/components/interpreters/51/function.rb +8 -5
- data/components/interpreters/51/interpreter.rb +30 -20
- data/components/interpreters/51/reader.rb +11 -9
- data/components/interpreters/51/table.rb +12 -11
- data/components/interpreters/51/writer.rb +7 -7
- data/components/interpreters/54/function.rb +8 -5
- data/components/interpreters/54/interpreter.rb +27 -17
- data/components/interpreters/54/reader.rb +11 -9
- data/components/interpreters/54/table.rb +11 -10
- data/components/interpreters/54/writer.rb +7 -7
- data/config/tests.sample.yml +50 -7
- data/controllers/state.rb +34 -9
- data/dsl/concerns/packages.rb +1 -1
- data/dsl/fennel.rb +3 -0
- data/dsl/state.rb +4 -2
- data/logic/interpreters/interpreter_50.rb +1 -0
- data/logic/interpreters/interpreter_54.rb +5 -5
- data/logic/spec.rb +6 -3
- metadata +9 -5
data/controllers/state.rb
CHANGED
@@ -26,23 +26,48 @@ module Controller
|
|
26
26
|
},
|
27
27
|
|
28
28
|
get!: ->(api, interpreter, state, variable, key = nil) {
|
29
|
+
if key.nil?
|
30
|
+
key = variable
|
31
|
+
variable = '_G'
|
32
|
+
end
|
33
|
+
|
34
|
+
State[:_get_key!].(api, interpreter, state, variable, key)
|
35
|
+
},
|
36
|
+
|
37
|
+
_get_key!: ->(api, interpreter, state, variable, key) {
|
29
38
|
result = State[:_check!].(
|
30
39
|
interpreter[:get_variable_and_push!].(api, state, variable, key)
|
31
40
|
)
|
32
41
|
|
33
|
-
result = State[:_check!].(
|
34
|
-
|
35
|
-
|
42
|
+
result = State[:_check!].(
|
43
|
+
interpreter[:read_and_pop!].(
|
44
|
+
api, result[:state], -1, extra_pop: result[:extra_pop]
|
45
|
+
)
|
46
|
+
)
|
36
47
|
|
37
48
|
{ state: result[:state], output: result[:output] }
|
38
49
|
},
|
39
50
|
|
40
|
-
set!: ->(api, interpreter, state, variable, value) {
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
51
|
+
set!: ->(api, interpreter, state, variable, key_or_value, value = nil) {
|
52
|
+
if value.nil?
|
53
|
+
result = State[:_check!].(interpreter[:push_value!].(api, state,
|
54
|
+
key_or_value))
|
55
|
+
|
56
|
+
result = State[:_check!].(
|
57
|
+
interpreter[:pop_and_set_as!].(api, result[:state], variable.to_s)
|
58
|
+
)
|
59
|
+
else
|
60
|
+
result = State[:_check!].(
|
61
|
+
interpreter[:get_variable_and_push!].(api, state, variable)
|
62
|
+
)
|
63
|
+
|
64
|
+
result = State[:_check!].(interpreter[:push_value!].(api, result[:state],
|
65
|
+
key_or_value))
|
66
|
+
result = State[:_check!].(interpreter[:push_value!].(api, result[:state],
|
67
|
+
value))
|
68
|
+
|
69
|
+
result = State[:_check!].(interpreter[:set_table!].(api, result[:state]))
|
70
|
+
end
|
46
71
|
|
47
72
|
{ state: result[:state], output: result[:output] }
|
48
73
|
},
|
data/dsl/concerns/packages.rb
CHANGED
data/dsl/fennel.rb
CHANGED
@@ -11,6 +11,9 @@ module DSL
|
|
11
11
|
'table.insert(package.loaders or package.searchers, fennel.searcher)'
|
12
12
|
)
|
13
13
|
|
14
|
+
# TODO: Makes sense?
|
15
|
+
# debug.traceback = fennel.traceback
|
16
|
+
|
14
17
|
@eval = @state.get(:fennel, :eval)
|
15
18
|
@dofile = @state.get(:fennel, :dofile)
|
16
19
|
@version = @state.get(:fennel, :version)
|
data/dsl/state.rb
CHANGED
@@ -34,8 +34,10 @@ module DSL
|
|
34
34
|
@controller[:get!].(@api, @interpreter, state, variable, key)[:output]
|
35
35
|
end
|
36
36
|
|
37
|
-
def set(variable, value)
|
38
|
-
@controller[:set!].(
|
37
|
+
def set(variable, key_or_value, value = nil)
|
38
|
+
@controller[:set!].(
|
39
|
+
@api, @interpreter, state, variable, key_or_value, value
|
40
|
+
)[:output]
|
39
41
|
end
|
40
42
|
|
41
43
|
def destroy
|
@@ -6,6 +6,7 @@ module Logic
|
|
6
6
|
LUA_REGISTRYINDEX: -10_000,
|
7
7
|
LUA_GLOBALSINDEX: -10_001,
|
8
8
|
|
9
|
+
# lua_isinteger lua_pushinteger lua_tointeger
|
9
10
|
requires: %i[
|
10
11
|
lua_close lua_gettable lua_gettop lua_insert lua_newtable lua_next lua_open
|
11
12
|
lua_pcall lua_pushboolean lua_pushcclosure lua_pushnil lua_pushnumber
|
@@ -12,11 +12,11 @@ module Logic
|
|
12
12
|
|
13
13
|
# lua_isinteger lua_pushinteger lua_tointeger
|
14
14
|
requires: %i[
|
15
|
-
lua_close lua_createtable lua_getfield
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
lua_close lua_createtable lua_getfield lua_gettop lua_next lua_pcall
|
16
|
+
lua_pushboolean lua_pushcclosure lua_pushnil lua_pushnumber lua_pushstring
|
17
|
+
lua_rawgeti lua_settable lua_settop lua_toboolean lua_tonumber lua_topointer
|
18
|
+
lua_tostring lua_type lua_typename luaL_loadfile luaL_loadstring luaL_newstate
|
19
|
+
luaL_openlibs luaL_ref lua_getglobal lua_setglobal
|
20
20
|
],
|
21
21
|
|
22
22
|
status: {
|
data/logic/spec.rb
CHANGED
@@ -2,11 +2,14 @@ module Logic
|
|
2
2
|
Spec = {
|
3
3
|
name: 'sweet-moon',
|
4
4
|
command: 'sweet-moon',
|
5
|
-
version: '0.0.
|
5
|
+
version: '0.0.4',
|
6
6
|
author: 'gbaptista',
|
7
|
-
summary: 'Lua / Fennel from Ruby and vice versa.'
|
7
|
+
summary: 'Lua / Fennel from Ruby and vice versa. Support to LuaJIT, Lua 5.0, ' \
|
8
|
+
'and 5.1. Lua C API for Lua 5, 4, and 3. LuaRocks and fnx integration.',
|
8
9
|
description: 'A resilient solution that makes working with Lua / Fennel from ' \
|
9
|
-
|
10
|
+
"Ruby and vice versa a delightful experience.\n\n" \
|
11
|
+
'Support to LuaJIT, Lua 5.0, and 5.1. Lua C API for Lua 5, 4, ' \
|
12
|
+
'and 3. LuaRocks and fnx integration.',
|
10
13
|
github: 'https://github.com/gbaptista/sweet-moon',
|
11
14
|
license: 'MIT'
|
12
15
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sweet-moon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- gbaptista
|
8
8
|
autorequire:
|
9
9
|
bindir: ports/in/shell
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -30,8 +30,10 @@ dependencies:
|
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 1.15.5
|
33
|
-
description:
|
34
|
-
vice versa a delightful experience.
|
33
|
+
description: |-
|
34
|
+
A resilient solution that makes working with Lua / Fennel from Ruby and vice versa a delightful experience.
|
35
|
+
|
36
|
+
Support to LuaJIT, Lua 5.0, and 5.1. Lua C API for Lua 5, 4, and 3. LuaRocks and fnx integration.
|
35
37
|
email:
|
36
38
|
executables:
|
37
39
|
- sweet-moon
|
@@ -43,6 +45,7 @@ files:
|
|
43
45
|
- ".rubocop.yml"
|
44
46
|
- Gemfile
|
45
47
|
- Gemfile.lock
|
48
|
+
- LICENSE
|
46
49
|
- README.md
|
47
50
|
- components/api.rb
|
48
51
|
- components/injections.rb
|
@@ -133,5 +136,6 @@ requirements: []
|
|
133
136
|
rubygems_version: 3.2.3
|
134
137
|
signing_key:
|
135
138
|
specification_version: 4
|
136
|
-
summary: Lua / Fennel from Ruby and vice versa.
|
139
|
+
summary: Lua / Fennel from Ruby and vice versa. Support to LuaJIT, Lua 5.0, and 5.1.
|
140
|
+
Lua C API for Lua 5, 4, and 3. LuaRocks and fnx integration.
|
137
141
|
test_files: []
|