fish.rb 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/fish.rb +4 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Yzg3YmIzOWQ3NTJhYzgzZGE1M2QxODMyYjUyZmExYmE4YTI1MWJjOQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OGYyZGVjZDdkMzQ5OGY4MGYyNmJjOWZjM2M2ODA4MDZlM2Q2MDBjMQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzJkMzQ4YTc3MjhmYjM5NGZjOGY2NjY1MGYyODIyYTBkZDQyOWI4Mzc4MzQz
|
10
|
+
NTFjOGM4ODQwYzA4MzAzMTg5NGMyMjkwMWZkYTU4ZDQxM2YxODkxMDA0ZjA2
|
11
|
+
OTUxNjRmZDY3NDhkMDllZWZmMWU3NmQ2OTYxZTQwOTZkNjhhNGU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MGM3YzdhYTFiZmQyNDU0OGY1NDJiZDhhY2YwN2JlYWYwNTQyZjJiOWQyZTFh
|
14
|
+
ZmE0NzEyNmJlYzNlYzAxM2Q2Y2YxNDkyOWI0ZTgwZGVkNjdiMDllZDQ4MmM0
|
15
|
+
OTMzMzlhNDNmYzRmNTZmYTEyMTVmNzA5YmI3ZGEwYmE5ZTAyZDM=
|
data/fish.rb
CHANGED
@@ -46,6 +46,7 @@ class CodeBox
|
|
46
46
|
pt.replace [pt[0], (tmp == [] ? ys.max : tmp.max)]
|
47
47
|
at pt
|
48
48
|
end
|
49
|
+
def self.print; pp @data end
|
49
50
|
end
|
50
51
|
end # class CodeBox
|
51
52
|
|
@@ -130,8 +131,8 @@ class Interpreter
|
|
130
131
|
'n' => lambda { |pt, dir, stks, box, cntl| @@stdout.write (stks[-1].pop 1)[0].to_s },
|
131
132
|
'i' => lambda { |pt, dir, stks, box, cntl| stks[-1].push (cntl[:ibuf].empty? ? -1 : cntl[:ibuf][0].ord); cntl[:ibuf] = cntl[:ibuf][1..-1] unless cntl[:ibuf].length < 1 },
|
132
133
|
# reflection
|
133
|
-
'g' => lambda { |pt, dir, stks, box, cntl| stks[-1].push (box.at stks[-1].pop 2).ord },
|
134
|
-
'p' => lambda { |pt, dir, stks, box, cntl|
|
134
|
+
'g' => lambda { |pt, dir, stks, box, cntl| stks[-1].push (box.at (stks[-1].pop 2).reverse).ord },
|
135
|
+
'p' => lambda { |pt, dir, stks, box, cntl| v = (stks[-1].pop 1)[0]; box.set ((stks[-1].pop 2).reverse), v.chr },
|
135
136
|
# miscellaneous
|
136
137
|
'&' => lambda { |pt, dir, stks, box, cntl| stks[-1].reg },
|
137
138
|
';' => lambda { |pt, dir, stks, box, cntl| cntl[:done] = true },
|
@@ -168,7 +169,7 @@ class Interpreter
|
|
168
169
|
op = ' ' if op.nil?
|
169
170
|
if options[:debug] >= 3; puts op end
|
170
171
|
func = @@ops[op]
|
171
|
-
abort "\nsomething smells fishy... (invalid instruction)" if func.nil?
|
172
|
+
abort "\nsomething smells fishy... (invalid instruction #{op})" if func.nil?
|
172
173
|
func.call @pt, @dir, @stks, @box, @cntl
|
173
174
|
op = @box.send @dir, @pt
|
174
175
|
end
|