fOOrth 0.6.6 → 0.6.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +5 -5
  2. data/CODE_OF_CONDUCT.md +49 -0
  3. data/README.md +32 -1
  4. data/fOOrth.gemspec +3 -3
  5. data/integration/array_lib_tests.rb +10 -0
  6. data/integration/compile_lib_tests.rb +67 -1
  7. data/integration/exception_lib_tests.rb +4 -0
  8. data/integration/hash_lib_tests.rb +9 -0
  9. data/integration/numeric_lib_tests.rb +326 -321
  10. data/integration/procedure_lib_tests.rb +16 -0
  11. data/integration/queue_lib_tests.rb +2 -1
  12. data/integration/stack_lib_tests.rb +2 -1
  13. data/integration/stdio_lib_tests.rb +62 -0
  14. data/integration/string_lib_tests.rb +11 -0
  15. data/integration/thread_lib_tests.rb +19 -5
  16. data/lib/fOOrth.rb +0 -2
  17. data/lib/fOOrth/compiler/context.rb +64 -64
  18. data/lib/fOOrth/compiler/context/locals.rb +34 -34
  19. data/lib/fOOrth/compiler/context/map_name.rb +85 -74
  20. data/lib/fOOrth/compiler/context/tags.rb +60 -48
  21. data/lib/fOOrth/compiler/process/generate.rb +1 -1
  22. data/lib/fOOrth/compiler/process/procedure.rb +40 -0
  23. data/lib/fOOrth/compiler/word_specs.rb +3 -3
  24. data/lib/fOOrth/core/object.rb +1 -1
  25. data/lib/fOOrth/library.rb +3 -0
  26. data/lib/fOOrth/library/alias_library.rb +126 -0
  27. data/lib/fOOrth/library/array_library.rb +41 -21
  28. data/lib/fOOrth/library/command_library.rb +1 -1
  29. data/lib/fOOrth/library/compile_library.rb +266 -264
  30. data/lib/fOOrth/library/complex_library.rb +82 -80
  31. data/lib/fOOrth/library/float_library.rb +37 -0
  32. data/lib/fOOrth/library/formatting/array.rb +90 -0
  33. data/lib/fOOrth/library/formatting/bullets.rb +15 -79
  34. data/lib/fOOrth/library/formatting/columns.rb +20 -42
  35. data/lib/fOOrth/library/formatting/hash.rb +29 -0
  36. data/lib/fOOrth/library/formatting/nil.rb +13 -0
  37. data/lib/fOOrth/library/formatting/object.rb +18 -0
  38. data/lib/fOOrth/library/formatting/string.rb +46 -0
  39. data/lib/fOOrth/library/hash_library.rb +14 -6
  40. data/lib/fOOrth/library/introspection/class.rb +20 -18
  41. data/lib/fOOrth/library/introspection/context.rb +3 -2
  42. data/lib/fOOrth/library/introspection/object.rb +42 -20
  43. data/lib/fOOrth/library/introspection/string.rb +21 -5
  44. data/lib/fOOrth/library/introspection/vm.rb +17 -29
  45. data/lib/fOOrth/library/mutex_library.rb +8 -1
  46. data/lib/fOOrth/library/numeric_library.rb +359 -380
  47. data/lib/fOOrth/library/procedure_library.rb +69 -65
  48. data/lib/fOOrth/library/queue_library.rb +6 -1
  49. data/lib/fOOrth/library/rational_library.rb +89 -89
  50. data/lib/fOOrth/library/stack_library.rb +6 -1
  51. data/lib/fOOrth/library/stdio_library.rb +11 -8
  52. data/lib/fOOrth/library/string_library.rb +21 -6
  53. data/lib/fOOrth/library/stubs_library.rb +49 -0
  54. data/lib/fOOrth/monkey_patch/exceptions.rb +2 -6
  55. data/lib/fOOrth/monkey_patch/object.rb +7 -0
  56. data/lib/fOOrth/version.rb +1 -1
  57. data/reek.txt +1 -59
  58. data/sire.rb +0 -1
  59. data/tests/compiler/context_tests.rb +188 -177
  60. data/tests/compiler/file_source_tests.rb +130 -130
  61. data/tests/compiler/parser_tests.rb +4 -4
  62. data/tests/compiler/string_source_tests.rb +4 -4
  63. data/tests/core_tests.rb +138 -138
  64. data/tests/monkey_patch/complex_test.rb +24 -24
  65. data/tests/monkey_patch/object_test.rb +49 -49
  66. data/tests/monkey_patch/string_test.rb +61 -61
  67. metadata +20 -13
@@ -1,65 +1,69 @@
1
- # coding: utf-8
2
-
3
- #* library/procedure_library.rb - Proc support for the fOOrth library.
4
- module XfOOrth
5
-
6
- #Connect the Proc class to the fOOrth class system.
7
- Proc.create_foorth_proxy('Procedure')
8
-
9
- # A no operation place holder for procedure literals
10
- VirtualMachine.create_shared_method('{{', MacroSpec, [:macro, " "])
11
-
12
- # [procedure] .call [unspecified]
13
- Proc.create_shared_method('.call', TosSpec, [],
14
- &lambda {|vm| self.call(vm); })
15
-
16
- # [owner procedure] .call_with [unspecified]
17
- Proc.create_shared_method('.call_with', TosSpec, [],
18
- &lambda {|vm| vm.pop.instance_exec(vm, &self); })
19
-
20
- # [v procedure] .call_v [unspecified]
21
- Proc.create_shared_method('.call_v', TosSpec, [],
22
- &lambda {|vm| value = vm.pop; self.call(vm, value); })
23
-
24
- # [x procedure] .call_x [unspecified]
25
- Proc.create_shared_method('.call_x', TosSpec, [],
26
- &lambda {|vm| index = vm.pop; self.call(vm, nil, index); })
27
-
28
- # [v x procedure] .call_vx [unspecified]
29
- Proc.create_shared_method('.call_vx', TosSpec, [],
30
- &lambda {|vm| value, index = vm.popm(2); self.call(vm, value, index); })
31
-
32
- # [procedure] .start [a_thread]
33
- Proc.create_shared_method('.start', TosSpec, [], &lambda {|vm|
34
- vm.push(self.do_thread_start(vm, '-'))
35
- })
36
-
37
- # [name procedure] .start_named [a_thread]
38
- Proc.create_shared_method('.start_named', TosSpec, [], &lambda {|vm|
39
- vm.push(self.do_thread_start(vm, vm.pop.to_s.freeze))
40
- })
41
-
42
- end
43
-
44
- #A helper method in the Proc class for fOOrth threads.
45
- class Proc
46
- #Do the mechanics of starting a thread.
47
- def do_thread_start(vm, vm_name)
48
- block, interlock = self, Queue.new
49
-
50
- result = Thread.new(vm.foorth_copy(vm_name)) do |vm_copy|
51
-
52
- begin
53
- self.foorth_init(vm_copy.compiler_reset.connect_vm_to_thread)
54
- ensure
55
- interlock.push(:ready)
56
- end
57
-
58
- vm_copy.instance_exec(vm_copy, &block)
59
- end
60
-
61
- interlock.pop
62
- result
63
- end
64
- end
65
-
1
+ # coding: utf-8
2
+
3
+ #* library/procedure_library.rb - Proc support for the fOOrth library.
4
+ module XfOOrth
5
+
6
+ #Connect the Proc class to the fOOrth class system.
7
+ Proc.create_foorth_proxy('Procedure')
8
+
9
+ # A no operation place holder for procedure literals. This may seem odd but
10
+ # works because any word ending in '{{' is assumed to have a procedure literal
11
+ # attached to it. This is handled in compiler/process/procedure.rb. This code
12
+ # handles compiling the procedure and pushing a reference to it on the stack.
13
+ # Once this is done, this word need do nothing further so is a no-op.
14
+ VirtualMachine.create_shared_method('{{', MacroSpec, [:macro, " "])
15
+
16
+ # [procedure] .call [unspecified]
17
+ Proc.create_shared_method('.call', TosSpec, [],
18
+ &lambda {|vm| self.call(vm); })
19
+
20
+ # [owner procedure] .call_with [unspecified]
21
+ Proc.create_shared_method('.call_with', TosSpec, [],
22
+ &lambda {|vm| vm.pop.instance_exec(vm, &self); })
23
+
24
+ # [v procedure] .call_v [unspecified]
25
+ Proc.create_shared_method('.call_v', TosSpec, [],
26
+ &lambda {|vm| value = vm.pop; self.call(vm, value); })
27
+
28
+ # [x procedure] .call_x [unspecified]
29
+ Proc.create_shared_method('.call_x', TosSpec, [],
30
+ &lambda {|vm| index = vm.pop; self.call(vm, nil, index); })
31
+
32
+ # [v x procedure] .call_vx [unspecified]
33
+ Proc.create_shared_method('.call_vx', TosSpec, [],
34
+ &lambda {|vm| value, index = vm.popm(2); self.call(vm, value, index); })
35
+
36
+ # [procedure] .start [a_thread]
37
+ Proc.create_shared_method('.start', TosSpec, [], &lambda {|vm|
38
+ vm.push(self.do_thread_start(vm, '-'))
39
+ })
40
+
41
+ # [name procedure] .start_named [a_thread]
42
+ Proc.create_shared_method('.start_named', TosSpec, [], &lambda {|vm|
43
+ vm.push(self.do_thread_start(vm, vm.pop.to_s.freeze))
44
+ })
45
+
46
+ end
47
+
48
+ #A helper method in the Proc class for fOOrth threads.
49
+ class Proc
50
+ #Do the mechanics of starting a thread.
51
+ def do_thread_start(vm, vm_name)
52
+ block, interlock = self, Queue.new
53
+
54
+ result = Thread.new(vm.foorth_copy(vm_name)) do |vm_copy|
55
+
56
+ begin
57
+ self.foorth_init(vm_copy.compiler_reset.connect_vm_to_thread)
58
+ ensure
59
+ interlock.push(:ready)
60
+ end
61
+
62
+ vm_copy.instance_exec(vm_copy, &block)
63
+ end
64
+
65
+ interlock.pop
66
+ result
67
+ end
68
+ end
69
+
@@ -34,13 +34,18 @@ module XfOOrth
34
34
  vm.push(self.empty?)
35
35
  })
36
36
 
37
+ # [queue] .present? [a_boolean]
38
+ Queue.create_shared_method('.present?', TosSpec, [], &lambda {|vm|
39
+ vm.push(!self.empty?)
40
+ })
41
+
37
42
  # [queue] .length [an_integer]
38
43
  Queue.create_shared_method('.length', TosSpec, [], &lambda {|vm|
39
44
  vm.push(self.length)
40
45
  })
41
46
 
42
47
  # [queue] .clear []
43
- Queue.create_shared_method('.clear', TosSpec, [], &lambda {|vm|
48
+ Queue.create_shared_method('.clear!', TosSpec, [], &lambda {|vm|
44
49
  self.clear
45
50
  })
46
51
 
@@ -1,90 +1,90 @@
1
- # coding: utf-8
2
-
3
- #* library/rational_library.rb - Numeric support for the fOOrth library.
4
- module XfOOrth
5
-
6
- #Connect the Rational class to the fOOrth class system.
7
- Rational.create_foorth_proxy
8
-
9
- # Some conversion words.
10
- # [n d] rational [n/d]
11
- VirtualMachine.create_shared_method('rational', VmSpec, [], &lambda {|vm|
12
- num,den = popm(2)
13
-
14
- begin
15
- push(Rational(num.to_foorth_r, den.to_foorth_r))
16
- rescue
17
- push(nil)
18
- end
19
- })
20
-
21
- # Some conversion words.
22
- # [n d] rational! [n/d]
23
- VirtualMachine.create_shared_method('rational!', VmSpec, [], &lambda {|vm|
24
- num,den = popm(2)
25
-
26
- begin
27
- push(Rational(num.to_foorth_r, den.to_foorth_r))
28
- rescue
29
- error "F40: Cannot coerce a #{num.foorth_name}, #{den.foorth_name} to a Rational"
30
- end
31
- })
32
-
33
- # [err_limit float] .rationalize_to [rational]
34
- Numeric.create_shared_method('.rationalize_to', TosSpec, [], &lambda {|vm|
35
- err_limit = Float.foorth_coerce(vm.pop)
36
-
37
- vm.push(self.rationalize(err_limit))
38
- })
39
-
40
- Complex.create_shared_method('.rationalize_to', TosSpec, [:stub])
41
-
42
- # [rational] .split [numerator, denominator]
43
- Rational.create_shared_method('.split', TosSpec, [],
44
- &lambda {|vm| vm.push(self.numerator); vm.push(self.denominator); })
45
-
46
- # [a] .to_r [n/d]
47
- Object.create_shared_method('.to_r', TosSpec, [], &lambda {|vm|
48
- begin
49
- vm.push(Rational(self))
50
- rescue
51
- vm.push(nil)
52
- end
53
- })
54
-
55
- # [a] .to_r! [n/d]
56
- Object.create_shared_method('.to_r!', TosSpec, [], &lambda {|vm|
57
- begin
58
- vm.push(Rational(self))
59
- rescue
60
- error "F40: Cannot convert a #{self.foorth_name} to a Rational instance"
61
- end
62
- })
63
-
64
- # [a_float] .to_r [n/d]
65
- Float.create_shared_method('.to_r', TosSpec, [], &lambda {|vm|
66
- begin
67
- vm.push(self.rationalize)
68
- rescue
69
- vm.push(nil)
70
- end
71
- })
72
-
73
- # [a_float] .to_r! [n/d]
74
- Float.create_shared_method('.to_r!', TosSpec, [], &lambda {|vm|
75
- begin
76
- vm.push(self.rationalize)
77
- rescue
78
- error "F40: Cannot convert a #{self.foorth_name} to a Rational instance"
79
- end
80
- })
81
-
82
- # [n/d] .numerator [n]
83
- Numeric.create_shared_method('.numerator', TosSpec, [],
84
- &lambda {|vm| vm.push(self.numerator); })
85
-
86
- # [n/d] .denominator [d]
87
- Numeric.create_shared_method('.denominator', TosSpec, [],
88
- &lambda {|vm| vm.push(self.denominator); })
89
-
1
+ # coding: utf-8
2
+
3
+ #* library/rational_library.rb - Numeric support for the fOOrth library.
4
+ module XfOOrth
5
+
6
+ #Connect the Rational class to the fOOrth class system.
7
+ Rational.create_foorth_proxy
8
+
9
+ # Some conversion words.
10
+ # [n d] rational [n/d]
11
+ VirtualMachine.create_shared_method('rational', VmSpec, [], &lambda {|vm|
12
+ num,den = popm(2)
13
+
14
+ begin
15
+ push(Rational(num.to_foorth_r, den.to_foorth_r))
16
+ rescue
17
+ push(nil)
18
+ end
19
+ })
20
+
21
+ # Some conversion words.
22
+ # [n d] rational! [n/d]
23
+ VirtualMachine.create_shared_method('rational!', VmSpec, [], &lambda {|vm|
24
+ num,den = popm(2)
25
+
26
+ begin
27
+ push(Rational(num.to_foorth_r, den.to_foorth_r))
28
+ rescue
29
+ error "F40: Cannot coerce a #{num.foorth_name}, #{den.foorth_name} to a Rational"
30
+ end
31
+ })
32
+
33
+ # [err_limit float] .rationalize_to [rational]
34
+ Numeric.create_shared_method('.rationalize_to', TosSpec, [], &lambda {|vm|
35
+ err_limit = Float.foorth_coerce(vm.pop)
36
+
37
+ vm.push(self.rationalize(err_limit))
38
+ })
39
+
40
+ Complex.create_shared_method('.rationalize_to', TosSpec, [:stub])
41
+
42
+ # [rational] .split [numerator, denominator]
43
+ Rational.create_shared_method('.split', TosSpec, [],
44
+ &lambda {|vm| vm.push(self.numerator); vm.push(self.denominator); })
45
+
46
+ # [a] .to_r [n/d]
47
+ Object.create_shared_method('.to_r', TosSpec, [], &lambda {|vm|
48
+ begin
49
+ vm.push(Rational(self))
50
+ rescue
51
+ vm.push(nil)
52
+ end
53
+ })
54
+
55
+ # [a] .to_r! [n/d]
56
+ Object.create_shared_method('.to_r!', TosSpec, [], &lambda {|vm|
57
+ begin
58
+ vm.push(Rational(self))
59
+ rescue
60
+ error "F40: Cannot convert a #{self.foorth_name} to a Rational instance"
61
+ end
62
+ })
63
+
64
+ # [a_float] .to_r [n/d]
65
+ Float.create_shared_method('.to_r', TosSpec, [], &lambda {|vm|
66
+ begin
67
+ vm.push(self.rationalize)
68
+ rescue
69
+ vm.push(nil)
70
+ end
71
+ })
72
+
73
+ # [a_float] .to_r! [n/d]
74
+ Float.create_shared_method('.to_r!', TosSpec, [], &lambda {|vm|
75
+ begin
76
+ vm.push(self.rationalize)
77
+ rescue
78
+ error "F40: Cannot convert a #{self.foorth_name} to a Rational instance"
79
+ end
80
+ })
81
+
82
+ # [n/d] .numerator [n]
83
+ Numeric.create_shared_method('.numerator', TosSpec, [],
84
+ &lambda {|vm| vm.push(self.numerator); })
85
+
86
+ # [n/d] .denominator [d]
87
+ Numeric.create_shared_method('.denominator', TosSpec, [],
88
+ &lambda {|vm| vm.push(self.denominator); })
89
+
90
90
  end
@@ -14,7 +14,7 @@ module XfOOrth
14
14
  })
15
15
 
16
16
  #Clear the Stack object.
17
- stack.create_shared_method('.clear', TosSpec, [], &lambda {|vm|
17
+ stack.create_shared_method('.clear!', TosSpec, [], &lambda {|vm|
18
18
  @data.clear
19
19
  })
20
20
 
@@ -46,6 +46,11 @@ module XfOOrth
46
46
  vm.push(@data.empty?)
47
47
  })
48
48
 
49
+ #[stack] .present? [a_boolean]
50
+ stack.create_shared_method('.present?', TosSpec, [], &lambda {|vm|
51
+ vm.push(!@data.empty?)
52
+ })
53
+
49
54
  #[stack] .length [an_integer]
50
55
  stack.create_shared_method('.length', TosSpec, [], &lambda {|vm|
51
56
  vm.push(@data.length)
@@ -1,6 +1,11 @@
1
1
  # coding: utf-8
2
2
 
3
3
  #Load up some pretty printing support.
4
+ require_relative 'formatting/nil'
5
+ require_relative 'formatting/object'
6
+ require_relative 'formatting/string'
7
+ require_relative 'formatting/array'
8
+ require_relative 'formatting/hash'
4
9
  require_relative 'formatting/columns'
5
10
  require_relative 'formatting/bullets'
6
11
 
@@ -65,7 +70,7 @@ module XfOOrth
65
70
 
66
71
  symbol = :chars_per_line
67
72
  $chars_per_line = [80]
68
- SymbolMap.add_entry('$chars_per_line', :chars_per_line)
73
+ SymbolMap.add_entry('$chars_per_line', symbol)
69
74
  $FOORTH_GLOBALS[symbol] = GlobalVarSpec.new('$chars_per_line', symbol, [])
70
75
 
71
76
  #Show the page length.
@@ -86,24 +91,22 @@ module XfOOrth
86
91
 
87
92
  # [ l 2 3 ... n ] .pp []; pretty print the array!
88
93
  Array.create_shared_method('.pp', TosSpec, [], &lambda {|vm|
89
- puts_foorth_columnized($lines_per_page[0], $chars_per_line[0])
94
+ puts_foorth_columns($lines_per_page[0], $chars_per_line[0])
90
95
  })
91
96
 
92
97
  # [ l 2 3 ... n ] .format_columns []; format to strings with columns.
93
98
  Array.create_shared_method('.format_columns', TosSpec, [], &lambda {|vm|
94
- vm.push(foorth_columnize($lines_per_page[0], $chars_per_line[0])
95
- .map {|page| page << ""}
96
- .flatten[0...-1])
99
+ vm.push(format_foorth_columns($lines_per_page[0], $chars_per_line[0]))
97
100
  })
98
101
 
99
102
  # [ l 2 3 ... n ] .print_columns []; pretty print columns.
100
103
  Array.create_shared_method('.print_columns', TosSpec, [], &lambda {|vm|
101
- puts_foorth_columnized($lines_per_page[0], $chars_per_line[0])
104
+ puts_foorth_columns($lines_per_page[0], $chars_per_line[0])
102
105
  })
103
106
 
104
107
  #[["1" "stuff"] ["two" stuff] .format_bullets; format to strings with bullets.
105
108
  Array.create_shared_method('.format_bullets', TosSpec, [], &lambda {|vm|
106
- vm.push(foorth_bulletize($chars_per_line[0]))
109
+ vm.push(foorth_format_bullets($chars_per_line[0]))
107
110
  })
108
111
 
109
112
  #[["1" "stuff"] ["two" stuff] .print_bullets; pretty print bullet points.
@@ -113,7 +116,7 @@ module XfOOrth
113
116
 
114
117
  #{ "1" "stuff" -> "two" "stuff" -> } .format_bullets; format to strings with bullets.
115
118
  Hash.create_shared_method('.format_bullets', TosSpec, [], &lambda {|vm|
116
- vm.push(foorth_bulletize($chars_per_line[0]))
119
+ vm.push(foorth_format_bullets($chars_per_line[0]))
117
120
  })
118
121
 
119
122
  #{ "1" "stuff" -> "two" "stuff" -> } .print_bullets; pretty print bullet points.
@@ -211,33 +211,48 @@ module XfOOrth
211
211
 
212
212
  # ['fgh' 'abcdefgh'] .right? [boolean]
213
213
  String.create_shared_method('.right?', TosSpec, [],
214
- &lambda {|vm| vm.poke(self.end_with?(vm.peek)); })
214
+ &lambda {|vm| vm.poke(self.end_with?(vm.peek)) })
215
215
 
216
216
  #Other String Methods
217
217
 
218
218
  # ['cde' 'abcdefgh'] .contains? [boolean]
219
219
  String.create_shared_method('.contains?', TosSpec, [],
220
- &lambda {|vm| vm.poke(self.index(vm.peek).to_foorth_b); })
220
+ &lambda {|vm| vm.poke(self.index(vm.peek).to_foorth_b) })
221
221
 
222
222
  # ['cde' 'abcdefgh'] .posn [position or nil]
223
223
  String.create_shared_method('.posn', TosSpec, [],
224
- &lambda {|vm| vm.poke(self.index(vm.peek)); })
224
+ &lambda {|vm| vm.poke(self.index(vm.peek)) })
225
225
 
226
226
  # ["a"] .length [n]
227
227
  String.create_shared_method('.length', TosSpec, [],
228
228
  &lambda {|vm| vm.push(self.length); })
229
229
 
230
+ # ["a"] .empty? [a_boolean]
231
+ String.create_shared_method('.empty?', TosSpec, [],
232
+ &lambda {|vm| vm.push(self.empty?) })
233
+
234
+ # ["a"] .present? [a_boolean]
235
+ String.create_shared_method('.present?', TosSpec, [],
236
+ &lambda {|vm| vm.push(!self.empty?) })
237
+
238
+ # ["a"] .clear! [a_boolean]
239
+ StringBuffer.create_shared_method('.clear!', TosSpec, [],
240
+ &lambda {|vm| self.clear })
241
+
230
242
  # ["b", a] + ["ba"]; "ba" is a new object, distinct from "b"
231
243
  String.create_shared_method('+', NosSpec, [],
232
244
  &lambda {|vm| vm.poke((self + vm.peek.to_s).freeze) })
233
245
 
246
+ # ["b", a] << [error]; Bug patch. Not fully understood.
247
+ String.create_shared_method('<<', NosSpec, [:stub])
248
+
234
249
  # ["b"*, a] << ["ba"*]; "ba"* is the same object as "b"*
235
250
  StringBuffer.create_shared_method('<<', NosSpec, [],
236
251
  &lambda {|vm| vm.poke(self << vm.peek.to_s); })
237
252
 
238
253
  # ["b"*, a] >> ["ab"*]; "ab"* is the same object as "b"*
239
254
  StringBuffer.create_shared_method('>>', NosSpec, [],
240
- &lambda {|vm| vm.poke(self.prepend(vm.peek.to_s)); })
255
+ &lambda {|vm| vm.poke(self.prepend(vm.peek.to_s)) })
241
256
 
242
257
  # ["b", n] * ["bbb..."]
243
258
  String.create_shared_method('*', NosSpec, [], &lambda {|vm|
@@ -267,7 +282,7 @@ module XfOOrth
267
282
 
268
283
  # ["stressed"] .reverse ["desserts"]
269
284
  String.create_shared_method('.reverse', TosSpec, [],
270
- &lambda {|vm| vm.push(self.to_s.reverse.freeze); })
285
+ &lambda {|vm| vm.push(self.to_s.reverse.freeze) })
271
286
 
272
287
  # ["stressed"*] .reverse* [] #Reverse the string in place.
273
288
  StringBuffer.create_shared_method('.reverse*', TosSpec, [],
@@ -318,7 +333,7 @@ module XfOOrth
318
333
 
319
334
  # [a_string] .shell []
320
335
  String.create_shared_method('.shell', TosSpec, [], &lambda {|vm|
321
- system(self)
336
+ system(self.chomp + "\n")
322
337
  })
323
338
 
324
339
  # [a_string] .shell_out [a_string]