fOOrth 0.6.6 → 0.6.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,25 +1,25 @@
1
- # coding: utf-8
2
-
3
- require_relative '../../lib/fOOrth/monkey_patch/numeric'
4
- require_relative '../../lib/fOOrth/monkey_patch/complex'
5
- gem 'minitest'
6
- require 'minitest/autorun'
7
- require 'minitest_visible'
8
-
9
- #Test the monkey patches applied to the Object class.
10
- class ComplexMonkeyPatchTester < Minitest::Test
11
-
12
- #Track mini-test progress.
13
- include MinitestVisible
14
-
15
- #Test that it embeds
16
- def test_foorth_embed
17
- comp = Complex(1,2)
18
- assert_equal(comp.foorth_embed, 'Complex(1,2)')
19
- end
20
-
21
- def test_that_it_is_not_rationalizable
22
- comp = Complex(1,2)
23
- assert_equal(nil, comp.to_foorth_r)
24
- end
1
+ # coding: utf-8
2
+
3
+ require_relative '../../lib/fOOrth/monkey_patch/numeric'
4
+ require_relative '../../lib/fOOrth/monkey_patch/complex'
5
+ gem 'minitest'
6
+ require 'minitest/autorun'
7
+ require 'minitest_visible'
8
+
9
+ #Test the monkey patches applied to the Object class.
10
+ class ComplexMonkeyPatchTester < Minitest::Test
11
+
12
+ #Track mini-test progress.
13
+ include MinitestVisible
14
+
15
+ #Test that it embeds
16
+ def test_foorth_embed
17
+ comp = Complex(1,2)
18
+ assert_equal(comp.foorth_embed, 'Complex(1,2)')
19
+ end
20
+
21
+ def test_that_it_is_not_rationalizable
22
+ comp = Complex(1,2)
23
+ assert_nil(comp.to_foorth_r)
24
+ end
25
25
  end
@@ -1,49 +1,49 @@
1
- # coding: utf-8
2
-
3
- require_relative '../../lib/fOOrth/monkey_patch'
4
- gem 'minitest'
5
- require 'minitest/autorun'
6
- require 'minitest_visible'
7
-
8
- #Test the monkey patches applied to the Object class.
9
- class ObjectMonkeyPatchTester < Minitest::Test
10
-
11
- #Track mini-test progress.
12
- include MinitestVisible
13
-
14
- #Test that it does NOT foorth_embed.
15
- def test_foorth_embed_error
16
- obj = Object.new
17
- assert_raises(XfOOrth::XfOOrthError) { obj.foorth_embed }
18
- end
19
-
20
- #Test for conversion to a boolean.
21
- def test_to_boolean
22
- obj = Object.new
23
- assert_equal(obj.to_foorth_b, true)
24
- end
25
-
26
- #Test for conversion to a character.
27
- def test_to_character
28
- obj = Object.new
29
- assert_equal(obj.to_foorth_c, "\x00")
30
- end
31
-
32
- #Test for conversion to a number.
33
- def test_to_number
34
- obj = Object.new
35
- assert_equal(obj.to_foorth_n, nil)
36
- end
37
-
38
- #Test for conversion to a rational.
39
- def test_to_rational
40
- obj = Object.new
41
- assert_equal(obj.to_foorth_r, nil)
42
- end
43
-
44
- #Test the quick fail raise in fOOrth.
45
- def test_that_exceptions_are_easy_to_raise
46
- assert_raises(XfOOrth::XfOOrthError) { error('Failure IS an option!') }
47
- end
48
-
49
- end
1
+ # coding: utf-8
2
+
3
+ require_relative '../../lib/fOOrth/monkey_patch'
4
+ gem 'minitest'
5
+ require 'minitest/autorun'
6
+ require 'minitest_visible'
7
+
8
+ #Test the monkey patches applied to the Object class.
9
+ class ObjectMonkeyPatchTester < Minitest::Test
10
+
11
+ #Track mini-test progress.
12
+ include MinitestVisible
13
+
14
+ #Test that it does NOT foorth_embed.
15
+ def test_foorth_embed_error
16
+ obj = Object.new
17
+ assert_raises(XfOOrth::XfOOrthError) { obj.foorth_embed }
18
+ end
19
+
20
+ #Test for conversion to a boolean.
21
+ def test_to_boolean
22
+ obj = Object.new
23
+ assert_equal(obj.to_foorth_b, true)
24
+ end
25
+
26
+ #Test for conversion to a character.
27
+ def test_to_character
28
+ obj = Object.new
29
+ assert_equal(obj.to_foorth_c, "\x00")
30
+ end
31
+
32
+ #Test for conversion to a number.
33
+ def test_to_number
34
+ obj = Object.new
35
+ assert_nil(obj.to_foorth_n)
36
+ end
37
+
38
+ #Test for conversion to a rational.
39
+ def test_to_rational
40
+ obj = Object.new
41
+ assert_nil(obj.to_foorth_r)
42
+ end
43
+
44
+ #Test the quick fail raise in fOOrth.
45
+ def test_that_exceptions_are_easy_to_raise
46
+ assert_raises(XfOOrth::XfOOrthError) { error('Failure IS an option!') }
47
+ end
48
+
49
+ end
@@ -1,61 +1,61 @@
1
- # coding: utf-8
2
-
3
- require_relative '../../lib/fOOrth/monkey_patch/string'
4
- gem 'minitest'
5
- require 'minitest/autorun'
6
- require 'minitest_visible'
7
-
8
- #Test the monkey patches applied to the Object class.
9
- class StringMonkeyPatchTester < Minitest::Test
10
-
11
- #Track mini-test progress.
12
- include MinitestVisible
13
-
14
- #Test that it embeds
15
- def test_foorth_embed
16
- assert_equal("A big blue cat".foorth_embed, "\"A big blue cat\"")
17
- assert_equal("The cat's toy".foorth_embed, "\"The cat's toy\"")
18
- assert_equal('A dog\cat race'.foorth_embed, "\"A dog\\\\cat race\"")
19
- assert_equal('A dog/cat race'.foorth_embed, "\"A dog/cat race\"")
20
- end
21
-
22
- #Test converting to a character.
23
- def test_to_character
24
- assert_equal('ABC'.to_foorth_c, 'A')
25
- assert_equal('A'.to_foorth_c, 'A')
26
- assert_equal(''.to_foorth_c, nil)
27
- end
28
-
29
- #Test converting to a number.
30
- def test_to_number
31
- assert_equal('123'.to_foorth_n, 123)
32
- assert_equal('123.4'.to_foorth_n, 123.4)
33
- assert_equal('1/2'.to_foorth_n, '1/2'.to_r)
34
- assert_equal('1+2i'.to_foorth_n, Complex(1,2))
35
- assert_equal('2i'.to_foorth_n, Complex(0,2))
36
- assert_equal('1-2i'.to_foorth_n, Complex(1,-2))
37
- assert_equal('-2i'.to_foorth_n, Complex(0,-2))
38
- assert_equal('+1+2i'.to_foorth_n, Complex(1,2))
39
- assert_equal('+2i'.to_foorth_n, Complex(0,2))
40
- assert_equal('+1-2i'.to_foorth_n, Complex(1,-2))
41
-
42
- assert_equal('fubar'.to_foorth_n, nil)
43
- assert_equal('2cats'.to_foorth_n, nil)
44
- end
45
-
46
- def test_to_rational
47
- assert_equal(Rational(1,2), '1/2'.to_foorth_r)
48
- assert_equal(nil, 'apple'.to_foorth_r)
49
- end
50
-
51
- def test_clone_patches
52
- s = "abc"
53
- assert_equal(s.object_id, s.safe_clone.object_id)
54
- assert_equal(s.object_id, s.full_clone.object_id)
55
-
56
- b = StringBuffer.new('abc')
57
- refute_equal(b.object_id, b.safe_clone.object_id)
58
- refute_equal(b.object_id, b.full_clone.object_id)
59
- end
60
-
61
- end
1
+ # coding: utf-8
2
+
3
+ require_relative '../../lib/fOOrth/monkey_patch/string'
4
+ gem 'minitest'
5
+ require 'minitest/autorun'
6
+ require 'minitest_visible'
7
+
8
+ #Test the monkey patches applied to the Object class.
9
+ class StringMonkeyPatchTester < Minitest::Test
10
+
11
+ #Track mini-test progress.
12
+ include MinitestVisible
13
+
14
+ #Test that it embeds
15
+ def test_foorth_embed
16
+ assert_equal("A big blue cat".foorth_embed, "\"A big blue cat\"")
17
+ assert_equal("The cat's toy".foorth_embed, "\"The cat's toy\"")
18
+ assert_equal('A dog\cat race'.foorth_embed, "\"A dog\\\\cat race\"")
19
+ assert_equal('A dog/cat race'.foorth_embed, "\"A dog/cat race\"")
20
+ end
21
+
22
+ #Test converting to a character.
23
+ def test_to_character
24
+ assert_equal('ABC'.to_foorth_c, 'A')
25
+ assert_equal('A'.to_foorth_c, 'A')
26
+ assert_nil(''.to_foorth_c)
27
+ end
28
+
29
+ #Test converting to a number.
30
+ def test_to_number
31
+ assert_equal('123'.to_foorth_n, 123)
32
+ assert_equal('123.4'.to_foorth_n, 123.4)
33
+ assert_equal('1/2'.to_foorth_n, '1/2'.to_r)
34
+ assert_equal('1+2i'.to_foorth_n, Complex(1,2))
35
+ assert_equal('2i'.to_foorth_n, Complex(0,2))
36
+ assert_equal('1-2i'.to_foorth_n, Complex(1,-2))
37
+ assert_equal('-2i'.to_foorth_n, Complex(0,-2))
38
+ assert_equal('+1+2i'.to_foorth_n, Complex(1,2))
39
+ assert_equal('+2i'.to_foorth_n, Complex(0,2))
40
+ assert_equal('+1-2i'.to_foorth_n, Complex(1,-2))
41
+
42
+ assert_nil('fubar'.to_foorth_n)
43
+ assert_nil('2cats'.to_foorth_n)
44
+ end
45
+
46
+ def test_to_rational
47
+ assert_equal(Rational(1,2), '1/2'.to_foorth_r)
48
+ assert_nil('apple'.to_foorth_r)
49
+ end
50
+
51
+ def test_clone_patches
52
+ s = "abc"
53
+ assert_equal(s.object_id, s.safe_clone.object_id)
54
+ assert_equal(s.object_id, s.full_clone.object_id)
55
+
56
+ b = StringBuffer.new('abc')
57
+ refute_equal(b.object_id, b.safe_clone.object_id)
58
+ refute_equal(b.object_id, b.full_clone.object_id)
59
+ end
60
+
61
+ end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fOOrth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.6
4
+ version: 0.6.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Camilleri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-16 00:00:00.000000000 Z
11
+ date: 2021-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.3'
19
+ version: 2.1.0
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.3'
26
+ version: 2.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 12.3.3
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 12.3.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: reek
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - ">="
172
172
  - !ruby/object:Gem::Version
173
- version: 0.4.8
173
+ version: 0.8.0
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
- version: 0.4.8
180
+ version: 0.8.0
181
181
  description: An Object Oriented FORTHesque language gem.
182
182
  email: peter.c.camilleri@gmail.com
183
183
  executables:
@@ -187,6 +187,7 @@ extra_rdoc_files: []
187
187
  files:
188
188
  - ".gitignore"
189
189
  - ".rdoc_options"
190
+ - CODE_OF_CONDUCT.md
190
191
  - Gemfile
191
192
  - README.md
192
193
  - bin/fOOrth
@@ -266,6 +267,7 @@ files:
266
267
  - lib/fOOrth/interpreter/do_loop.rb
267
268
  - lib/fOOrth/interpreter/squash.rb
268
269
  - lib/fOOrth/library.rb
270
+ - lib/fOOrth/library/alias_library.rb
269
271
  - lib/fOOrth/library/array_library.rb
270
272
  - lib/fOOrth/library/bundle_library.rb
271
273
  - lib/fOOrth/library/class_library.rb
@@ -281,8 +283,14 @@ files:
281
283
  - lib/fOOrth/library/duration/make.rb
282
284
  - lib/fOOrth/library/duration_library.rb
283
285
  - lib/fOOrth/library/fiber_library.rb
286
+ - lib/fOOrth/library/float_library.rb
287
+ - lib/fOOrth/library/formatting/array.rb
284
288
  - lib/fOOrth/library/formatting/bullets.rb
285
289
  - lib/fOOrth/library/formatting/columns.rb
290
+ - lib/fOOrth/library/formatting/hash.rb
291
+ - lib/fOOrth/library/formatting/nil.rb
292
+ - lib/fOOrth/library/formatting/object.rb
293
+ - lib/fOOrth/library/formatting/string.rb
286
294
  - lib/fOOrth/library/hash_library.rb
287
295
  - lib/fOOrth/library/in_stream_library.rb
288
296
  - lib/fOOrth/library/integer_library.rb
@@ -306,6 +314,7 @@ files:
306
314
  - lib/fOOrth/library/stdio_library.rb
307
315
  - lib/fOOrth/library/string_library.rb
308
316
  - lib/fOOrth/library/stubs.rb
317
+ - lib/fOOrth/library/stubs_library.rb
309
318
  - lib/fOOrth/library/sync_bundle_library.rb
310
319
  - lib/fOOrth/library/thread_library.rb
311
320
  - lib/fOOrth/library/time_library.rb
@@ -368,8 +377,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
368
377
  - !ruby/object:Gem::Version
369
378
  version: '0'
370
379
  requirements: []
371
- rubyforge_project:
372
- rubygems_version: 2.2.2
380
+ rubygems_version: 3.2.17
373
381
  signing_key:
374
382
  specification_version: 4
375
383
  summary: FNF == fOOrth is Not FORTH.
@@ -420,4 +428,3 @@ test_files:
420
428
  - tests/monkey_patch/rational_test.rb
421
429
  - tests/monkey_patch/string_test.rb
422
430
  - tests/symbol_map_tests.rb
423
- has_rdoc: