alphalang 0.2.0 → 0.2.1
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 +13 -2
- data/lib/nodes/stmtnodes.rb +7 -1
- data/lib/tester/fibonacci.alpha +1 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9032649193942a6dda8f421a2e4cde4c106bf954516a4d980ddd82c8ff0adf6b
|
4
|
+
data.tar.gz: 2db114a711be0899a041fe0b0a435f2790eb32e53c475be63820ec0dcd29c16a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 497b7ab960ef819497acf99eaedc1c3df627aa503b6265fda402f718dd86fb610ccf9a759cc437f6b6b66e7183ebdbc688e9ba967511cb097ce2aa8d3afcfba0
|
7
|
+
data.tar.gz: c1ad4fc015e1226ad53e8ec1a3fbda5f17a39e245e552d88aac4f128552143c658bdc34b63f7331a7cc42f9de28d27f458d16df7185e35510d9499e612ac20d2
|
data/lib/nodes/basenodes.rb
CHANGED
@@ -155,7 +155,6 @@ end
|
|
155
155
|
|
156
156
|
####################################################
|
157
157
|
|
158
|
-
#Arraynoden är ofärdig, används inte korrekt
|
159
158
|
class ArrayNode < Node
|
160
159
|
attr_accessor :lhs, :rhs
|
161
160
|
|
@@ -173,6 +172,18 @@ class ArrayNode < Node
|
|
173
172
|
end
|
174
173
|
end
|
175
174
|
|
175
|
+
def display_on_new_line
|
176
|
+
puts @value
|
177
|
+
end
|
178
|
+
|
179
|
+
def display_on_one_line
|
180
|
+
puts @value.join(', ')
|
181
|
+
end
|
182
|
+
|
183
|
+
def +(index)
|
184
|
+
@value.append(index)
|
185
|
+
end
|
186
|
+
|
176
187
|
def [](index)
|
177
188
|
@value[index]
|
178
189
|
end
|
@@ -192,6 +203,6 @@ class ArrayNode < Node
|
|
192
203
|
end
|
193
204
|
|
194
205
|
def evaluate
|
195
|
-
|
206
|
+
self
|
196
207
|
end
|
197
208
|
end
|
data/lib/nodes/stmtnodes.rb
CHANGED
@@ -187,7 +187,13 @@ class PrintNode
|
|
187
187
|
end
|
188
188
|
|
189
189
|
def evaluate
|
190
|
-
|
190
|
+
if @value.evaluate.is_a?(ArrayNode)
|
191
|
+
@value.evaluate.display_on_one_line
|
192
|
+
elsif @value.evaluate.is_a?(Array)
|
193
|
+
puts @value.evaluate.join(', ')
|
194
|
+
else
|
195
|
+
puts @value.evaluate
|
196
|
+
end
|
191
197
|
self.class
|
192
198
|
end
|
193
199
|
end
|
data/lib/tester/fibonacci.alpha
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alphalang
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mattias, victor
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05-
|
11
|
+
date: 2024-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logger
|