fOOrth 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fOOrth.gemspec +3 -3
- data/fOOrth.reek +3 -0
- data/integration/ctrl_struct_lib_tests.rb +5 -0
- data/integration/procedure_lib_tests.rb +6 -0
- data/lib/fOOrth/compiler/parser/get_string.rb +2 -0
- data/lib/fOOrth/compiler/process/procedure.rb +7 -0
- data/lib/fOOrth/debug/display_abort.rb +2 -0
- data/lib/fOOrth/library/bundle_library.rb +4 -2
- data/lib/fOOrth/library/compile_library.rb +2 -2
- data/lib/fOOrth/library/fiber_library.rb +6 -2
- data/lib/fOOrth/main.rb +1 -1
- data/lib/fOOrth/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 502a7d2b2dfe43bf05201bc914979cf32c96ae73
|
4
|
+
data.tar.gz: 80ad45ad7d24f94d9c654acbe83f037cb2f3d7b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce4e1c6e91bf9d9242baa5961b49b6f10b42dbe3a5f42a599ab91c001540d50b2cb2a07ad5948bf9cc0e6c1632d00e2d38acbed4e5edd2874ce673e7c2ab2528
|
7
|
+
data.tar.gz: 9ec27e5d29827a055a733b476b9d7b3876a60fa1052a5404d8da2f39d881ea2ed0ff19d2951a00a5cab4c15b6f3c1b03b48d388f9dd32f984cde6793457be5ba
|
data/fOOrth.gemspec
CHANGED
@@ -28,13 +28,13 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency 'rake'
|
29
29
|
spec.add_development_dependency 'reek', "~> 3.0"
|
30
30
|
spec.add_development_dependency 'minitest', "~> 5.7"
|
31
|
-
spec.add_development_dependency 'minitest_visible', ">= 0.1.
|
31
|
+
spec.add_development_dependency 'minitest_visible', ">= 0.1.1"
|
32
32
|
spec.add_development_dependency 'rdoc', "~> 4.0.1"
|
33
33
|
|
34
34
|
spec.add_runtime_dependency 'ruby_sscanf', ">= 0.2.0"
|
35
|
-
spec.add_runtime_dependency 'format_engine', ">= 0.7.
|
35
|
+
spec.add_runtime_dependency 'format_engine', ">= 0.7.2"
|
36
36
|
spec.add_runtime_dependency 'full_clone'
|
37
37
|
spec.add_runtime_dependency 'safe_clone'
|
38
38
|
spec.add_runtime_dependency 'in_array'
|
39
|
-
spec.add_runtime_dependency 'mini_readline', ">= 0.
|
39
|
+
spec.add_runtime_dependency 'mini_readline', ">= 0.4.2"
|
40
40
|
end
|
data/fOOrth.reek
CHANGED
@@ -68,6 +68,11 @@ class CtrlStructLibraryTester < Minitest::Test
|
|
68
68
|
|
69
69
|
foorth_run(': twc01 4 .with{{ self 2* }} ;')
|
70
70
|
foorth_equal('twc01', [8])
|
71
|
+
|
72
|
+
foorth_equal('42 .with{{ self }}', [42])
|
73
|
+
foorth_equal('42 .with{{ [ 0 ] .each{{ self }} }}', [42])
|
74
|
+
foorth_equal('42 .with{{ 0 1 do self loop }}', [42])
|
75
|
+
foorth_equal('42 .with{{ {{ self }} .call }}', [42])
|
71
76
|
end
|
72
77
|
|
73
78
|
def test_for_unsupported_structures
|
@@ -37,4 +37,10 @@ class ProcedureLibraryTester < Minitest::Test
|
|
37
37
|
|
38
38
|
foorth_equal('5 4 {{ v x 2dup + }} .call_vx', [5, 4, 9])
|
39
39
|
end
|
40
|
+
|
41
|
+
def test_local_data
|
42
|
+
foorth_equal('{{ 42 val: a a }} .call', [42])
|
43
|
+
foorth_equal('{{ 42 var: a a @ }} .call', [42])
|
44
|
+
end
|
45
|
+
|
40
46
|
end
|
@@ -35,8 +35,15 @@ module XfOOrth
|
|
35
35
|
#Handle the opening of a procedure literal.
|
36
36
|
def open_procedure_literal
|
37
37
|
suspend_execute_mode("vm.push(lambda {|vm, val=nil, idx=nil| ", :procedure)
|
38
|
+
|
39
|
+
#Support for the standard procedure parameters.
|
38
40
|
context.create_local_method('v', MacroSpec, [:macro, "vm.push(val); "])
|
39
41
|
context.create_local_method('x', MacroSpec, [:macro, "vm.push(idx); "])
|
42
|
+
|
43
|
+
#Support for local data.
|
44
|
+
context.create_local_method('var:', LocalSpec, [:immediate], &Local_Var_Action)
|
45
|
+
context.create_local_method('val:', LocalSpec, [:immediate], &Local_Val_Action)
|
46
|
+
|
40
47
|
context.create_local_method('}}', MacroSpec, [:macro, :end, "}); "])
|
41
48
|
end
|
42
49
|
|
@@ -11,7 +11,7 @@ module XfOOrth
|
|
11
11
|
|
12
12
|
#Build up the bundle instance
|
13
13
|
def initialize(fibers=[])
|
14
|
-
@fibers = fibers.in_array.map {|
|
14
|
+
@fibers = fibers.in_array.map {|fiber| fiber.to_foorth_fiber}
|
15
15
|
@current = 0
|
16
16
|
rescue NoMethodError
|
17
17
|
error "F70: A bundle may only contain procedures, fibers, or bundles."
|
@@ -19,7 +19,7 @@ module XfOOrth
|
|
19
19
|
|
20
20
|
#Add the fibers to this bundle.
|
21
21
|
def add_fibers(fibers)
|
22
|
-
fibers.in_array.each {|
|
22
|
+
fibers.in_array.each {|fiber| @fibers << fiber.to_foorth_fiber}
|
23
23
|
rescue NoMethodError
|
24
24
|
error "F70: A bundle may only contain procedures, fibers, or bundles."
|
25
25
|
end
|
@@ -40,6 +40,8 @@ module XfOOrth
|
|
40
40
|
end
|
41
41
|
|
42
42
|
#Let the fiber run for one step
|
43
|
+
#<br>Endemic Code Smells
|
44
|
+
#* :reek:DuplicateMethodCall
|
43
45
|
def step(vm)
|
44
46
|
if @current < @fibers.length
|
45
47
|
if @fibers[@current].step(vm)
|
@@ -108,11 +108,11 @@ module XfOOrth
|
|
108
108
|
def self.add_common_compiler_locals(vm, ctrl)
|
109
109
|
context = vm.context
|
110
110
|
|
111
|
-
#Support for local
|
111
|
+
#Support for local data.
|
112
112
|
context.create_local_method('var:', LocalSpec, [:immediate], &Local_Var_Action)
|
113
113
|
context.create_local_method('val:', LocalSpec, [:immediate], &Local_Val_Action)
|
114
114
|
|
115
|
-
#Support for instance
|
115
|
+
#Support for instance data.
|
116
116
|
context.create_local_method('var@:', LocalSpec, [:immediate], &Inst_Var_Action)
|
117
117
|
context.create_local_method('val@:', LocalSpec, [:immediate], &Inst_Val_Action)
|
118
118
|
|
@@ -19,8 +19,8 @@ module XfOOrth
|
|
19
19
|
DEAD = "dead".freeze
|
20
20
|
|
21
21
|
#Build up the fiber instance. A fiber is a light-weight coroutine.
|
22
|
-
def initialize(
|
23
|
-
@stack =
|
22
|
+
def initialize(&block)
|
23
|
+
@stack = []
|
24
24
|
@fiber = Fiber.new &lambda{|vm| block.call(vm); nil}
|
25
25
|
@status = NEW
|
26
26
|
end
|
@@ -36,6 +36,8 @@ module XfOOrth
|
|
36
36
|
end
|
37
37
|
|
38
38
|
#Let the fiber run for one step.
|
39
|
+
#<br>Endemic Code Smells
|
40
|
+
#* :reek:DuplicateMethodCall
|
39
41
|
def step(vm)
|
40
42
|
vm.data_stack, vm.fiber, @save = @stack, self, vm.data_stack
|
41
43
|
@status = @fiber.resume(vm)
|
@@ -46,6 +48,8 @@ module XfOOrth
|
|
46
48
|
end
|
47
49
|
|
48
50
|
#Yield back to the thread.
|
51
|
+
#<br>Endemic Code Smells
|
52
|
+
#* :reek:UtilityFunction
|
49
53
|
def yield
|
50
54
|
Fiber.yield(ALIVE)
|
51
55
|
end
|
data/lib/fOOrth/main.rb
CHANGED
data/lib/fOOrth/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fOOrth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
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-03-
|
11
|
+
date: 2016-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.1.
|
75
|
+
version: 0.1.1
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.1.
|
82
|
+
version: 0.1.1
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rdoc
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.7.
|
117
|
+
version: 0.7.2
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.7.
|
124
|
+
version: 0.7.2
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: full_clone
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,14 +170,14 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - ">="
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: 0.
|
173
|
+
version: 0.4.2
|
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.
|
180
|
+
version: 0.4.2
|
181
181
|
description: An Object Oriented FORTHesque language gem.
|
182
182
|
email: peter.c.camilleri@gmail.com
|
183
183
|
executables:
|