sardonyx 0.1.81 → 0.1.82
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 +4 -4
- data/lib/sdx/vm/datatypes.rb +18 -20
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a384634a4bfdce5ea555978895b81d96a5d4d916375bc192a739493920d6d8bf
|
|
4
|
+
data.tar.gz: 38fc8ac4918a9cbbe7f3e4a06e7b053ee99132b4a49c2b434fe82384b78d2f9d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6cc678adbf5ae8f5059b05934d8934e0c33e43cda2842bdf54e606238d221fba49c0133984cb7bcbe0de0a79a3cb692758c60797d3cad53732b6bc2ade48324d
|
|
7
|
+
data.tar.gz: 417c8e9ee3cf5cf62b3f95962712f60b72f156bd4cdbe9a685101c6df9fed101c7533be14037057481e273e5b7fb79efb57f87ea9e4f8fbbfc330b9e248dbcdf
|
data/lib/sdx/vm/datatypes.rb
CHANGED
|
@@ -83,22 +83,22 @@ class Int < DataType
|
|
|
83
83
|
as_bool
|
|
84
84
|
end)),
|
|
85
85
|
"__add" => (NativeFnInternal.new (Proc.new do |other|
|
|
86
|
-
add other
|
|
86
|
+
add other[0]
|
|
87
87
|
end)),
|
|
88
88
|
"__sub" => (NativeFnInternal.new (Proc.new do |other|
|
|
89
|
-
sub other
|
|
89
|
+
sub other[0]
|
|
90
90
|
end)),
|
|
91
91
|
"__mul" => (NativeFnInternal.new (Proc.new do |other|
|
|
92
|
-
mul other
|
|
92
|
+
mul other[0]
|
|
93
93
|
end)),
|
|
94
94
|
"__div" => (NativeFnInternal.new (Proc.new do |other|
|
|
95
|
-
div other
|
|
95
|
+
div other[0]
|
|
96
96
|
end)),
|
|
97
97
|
"__mod" => (NativeFnInternal.new (Proc.new do |other|
|
|
98
|
-
mod other
|
|
98
|
+
mod other[0]
|
|
99
99
|
end)),
|
|
100
100
|
"__pow" => (NativeFnInternal.new (Proc.new do |other|
|
|
101
|
-
pow other
|
|
101
|
+
pow other[0]
|
|
102
102
|
end))
|
|
103
103
|
}
|
|
104
104
|
end
|
|
@@ -149,10 +149,10 @@ class Str < DataType
|
|
|
149
149
|
as_code_string
|
|
150
150
|
end)),
|
|
151
151
|
"__add" => (NativeFnInternal.new (Proc.new do |other|
|
|
152
|
-
add other
|
|
152
|
+
add other[0]
|
|
153
153
|
end)),
|
|
154
154
|
"__mul" => (NativeFnInternal.new (Proc.new do |other|
|
|
155
|
-
mul other
|
|
155
|
+
mul other[0]
|
|
156
156
|
end))
|
|
157
157
|
}
|
|
158
158
|
end
|
|
@@ -190,22 +190,22 @@ class Num < DataType
|
|
|
190
190
|
as_bool
|
|
191
191
|
end)),
|
|
192
192
|
"__add" => (NativeFnInternal.new (Proc.new do |other|
|
|
193
|
-
add other
|
|
193
|
+
add other[0]
|
|
194
194
|
end)),
|
|
195
195
|
"__sub" => (NativeFnInternal.new (Proc.new do |other|
|
|
196
|
-
sub other
|
|
196
|
+
sub other[0]
|
|
197
197
|
end)),
|
|
198
198
|
"__mul" => (NativeFnInternal.new (Proc.new do |other|
|
|
199
|
-
mul other
|
|
199
|
+
mul other[0]
|
|
200
200
|
end)),
|
|
201
201
|
"__div" => (NativeFnInternal.new (Proc.new do |other|
|
|
202
|
-
div other
|
|
202
|
+
div other[0]
|
|
203
203
|
end)),
|
|
204
204
|
"__mod" => (NativeFnInternal.new (Proc.new do |other|
|
|
205
|
-
mod other
|
|
205
|
+
mod other[0]
|
|
206
206
|
end)),
|
|
207
207
|
"__pow" => (NativeFnInternal.new (Proc.new do |other|
|
|
208
|
-
pow other
|
|
208
|
+
pow other[0]
|
|
209
209
|
end))
|
|
210
210
|
}
|
|
211
211
|
end
|
|
@@ -272,10 +272,10 @@ class List < DataType
|
|
|
272
272
|
iter
|
|
273
273
|
end)),
|
|
274
274
|
"__add" => (NativeFnInternal.new (Proc.new do |other|
|
|
275
|
-
add other
|
|
275
|
+
add other[0]
|
|
276
276
|
end)),
|
|
277
277
|
"__mul" => (NativeFnInternal.new (Proc.new do |other|
|
|
278
|
-
mul other
|
|
278
|
+
mul other[0]
|
|
279
279
|
end)),
|
|
280
280
|
"__arity" => (Int.new 1),
|
|
281
281
|
"__call" => (NativeFnInternal.new (Proc.new do |args, scope|
|
|
@@ -285,21 +285,19 @@ class List < DataType
|
|
|
285
285
|
end
|
|
286
286
|
|
|
287
287
|
def as_string
|
|
288
|
-
s = "["
|
|
289
288
|
@internal.each do |item|
|
|
290
289
|
s += (stringify item) + ", "
|
|
291
290
|
end
|
|
292
|
-
s = s[0..-3]
|
|
291
|
+
s = "[" + s[0..-3]
|
|
293
292
|
s += "]"
|
|
294
293
|
Str.new s
|
|
295
294
|
end
|
|
296
295
|
|
|
297
296
|
def as_code_string
|
|
298
|
-
s = "["
|
|
299
297
|
@internal.each do |item|
|
|
300
298
|
s += (codify item) + ", "
|
|
301
299
|
end
|
|
302
|
-
s = s[0..-3]
|
|
300
|
+
s = "[" + s[0..-3]
|
|
303
301
|
s += "]"
|
|
304
302
|
Str.new s
|
|
305
303
|
end
|