rubyscript 0.0.5 → 0.0.6
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.
- data/lib/rubyscript/convert.rb +25 -17
- data/lib/rubyscript/version.rb +1 -1
- metadata +1 -1
data/lib/rubyscript/convert.rb
CHANGED
@@ -19,6 +19,21 @@ module RubyScript
|
|
19
19
|
convert_anon(parsed)
|
20
20
|
end
|
21
21
|
|
22
|
+
###
|
23
|
+
## Scopes and Blocks
|
24
|
+
###
|
25
|
+
def convert_scope scope
|
26
|
+
convert_anon(scope[1])
|
27
|
+
end
|
28
|
+
|
29
|
+
def convert_block block
|
30
|
+
body = convert_anon(block[1])
|
31
|
+
"#{body};\n"
|
32
|
+
end
|
33
|
+
|
34
|
+
###
|
35
|
+
## Functions
|
36
|
+
###
|
22
37
|
def convert_defn defn
|
23
38
|
func_name = defn[1]
|
24
39
|
func_args = convert_args(defn[2])
|
@@ -34,15 +49,6 @@ module RubyScript
|
|
34
49
|
args.join(", ")
|
35
50
|
end
|
36
51
|
|
37
|
-
def convert_scope scope
|
38
|
-
convert_anon(scope[1])
|
39
|
-
end
|
40
|
-
|
41
|
-
def convert_block block
|
42
|
-
body = convert_anon(block[1])
|
43
|
-
"#{body};\n"
|
44
|
-
end
|
45
|
-
|
46
52
|
def convert_call call
|
47
53
|
call_name = call[2]
|
48
54
|
call_args = convert_arglist(call[3])
|
@@ -62,7 +68,9 @@ module RubyScript
|
|
62
68
|
args
|
63
69
|
end
|
64
70
|
|
65
|
-
|
71
|
+
###
|
72
|
+
## Data types
|
73
|
+
###
|
66
74
|
def convert_nil nil_arg
|
67
75
|
"null"
|
68
76
|
end
|
@@ -73,20 +81,20 @@ module RubyScript
|
|
73
81
|
|
74
82
|
def convert_dstr dstr
|
75
83
|
dstr.delete_at(0)
|
76
|
-
string = "
|
84
|
+
string = ""
|
77
85
|
dstr.delete_at(0)
|
78
|
-
dstr.
|
79
|
-
if
|
80
|
-
string <<
|
86
|
+
dstr.each_index do |i|
|
87
|
+
if i == (dstr.count - 1)
|
88
|
+
string << convert_anon(dstr[i])
|
81
89
|
else
|
82
|
-
string << convert_anon(
|
90
|
+
string << "#{convert_anon(dstr[i])} + "
|
83
91
|
end
|
84
92
|
end
|
85
|
-
|
93
|
+
string
|
86
94
|
end
|
87
95
|
|
88
96
|
def convert_evstr evstr
|
89
|
-
"
|
97
|
+
"(#{convert_anon(evstr[1])})"
|
90
98
|
end
|
91
99
|
|
92
100
|
def convert_lvar lvar
|
data/lib/rubyscript/version.rb
CHANGED