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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 017935fd5de0aa99dd253192f27aa7b8eed5c44d
4
- data.tar.gz: bd17a2cc1e29f0a6580d65352a0c777fa3061b8d
3
+ metadata.gz: 502a7d2b2dfe43bf05201bc914979cf32c96ae73
4
+ data.tar.gz: 80ad45ad7d24f94d9c654acbe83f037cb2f3d7b1
5
5
  SHA512:
6
- metadata.gz: 29b76d8377052fefcbb828d7d8b3064047d5cff2bc42c26393f422d155473988ccac810920abda799ff36ef55ac9c530e6847c946299a4a2389960bc6d875ed4
7
- data.tar.gz: 693816d9ee22cc7743bdef76835d5eb072a014bd85edbdbd2f50f01123b3603a8c70670574b452a771aa37fcc48fb3c17d9c750085421890e6f1ffeb5a6b0eb6
6
+ metadata.gz: ce4e1c6e91bf9d9242baa5961b49b6f10b42dbe3a5f42a599ab91c001540d50b2cb2a07ad5948bf9cc0e6c1632d00e2d38acbed4e5edd2874ce673e7c2ab2528
7
+ data.tar.gz: 9ec27e5d29827a055a733b476b9d7b3876a60fa1052a5404d8da2f39d881ea2ed0ff19d2951a00a5cab4c15b6f3c1b03b48d388f9dd32f984cde6793457be5ba
@@ -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.0"
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.0"
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.3.3"
39
+ spec.add_runtime_dependency 'mini_readline', ">= 0.4.2"
40
40
  end
@@ -107,3 +107,6 @@ UtilityFunction:
107
107
  enabled: true
108
108
  exclude: []
109
109
  max_helper_calls: 1
110
+ UnusedPrivateMethod:
111
+ enabled: false
112
+ exclude: []
@@ -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
@@ -27,6 +27,8 @@ module XfOOrth
27
27
  end
28
28
 
29
29
  #Process a backlash character found with a string in the source text.
30
+ #<br>Endemic Code Smells
31
+ #* :reek:TooManyStatements
30
32
  def process_backslash(buffer)
31
33
  next_char = @source.get
32
34
 
@@ -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
 
@@ -4,6 +4,8 @@
4
4
  module XfOOrth
5
5
 
6
6
  #* debug/display_abort.rb - Display diagnostic information on an error.
7
+ #<br>Endemic Code Smells
8
+ #* :reek:TooManyStatements
7
9
  class VirtualMachine
8
10
 
9
11
  #Display the diagnostic data required for a language abort error.
@@ -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 {|f| f.to_foorth_fiber}
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 {|f| @fibers << f.to_foorth_fiber}
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 variables.
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 variables.
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(stack=[], &block)
23
- @stack = 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
@@ -93,7 +93,7 @@ module XfOOrth
93
93
  when "--show"
94
94
  defer << ")show "
95
95
  when "--load"
96
- defer << "\"#{arg}\" .load "
96
+ defer << ")load#{arg.inspect}"
97
97
  when "--quit"
98
98
  defer << ")quit "
99
99
  when "--words"
@@ -3,5 +3,5 @@
3
3
  #* version.rb - The version string for fOOrth.
4
4
  module XfOOrth
5
5
  #The version string for fOOrth.
6
- VERSION = "0.5.1"
6
+ VERSION = "0.5.2"
7
7
  end
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.1
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-22 00:00:00.000000000 Z
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.0
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.0
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.0
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.0
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.3.3
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.3.3
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: