r-fxxk 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/r-fxxk.rb +25 -2
- data/r-fxxk.gemspec +2 -2
- data/spec/r-fxxk_spec.rb +1 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/lib/r-fxxk.rb
CHANGED
@@ -41,6 +41,10 @@ class BrainFuck
|
|
41
41
|
dst
|
42
42
|
end
|
43
43
|
|
44
|
+
def hello_world
|
45
|
+
translate(BrainFuck, '>+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-]<.>+++++++++++[<+++++>-]<.>++++++++[<+++>-]<.+++.------.--------.[-]>++++++++[<++++>-]<+.[-]++++++++++.')
|
46
|
+
end
|
47
|
+
|
44
48
|
def fuck(src)
|
45
49
|
src = compile(src)
|
46
50
|
ptr = 0
|
@@ -64,9 +68,28 @@ class BrainFuck
|
|
64
68
|
output << cell[ptr].chr
|
65
69
|
when :get
|
66
70
|
when :opn
|
67
|
-
|
71
|
+
if cell[ptr] == 0
|
72
|
+
open_count = 1
|
73
|
+
buf_cur = cur
|
74
|
+
while open_count > 0
|
75
|
+
open_count.times do
|
76
|
+
next_cur = src.index(self.class.bf_mapping[:cls], buf_cur)
|
77
|
+
open_count = src[buf_cur+1..next_cur].count(self.class.bf_mapping[:opn])
|
78
|
+
buf_cur = next_cur
|
79
|
+
end
|
80
|
+
end
|
81
|
+
next_cur = next_cur + 1
|
82
|
+
end
|
68
83
|
when :cls
|
69
|
-
|
84
|
+
close_count = 1
|
85
|
+
buf_cur = cur
|
86
|
+
while close_count > 0
|
87
|
+
close_count.times do
|
88
|
+
next_cur = src.rindex(self.class.bf_mapping[:opn], buf_cur)
|
89
|
+
close_count = src[next_cur..buf_cur-1].count(self.class.bf_mapping[:cls])
|
90
|
+
buf_cur = next_cur
|
91
|
+
end
|
92
|
+
end
|
70
93
|
end
|
71
94
|
cur = next_cur || src.index(reg, cur) + matches[1].length
|
72
95
|
end
|
data/r-fxxk.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "r-fxxk"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["masarakki"]
|
12
|
-
s.date = "2012-04-
|
12
|
+
s.date = "2012-04-20"
|
13
13
|
s.description = "generate your own brain-fxxk-like language"
|
14
14
|
s.email = "masaki@hisme.net"
|
15
15
|
s.extra_rdoc_files = [
|
data/spec/r-fxxk_spec.rb
CHANGED
@@ -47,6 +47,7 @@ describe BrainFuck do
|
|
47
47
|
it "translate(BrainFuck.new, hello.bf) should == hello.mona" do
|
48
48
|
subject.translate(BrainFuck, src('hello.bf')).strip.should eq src('hello.mona').strip
|
49
49
|
end
|
50
|
+
its(:hello_world) { should == src('hello.mona').strip }
|
50
51
|
end
|
51
52
|
|
52
53
|
context 'customized class' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r-fxxk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -96,7 +96,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
96
96
|
version: '0'
|
97
97
|
segments:
|
98
98
|
- 0
|
99
|
-
hash:
|
99
|
+
hash: 1116091257325722486
|
100
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
101
|
none: false
|
102
102
|
requirements:
|