alphalang 0.2.1 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nodes/basenodes.rb +6 -0
- data/lib/nodes/stmtnodes.rb +2 -0
- 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: c46055bf730f2a26ce876fcc685a711359a5e80710da1e86e7eac6e7554af007
|
4
|
+
data.tar.gz: d2751a739b78101ce213c6b29db88fbcc57a0c33dad4282f5bf1d5e385ba7461
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c873cf09f9c0831cbfd15a9f7cdc01a29e2bbe035cf9b04033ea5b6c14be54a7b95d34ed278658892ce9c56e6b1ab81ed998e220ca8a21898c08efe8c4feb2e2
|
7
|
+
data.tar.gz: a34c736242f1b4ab7a5f42d1a3173ada74add81c83e1d6da106c91ccef75f457b2bb73e18bca3f81264c1f0a6ab1b3d09c8edd737ecb4d443623858ef4502674
|
data/lib/nodes/basenodes.rb
CHANGED
@@ -131,6 +131,12 @@ class BinaryOperationNode < Node
|
|
131
131
|
end
|
132
132
|
|
133
133
|
def evaluate
|
134
|
+
if @rhs.evaluate.is_a?(ArrayNode) && @op == '+'
|
135
|
+
return @value = @rhs.evaluate + @lhs.evaluate
|
136
|
+
elsif @lhs.evaluate.is_a?(Array) && @op == '+'
|
137
|
+
return @value = @lhs.evaluate.append(@rhs.evaluate)
|
138
|
+
end
|
139
|
+
|
134
140
|
if @op == '/'
|
135
141
|
@value = @lhs.evaluate.to_f.send(@op, @rhs.evaluate)
|
136
142
|
else
|
data/lib/nodes/stmtnodes.rb
CHANGED
@@ -188,8 +188,10 @@ class PrintNode
|
|
188
188
|
|
189
189
|
def evaluate
|
190
190
|
if @value.evaluate.is_a?(ArrayNode)
|
191
|
+
print "Array #{@value.name}: "
|
191
192
|
@value.evaluate.display_on_one_line
|
192
193
|
elsif @value.evaluate.is_a?(Array)
|
194
|
+
print "Array #{@value.name}: "
|
193
195
|
puts @value.evaluate.join(', ')
|
194
196
|
else
|
195
197
|
puts @value.evaluate
|