skeem 0.2.21 → 0.2.22

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.
@@ -25,7 +25,7 @@ module Skeem
25
25
  # @return [Integer] Offset of start of current line
26
26
  attr_reader(:line_start)
27
27
 
28
- @@lexeme2name = {
28
+ Lexeme2name = {
29
29
  "'" => 'APOSTROPHE',
30
30
  '=>' => 'ARROW',
31
31
  '`' => 'GRAVE_ACCENT',
@@ -40,7 +40,7 @@ module Skeem
40
40
  }.freeze
41
41
 
42
42
  # Here are all the implemented Scheme keywords (in uppercase)
43
- @@keywords = %w[
43
+ Keywords = %w[
44
44
  BEGIN
45
45
  COND
46
46
  DEFINE
@@ -66,11 +66,11 @@ module Skeem
66
66
  # @param source [String] Skeem text to tokenize.
67
67
  def initialize(source)
68
68
  @scanner = StringScanner.new('')
69
- reinitialize(source)
69
+ reset(source)
70
70
  end
71
71
 
72
72
  # @param source [String] Skeem text to tokenize.
73
- def reinitialize(source)
73
+ def reset(source)
74
74
  @scanner.string = source
75
75
  @lineno = 1
76
76
  @line_start = 0
@@ -84,7 +84,7 @@ module Skeem
84
84
  tok_sequence << token unless token.nil?
85
85
  end
86
86
 
87
- return tok_sequence
87
+ tok_sequence
88
88
  end
89
89
 
90
90
  private
@@ -100,11 +100,11 @@ module Skeem
100
100
 
101
101
  if "()'`".include? curr_ch
102
102
  # Delimiters, separators => single character token
103
- token = build_token(@@lexeme2name[curr_ch], scanner.getch)
103
+ token = build_token(Lexeme2name[curr_ch], scanner.getch)
104
104
  elsif (lexeme = scanner.scan(/(?:\.|_)(?=\s|\()/)) # Single char occurring alone
105
- token = build_token(@@lexeme2name[curr_ch], scanner.getch)
105
+ token = build_token(Lexeme2name[curr_ch], scanner.getch)
106
106
  elsif (lexeme = scanner.scan(/(?:,@?)|(?:=>)|(?:\.\.\.)/))
107
- token = build_token(@@lexeme2name[lexeme], lexeme)
107
+ token = build_token(Lexeme2name[lexeme], lexeme)
108
108
  elsif (token = recognize_char_token)
109
109
  # Do nothing
110
110
  elsif (lexeme = scanner.scan(/[+-]?[0-9]+\/[0-9]+(?=\s|[|()";]|$)/))
@@ -121,7 +121,7 @@ module Skeem
121
121
  elsif (lexeme = scanner.scan(/"(?:\\"|[^"])*"/)) # Double quotes literal?
122
122
  token = build_token('STRING_LIT', lexeme)
123
123
  elsif (lexeme = scanner.scan(/[a-zA-Z!$%&*\/:<=>?@^_~][a-zA-Z0-9!$%&*+-.\/:<=>?@^_~+-]*/))
124
- keyw = @@keywords[lexeme.upcase]
124
+ keyw = Keywords[lexeme.upcase]
125
125
  tok_type = keyw || 'IDENTIFIER'
126
126
  token = build_token(tok_type, lexeme)
127
127
  elsif (lexeme = scanner.scan(/\|(?:[^|])*\|/)) # Vertical bar delimited
@@ -142,7 +142,7 @@ module Skeem
142
142
  raise ScanError, "Unknown token #{erroneous} on line #{lineno}"
143
143
  end
144
144
 
145
- return token
145
+ token
146
146
  end
147
147
 
148
148
  # rubocop: enable Lint/DuplicateBranch
@@ -160,15 +160,15 @@ other literal data (section 2.4).
160
160
  when /^#true|false|t|f$/
161
161
  token = build_token('BOOLEAN', aLexeme)
162
162
  when '#('
163
- token = build_token(@@lexeme2name[aLexeme], aLexeme)
163
+ token = build_token(Lexeme2name[aLexeme], aLexeme)
164
164
  end
165
165
 
166
- return token
166
+ token
167
167
  end
168
168
 
169
169
  def recognize_char_token
170
170
  token = nil
171
- if (lexeme = scanner.scan(/#\\/))
171
+ if (lexeme = scanner.scan("#\\"))
172
172
  if (lexeme = scanner.scan(/(?:alarm|backspace|delete|escape|newline|null|return|space|tab)/))
173
173
  token = build_token('CHAR', lexeme, :name)
174
174
  elsif (lexeme = scanner.scan(/x[0-9a-fA-F]+/))
@@ -193,7 +193,7 @@ other literal data (section 2.4).
193
193
  raise e
194
194
  end
195
195
 
196
- return token
196
+ token
197
197
  end
198
198
 
199
199
  def convert_to(aLexeme, aSymbolName, aFormat)
@@ -218,7 +218,7 @@ other literal data (section 2.4).
218
218
  value = aLexeme
219
219
  end
220
220
 
221
- return [value, symb]
221
+ [value, symb]
222
222
  end
223
223
 
224
224
  def to_boolean(aLexeme, _format)
@@ -333,8 +333,6 @@ other literal data (section 2.4).
333
333
  end
334
334
 
335
335
  def skip_intertoken_spaces
336
- pre_pos = scanner.pos
337
-
338
336
  loop do
339
337
  ws_found = scanner.skip(/[ \t\f]+/) ? true : false
340
338
  nl_found = scanner.skip(/(?:\r\n)|\r|\n/)
@@ -354,9 +352,6 @@ other literal data (section 2.4).
354
352
  end
355
353
  break unless ws_found || cmt_found
356
354
  end
357
-
358
- curr_pos = scanner.pos
359
- return if curr_pos == pre_pos
360
355
  end
361
356
 
362
357
  def skip_block_comment
data/lib/skeem/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Skeem
4
- VERSION = '0.2.21'
4
+ VERSION = '0.2.22'
5
5
  end
data/lib/skeem.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  # This file acts as a jumping-off point for loading dependencies expected
5
5
  # for a Skeem client.
6
6
 
7
- require_relative './skeem/version'
8
- require_relative './skeem/interpreter'
7
+ require_relative 'skeem/version'
8
+ require_relative 'skeem/interpreter'
9
9
 
10
10
  # End of file
data/skeem.gemspec CHANGED
@@ -54,7 +54,8 @@ DESCR
54
54
  SUMMARY
55
55
  spec.homepage = 'https://github.com/famished-tiger/Skeem'
56
56
  spec.license = 'MIT'
57
- spec.required_ruby_version = '>= 2.6.0'
57
+ spec.required_ruby_version = '>= 3.1.0'
58
+ spec.metadata = { 'rubygems_mfa_required' => 'true' }
58
59
 
59
60
  spec.bindir = 'bin'
60
61
  spec.executables << 'skeem'
@@ -62,10 +63,12 @@ SUMMARY
62
63
  PkgExtending.pkg_files(spec)
63
64
  PkgExtending.pkg_documentation(spec)
64
65
  # Runtime dependencies
65
- spec.add_dependency 'rley', '~> 0.8.11'
66
+ spec.add_dependency 'rley', '~> 0.9', '>= 0.9.02'
66
67
 
67
68
  # Development dependencies
68
- spec.add_development_dependency 'bundler', '~> 2.0'
69
- spec.add_development_dependency 'rake', '>= 12.0'
70
- spec.add_development_dependency 'rspec', '~> 3.0'
69
+ spec.add_development_dependency 'benchmark', '~> 0.4.0'
70
+ spec.add_development_dependency 'bundler', '~> 2.4', '>= 2.4.1'
71
+ spec.add_development_dependency 'ostruct', '~> 0.6.1'
72
+ spec.add_development_dependency 'rake', '~> 13'
73
+ spec.add_development_dependency 'rspec', '~> 3', '>= 3.10.0'
71
74
  end
@@ -8,9 +8,9 @@ require_relative '../../lib/skeem/datum_dsl'
8
8
 
9
9
  module Skeem
10
10
  describe DatumDSL do
11
- subject do
11
+ subject(:dsl) do
12
12
  obj = Object.new
13
- obj.extend(DatumDSL) # use the mixin module
13
+ obj.extend(described_class) # use the mixin module
14
14
  obj
15
15
  end
16
16
 
@@ -83,140 +83,140 @@ module Skeem
83
83
  end
84
84
 
85
85
  context 'Simple datums:' do
86
- it 'should convert boolean literals' do
86
+ it 'concerts boolean literals' do
87
87
  boolean_tests.each do |(literal, predicted)|
88
- expect(subject.boolean(literal)).to eq(predicted)
88
+ expect(dsl.boolean(literal)).to eq(predicted)
89
89
  end
90
90
  end
91
91
 
92
- it 'should convert integer literals' do
92
+ it 'concerts integer literals' do
93
93
  integer_tests.each do |(literal, predicted)|
94
- expect(subject.integer(literal)).to eq(predicted)
94
+ expect(dsl.integer(literal)).to eq(predicted)
95
95
  end
96
96
  end
97
97
 
98
- it 'should convert rational literals' do
98
+ it 'concerts rational literals' do
99
99
  rational_tests.each do |(literal, predicted)|
100
- expect(subject.rational(literal)).to eq(predicted)
100
+ expect(dsl.rational(literal)).to eq(predicted)
101
101
  end
102
102
  end
103
103
 
104
- it 'should convert real number literals' do
104
+ it 'concerts real number literals' do
105
105
  real_tests.each do |(literal, predicted)|
106
- expect(subject.real(literal)).to eq(predicted)
106
+ expect(dsl.real(literal)).to eq(predicted)
107
107
  end
108
108
  end
109
109
 
110
- it 'should convert string literals' do
110
+ it 'concerts string literals' do
111
111
  string_tests.each do |(literal, predicted)|
112
- expect(subject.string(literal)).to eq(predicted)
112
+ expect(dsl.string(literal)).to eq(predicted)
113
113
  end
114
114
  end
115
115
 
116
- it 'should convert identifier literals' do
116
+ it 'concerts identifier literals' do
117
117
  identifier_tests.each do |(literal, predicted)|
118
- expect(subject.identifier(literal)).to eq(predicted)
118
+ expect(dsl.identifier(literal)).to eq(predicted)
119
119
  end
120
120
  end
121
121
  end # context
122
122
 
123
123
 
124
124
  context 'Compound datums:' do
125
- it 'should convert empty array into one-member list' do
126
- result = subject.list([])
127
- expect(result).to be_kind_of(SkmEmptyList)
125
+ it 'concerts empty array into one-member list' do
126
+ result = dsl.list([])
127
+ expect(result).to be_a(SkmEmptyList)
128
128
  expect(result).to be_null
129
129
  end
130
130
 
131
- it 'should convert array of simple datums into list' do
131
+ it 'concerts array of simple datums into list' do
132
132
  literals = simple_datum_tests.map { |(datum, _predicted)| datum }
133
133
  predictions = simple_datum_tests.map { |(_datum, predicted)| predicted }
134
- list_result = subject.list(literals)
135
- expect(list_result).to be_kind_of(SkmPair)
134
+ list_result = dsl.list(literals)
135
+ expect(list_result).to be_a(SkmPair)
136
136
  list_result.to_a.each_with_index do |member, index|
137
137
  expect(member).to eq(predictions[index])
138
138
  end
139
139
  end
140
140
 
141
- it 'should convert a single datum into one-member list' do
142
- result = subject.list('123')
143
- expect(result).to be_kind_of(SkmPair)
141
+ it 'concerts a single datum into one-member list' do
142
+ result = dsl.list('123')
143
+ expect(result).to be_a(SkmPair)
144
144
  expect(result.car).to eq(123)
145
145
  end
146
146
 
147
- it 'should convert empty array into one-member list' do
148
- result = subject.vector([])
149
- expect(result).to be_kind_of(SkmVector)
147
+ it 'concerts empty array into one-member list' do
148
+ result = dsl.vector([])
149
+ expect(result).to be_a(SkmVector)
150
150
  expect(result.members).to be_empty
151
151
  end
152
152
 
153
153
 
154
- it 'should convert array of simple datums into vector' do
154
+ it 'concerts array of simple datums into vector' do
155
155
  literals = simple_datum_tests.map { |(datum, _predicted)| datum }
156
156
  predictions = simple_datum_tests.map { |(_datum, predicted)| predicted }
157
- vector_result = subject.vector(literals)
158
- expect(vector_result).to be_kind_of(SkmVector)
157
+ vector_result = dsl.vector(literals)
158
+ expect(vector_result).to be_a(SkmVector)
159
159
  vector_result.members.each_with_index do |member, index|
160
160
  expect(member).to eq(predictions[index])
161
161
  end
162
162
  end
163
163
 
164
- it 'should convert a single datum into one-member vector' do
165
- result = subject.vector('123')
166
- expect(result).to be_kind_of(SkmVector)
164
+ it 'concerts a single datum into one-member vector' do
165
+ result = dsl.vector('123')
166
+ expect(result).to be_a(SkmVector)
167
167
  expect(result.members.first).to eq(123)
168
168
  end
169
169
  end # context
170
170
 
171
171
  context 'Arbitrary datums:' do
172
- it 'should recognize & convert booleans' do
172
+ it 'recognizes & convert booleans' do
173
173
  boolean_tests.each do |(literal, predicted)|
174
- expect(subject.to_datum(literal)).to eq(predicted)
174
+ expect(dsl.to_datum(literal)).to eq(predicted)
175
175
  end
176
176
  end
177
177
 
178
- it 'should recognize & convert integer literals' do
178
+ it 'recognizes & convert integer literals' do
179
179
  integer_tests.each do |(literal, predicted)|
180
- expect(subject.to_datum(literal)).to eq(predicted)
180
+ expect(dsl.to_datum(literal)).to eq(predicted)
181
181
  end
182
182
  end
183
183
 
184
- it 'should recognize & convert rational literals' do
184
+ it 'recognizes & convert rational literals' do
185
185
  rational_tests.each do |(literal, predicted)|
186
- expect(subject.to_datum(literal)).to eq(predicted)
186
+ expect(dsl.to_datum(literal)).to eq(predicted)
187
187
  end
188
188
  end
189
189
 
190
- it 'should recognize & convert real number literals' do
190
+ it 'recognizes & convert real number literals' do
191
191
  real_tests.each do |(literal, predicted)|
192
- expect(subject.to_datum(literal)).to eq(predicted)
192
+ expect(dsl.to_datum(literal)).to eq(predicted)
193
193
  end
194
194
  end
195
195
 
196
- it 'should recognize & convert string literals' do
196
+ it 'recognizes & convert string literals' do
197
197
  string_tests.each do |(literal, predicted)|
198
- expect(subject.to_datum(literal)).to eq(predicted)
198
+ expect(dsl.to_datum(literal)).to eq(predicted)
199
199
  end
200
200
  end
201
201
 
202
- it 'should convert nested compound datums' do
202
+ it 'concerts nested compound datums' do
203
203
  literals = [
204
204
  'false', '123', '-1.41',
205
205
  'foo', SkmVector.new(['uno', '2', 3.0]), 'bar'
206
206
  ]
207
- result = subject.list(literals)
208
- expect(result).to be_kind_of(SkmPair)
207
+ result = dsl.list(literals)
208
+ expect(result).to be_a(SkmPair)
209
209
  expect(result.to_a).to eq([false, 123, -1.41, 'foo', ['uno', 2, 3], 'bar'])
210
210
  end
211
211
  end
212
212
 
213
- it 'should duplicate a given list' do
214
- f = subject.identifier('f')
215
- g = subject.identifier('g')
216
- one_list = subject.list([f, g])
213
+ it 'duplicates a given list' do
214
+ f = dsl.identifier('f')
215
+ g = dsl.identifier('g')
216
+ one_list = dsl.list([f, g])
217
217
  expect(one_list).to be_list
218
218
  expect(one_list.to_a).to eq([f, g])
219
- duplicate = subject.to_datum(one_list)
219
+ duplicate = dsl.to_datum(one_list)
220
220
  expect(duplicate).to be_list
221
221
  # $stderr.puts duplicate.inspect
222
222
  expect(duplicate.to_a).to eq([f, g])
@@ -19,19 +19,19 @@ module Skeem
19
19
  end
20
20
 
21
21
  # Default instantiation rule
22
- subject { SkmElementVisitor.new(simple_datum) }
22
+ subject(:visitor) { described_class.new(simple_datum) }
23
23
 
24
24
  context 'Standard creation & initialization:' do
25
- it 'should be initialized with a parse tree argument' do
26
- expect { SkmElementVisitor.new(simple_datum) }.not_to raise_error
25
+ it 'is initialized with a parse tree argument' do
26
+ expect { described_class.new(simple_datum) }.not_to raise_error
27
27
  end
28
28
 
29
- it 'should know the parse tree to visit' do
30
- expect(subject.root).to eq(simple_datum)
29
+ it 'knows the parse tree to visit' do
30
+ expect(visitor.root).to eq(simple_datum)
31
31
  end
32
32
 
33
- it "shouldn't have subscribers at start" do
34
- expect(subject.subscribers).to be_empty
33
+ it "doesn't have subscribers at start" do
34
+ expect(visitor.subscribers).to be_empty
35
35
  end
36
36
  end # context
37
37
 
@@ -39,137 +39,137 @@ module Skeem
39
39
  let(:listener1) { double('fake-subscriber1') }
40
40
  let(:listener2) { double('fake-subscriber2') }
41
41
 
42
- it 'should allow subscriptions' do
43
- subject.subscribe(listener1)
44
- expect(subject.subscribers.size).to eq(1)
45
- expect(subject.subscribers).to eq([listener1])
42
+ it 'allows subscriptions' do
43
+ visitor.subscribe(listener1)
44
+ expect(visitor.subscribers.size).to eq(1)
45
+ expect(visitor.subscribers).to eq([listener1])
46
46
 
47
- subject.subscribe(listener2)
48
- expect(subject.subscribers.size).to eq(2)
49
- expect(subject.subscribers).to eq([listener1, listener2])
47
+ visitor.subscribe(listener2)
48
+ expect(visitor.subscribers.size).to eq(2)
49
+ expect(visitor.subscribers).to eq([listener1, listener2])
50
50
  end
51
51
 
52
- it 'should allow un-subcriptions' do
53
- subject.subscribe(listener1)
54
- subject.subscribe(listener2)
55
- subject.unsubscribe(listener2)
56
- expect(subject.subscribers.size).to eq(1)
57
- expect(subject.subscribers).to eq([listener1])
58
- subject.unsubscribe(listener1)
59
- expect(subject.subscribers).to be_empty
52
+ it 'allows un-subcriptions' do
53
+ visitor.subscribe(listener1)
54
+ visitor.subscribe(listener2)
55
+ visitor.unsubscribe(listener2)
56
+ expect(visitor.subscribers.size).to eq(1)
57
+ expect(visitor.subscribers).to eq([listener1])
58
+ visitor.unsubscribe(listener1)
59
+ expect(visitor.subscribers).to be_empty
60
60
  end
61
61
  end # context
62
62
 
63
63
  context 'Visiting simple datum:' do
64
64
  let(:runtime) { double('fake-runtime') }
65
65
 
66
- it 'should allow the visit of simple datum object' do
67
- subject.subscribe(listener)
68
- expect(listener).to receive(:before_simple_datum).with(runtime, simple_datum)
69
- expect(listener).to receive(:after_simple_datum).with(runtime, simple_datum)
70
- subject.start(runtime)
71
- expect(subject.runtime).to eq(runtime)
66
+ it 'allows the visit of simple datum object' do
67
+ visitor.subscribe(listener)
68
+ allow(listener).to receive(:before_simple_datum).with(runtime, simple_datum)
69
+ allow(listener).to receive(:after_simple_datum).with(runtime, simple_datum)
70
+ visitor.start(runtime)
71
+ expect(visitor.runtime).to eq(runtime)
72
72
  end
73
73
  end # context
74
74
 
75
75
  context 'Visiting compound datum:' do
76
76
  let(:runtime) { double('fake-runtime') }
77
77
 
78
- it 'should allow the visit of a flat list' do
78
+ it 'allows the visit of a flat list' do
79
79
  ls = list ['#false', 3, 'foo']
80
- instance = SkmElementVisitor.new(ls)
80
+ instance = described_class.new(ls)
81
81
  instance.subscribe(listener)
82
- expect(listener).to receive(:before_pair).with(runtime, ls).ordered
83
- expect(listener).to receive(:before_car).with(runtime, ls, ls.car).ordered
84
- expect(listener).to receive(:before_simple_datum).with(runtime, ls.car).ordered
85
- expect(listener).to receive(:after_simple_datum).with(runtime, ls.car).ordered
86
- expect(listener).to receive(:after_car).with(runtime, ls, ls.car).ordered
87
- expect(listener).to receive(:before_cdr).with(runtime, ls, ls.cdr).ordered
88
- expect(listener).to receive(:before_pair).with(runtime, ls.cdr).ordered
89
- expect(listener).to receive(:before_car).with(runtime, ls.cdr, ls.cdr.car).ordered
90
- expect(listener).to receive(:before_simple_datum).with(runtime, ls.cdr.car).ordered
91
- expect(listener).to receive(:after_simple_datum).with(runtime, ls.cdr.car).ordered
92
- expect(listener).to receive(:after_car).with(runtime, ls.cdr, ls.cdr.car).ordered
93
- expect(listener).to receive(:before_cdr).with(runtime, ls.cdr, ls.cdr.cdr).ordered
94
- expect(listener).to receive(:before_pair).with(runtime, ls.cdr.cdr).ordered
95
- expect(listener).to receive(:before_car).with(runtime, ls.cdr.cdr, ls.cdr.cdr.car).ordered
96
- expect(listener).to receive(:before_simple_datum).with(runtime, ls.cdr.cdr.car).ordered
97
- expect(listener).to receive(:after_simple_datum).with(runtime, ls.cdr.cdr.car).ordered
98
- expect(listener).to receive(:after_car).with(runtime, ls.cdr.cdr, ls.cdr.cdr.car).ordered
99
- expect(listener).to receive(:before_cdr).with(runtime, ls.cdr.cdr, ls.cdr.cdr.cdr).ordered
100
- expect(listener).to receive(:before_empty_list).with(runtime, ls.cdr.cdr.cdr).ordered
101
- expect(listener).to receive(:after_empty_list).with(runtime, ls.cdr.cdr.cdr).ordered
102
- expect(listener).to receive(:after_cdr).with(runtime, ls.cdr.cdr, ls.cdr.cdr.cdr).ordered
103
- expect(listener).to receive(:after_pair).with(runtime, ls.cdr.cdr).ordered
104
- expect(listener).to receive(:after_cdr).with(runtime, ls.cdr, ls.cdr.cdr).ordered
105
- expect(listener).to receive(:after_pair).with(runtime, ls.cdr).ordered
106
- expect(listener).to receive(:after_cdr).with(runtime, ls, ls.cdr).ordered
107
- expect(listener).to receive(:after_pair).with(runtime, ls).ordered
82
+ allow(listener).to receive(:before_pair).with(runtime, ls)
83
+ allow(listener).to receive(:before_car).with(runtime, ls, ls.car)
84
+ allow(listener).to receive(:before_simple_datum).with(runtime, ls.car)
85
+ allow(listener).to receive(:after_simple_datum).with(runtime, ls.car)
86
+ allow(listener).to receive(:after_car).with(runtime, ls, ls.car)
87
+ allow(listener).to receive(:before_cdr).with(runtime, ls, ls.cdr)
88
+ allow(listener).to receive(:before_pair).with(runtime, ls.cdr)
89
+ allow(listener).to receive(:before_car).with(runtime, ls.cdr, ls.cdr.car)
90
+ allow(listener).to receive(:before_simple_datum).with(runtime, ls.cdr.car)
91
+ allow(listener).to receive(:after_simple_datum).with(runtime, ls.cdr.car)
92
+ allow(listener).to receive(:after_car).with(runtime, ls.cdr, ls.cdr.car)
93
+ allow(listener).to receive(:before_cdr).with(runtime, ls.cdr, ls.cdr.cdr)
94
+ allow(listener).to receive(:before_pair).with(runtime, ls.cdr.cdr)
95
+ allow(listener).to receive(:before_car).with(runtime, ls.cdr.cdr, ls.cdr.cdr.car)
96
+ allow(listener).to receive(:before_simple_datum).with(runtime, ls.cdr.cdr.car)
97
+ allow(listener).to receive(:after_simple_datum).with(runtime, ls.cdr.cdr.car)
98
+ allow(listener).to receive(:after_car).with(runtime, ls.cdr.cdr, ls.cdr.cdr.car)
99
+ allow(listener).to receive(:before_cdr).with(runtime, ls.cdr.cdr, ls.cdr.cdr.cdr)
100
+ allow(listener).to receive(:before_empty_list).with(runtime, ls.cdr.cdr.cdr)
101
+ allow(listener).to receive(:after_empty_list).with(runtime, ls.cdr.cdr.cdr)
102
+ allow(listener).to receive(:after_cdr).with(runtime, ls.cdr.cdr, ls.cdr.cdr.cdr)
103
+ allow(listener).to receive(:after_pair).with(runtime, ls.cdr.cdr)
104
+ allow(listener).to receive(:after_cdr).with(runtime, ls.cdr, ls.cdr.cdr)
105
+ allow(listener).to receive(:after_pair).with(runtime, ls.cdr)
106
+ allow(listener).to receive(:after_cdr).with(runtime, ls, ls.cdr)
107
+ allow(listener).to receive(:after_pair).with(runtime, ls)
108
108
  instance.start(runtime)
109
109
  end
110
110
 
111
- it 'should allow the visit of a flat vector' do
111
+ it 'allows the visit of a flat vector' do
112
112
  vec = vector ['#false', 3, 'foo']
113
- instance = SkmElementVisitor.new(vec)
113
+ instance = described_class.new(vec)
114
114
  instance.subscribe(listener)
115
- expect(listener).to receive(:before_compound_datum).with(runtime, vec).ordered
116
- expect(listener).to receive(:before_children).with(runtime, vec, vec.members).ordered
117
- expect(listener).to receive(:before_simple_datum).with(runtime, vec.members[0]).ordered
118
- expect(listener).to receive(:after_simple_datum).with(runtime, vec.members[0]).ordered
119
- expect(listener).to receive(:before_simple_datum).with(runtime, vec.members[1]).ordered
120
- expect(listener).to receive(:after_simple_datum).with(runtime, vec.members[1]).ordered
121
- expect(listener).to receive(:before_simple_datum).with(runtime, vec.members[2]).ordered
122
- expect(listener).to receive(:after_simple_datum).with(runtime, vec.members[2]).ordered
123
- expect(listener).to receive(:after_children).with(runtime, vec, vec.members).ordered
124
- expect(listener).to receive(:after_compound_datum).with(runtime, vec).ordered
115
+ allow(listener).to receive(:before_compound_datum).with(runtime, vec)
116
+ allow(listener).to receive(:before_children).with(runtime, vec, vec.members)
117
+ allow(listener).to receive(:before_simple_datum).with(runtime, vec.members[0])
118
+ allow(listener).to receive(:after_simple_datum).with(runtime, vec.members[0])
119
+ allow(listener).to receive(:before_simple_datum).with(runtime, vec.members[1])
120
+ allow(listener).to receive(:after_simple_datum).with(runtime, vec.members[1])
121
+ allow(listener).to receive(:before_simple_datum).with(runtime, vec.members[2])
122
+ allow(listener).to receive(:after_simple_datum).with(runtime, vec.members[2])
123
+ allow(listener).to receive(:after_children).with(runtime, vec, vec.members)
124
+ allow(listener).to receive(:after_compound_datum).with(runtime, vec)
125
125
  instance.start(runtime)
126
126
  end
127
127
 
128
- it 'should allow the visit of a nested compound datum' do
128
+ it 'allows the visit of a nested compound datum' do
129
129
  nested_list = list %w[uno twei three']
130
130
  vec = vector ['#false', 3, nested_list, 'foo']
131
- instance = SkmElementVisitor.new(vec)
131
+ instance = described_class.new(vec)
132
132
  instance.subscribe(listener)
133
- expect(listener).to receive(:before_compound_datum).with(runtime, vec).ordered
134
- expect(listener).to receive(:before_children).with(runtime, vec, vec.members).ordered
135
- expect(listener).to receive(:before_simple_datum).with(runtime, vec.members[0]).ordered
136
- expect(listener).to receive(:after_simple_datum).with(runtime, vec.members[0]).ordered
137
- expect(listener).to receive(:before_simple_datum).with(runtime, vec.members[1]).ordered
138
- expect(listener).to receive(:after_simple_datum).with(runtime, vec.members[1]).ordered
139
-
140
- expect(listener).to receive(:before_pair).with(runtime, nested_list).ordered
141
- expect(listener).to receive(:before_car).with(runtime, nested_list, nested_list.car).ordered
133
+ allow(listener).to receive(:before_compound_datum).with(runtime, vec)
134
+ allow(listener).to receive(:before_children).with(runtime, vec, vec.members)
135
+ allow(listener).to receive(:before_simple_datum).with(runtime, vec.members[0])
136
+ allow(listener).to receive(:after_simple_datum).with(runtime, vec.members[0])
137
+ allow(listener).to receive(:before_simple_datum).with(runtime, vec.members[1])
138
+ allow(listener).to receive(:after_simple_datum).with(runtime, vec.members[1])
139
+
140
+ allow(listener).to receive(:before_pair).with(runtime, nested_list)
141
+ allow(listener).to receive(:before_car).with(runtime, nested_list, nested_list.car)
142
142
  expect(nested_list.car).to eq('uno')
143
- expect(listener).to receive(:before_simple_datum).with(runtime, nested_list.car).ordered
144
- expect(listener).to receive(:after_simple_datum).with(runtime, nested_list.car).ordered
145
- expect(listener).to receive(:after_car).with(runtime, nested_list, nested_list.car).ordered
146
- expect(listener).to receive(:before_cdr).with(runtime, nested_list, nested_list.cdr).ordered
147
- expect(listener).to receive(:before_pair).with(runtime, nested_list.cdr).ordered
148
- expect(listener).to receive(:before_car).with(runtime, nested_list.cdr, nested_list.cdr.car).ordered
149
- expect(listener).to receive(:before_simple_datum).with(runtime, nested_list.cdr.car).ordered
150
- expect(listener).to receive(:after_simple_datum).with(runtime, nested_list.cdr.car).ordered
151
- expect(listener).to receive(:after_car).with(runtime, nested_list.cdr, nested_list.cdr.car).ordered
152
- expect(listener).to receive(:before_cdr).with(runtime, nested_list.cdr, nested_list.cdr.cdr).ordered
153
- expect(listener).to receive(:before_pair).with(runtime, nested_list.cdr.cdr).ordered
154
- expect(listener).to receive(:before_car).with(runtime, nested_list.cdr.cdr, nested_list.cdr.cdr.car).ordered
155
- expect(listener).to receive(:before_simple_datum).with(runtime, nested_list.cdr.cdr.car).ordered
156
- expect(listener).to receive(:after_simple_datum).with(runtime, nested_list.cdr.cdr.car).ordered
157
- expect(listener).to receive(:after_car).with(runtime, nested_list.cdr.cdr, nested_list.cdr.cdr.car).ordered
158
- expect(listener).to receive(:before_cdr).with(runtime, nested_list.cdr.cdr, nested_list.cdr.cdr.cdr).ordered
159
- expect(listener).to receive(:before_empty_list).with(runtime, nested_list.cdr.cdr.cdr).ordered
160
- expect(listener).to receive(:after_empty_list).with(runtime, nested_list.cdr.cdr.cdr).ordered
161
- expect(listener).to receive(:after_cdr).with(runtime, nested_list.cdr.cdr, nested_list.cdr.cdr.cdr).ordered
162
- expect(listener).to receive(:after_pair).with(runtime, nested_list.cdr.cdr).ordered
163
- expect(listener).to receive(:after_cdr).with(runtime, nested_list.cdr, nested_list.cdr.cdr).ordered
164
- expect(listener).to receive(:after_pair).with(runtime, nested_list.cdr).ordered
165
- expect(listener).to receive(:after_cdr).with(runtime, nested_list, nested_list.cdr).ordered
166
- expect(listener).to receive(:after_pair).with(runtime, nested_list).ordered
167
- expect(listener).to receive(:before_simple_datum).with(runtime, vec.members[3]).ordered
168
- expect(listener).to receive(:after_simple_datum).with(runtime, vec.members[3]).ordered
169
- expect(listener).to receive(:after_children).with(runtime, vec, vec.members).ordered
170
- expect(listener).to receive(:after_compound_datum).with(runtime, vec).ordered
143
+ allow(listener).to receive(:before_simple_datum).with(runtime, nested_list.car)
144
+ allow(listener).to receive(:after_simple_datum).with(runtime, nested_list.car)
145
+ allow(listener).to receive(:after_car).with(runtime, nested_list, nested_list.car)
146
+ allow(listener).to receive(:before_cdr).with(runtime, nested_list, nested_list.cdr)
147
+ allow(listener).to receive(:before_pair).with(runtime, nested_list.cdr)
148
+ allow(listener).to receive(:before_car).with(runtime, nested_list.cdr, nested_list.cdr.car)
149
+ allow(listener).to receive(:before_simple_datum).with(runtime, nested_list.cdr.car)
150
+ allow(listener).to receive(:after_simple_datum).with(runtime, nested_list.cdr.car)
151
+ allow(listener).to receive(:after_car).with(runtime, nested_list.cdr, nested_list.cdr.car)
152
+ allow(listener).to receive(:before_cdr).with(runtime, nested_list.cdr, nested_list.cdr.cdr)
153
+ allow(listener).to receive(:before_pair).with(runtime, nested_list.cdr.cdr)
154
+ allow(listener).to receive(:before_car).with(runtime, nested_list.cdr.cdr, nested_list.cdr.cdr.car)
155
+ allow(listener).to receive(:before_simple_datum).with(runtime, nested_list.cdr.cdr.car)
156
+ allow(listener).to receive(:after_simple_datum).with(runtime, nested_list.cdr.cdr.car)
157
+ allow(listener).to receive(:after_car).with(runtime, nested_list.cdr.cdr, nested_list.cdr.cdr.car)
158
+ allow(listener).to receive(:before_cdr).with(runtime, nested_list.cdr.cdr, nested_list.cdr.cdr.cdr)
159
+ allow(listener).to receive(:before_empty_list).with(runtime, nested_list.cdr.cdr.cdr)
160
+ allow(listener).to receive(:after_empty_list).with(runtime, nested_list.cdr.cdr.cdr)
161
+ allow(listener).to receive(:after_cdr).with(runtime, nested_list.cdr.cdr, nested_list.cdr.cdr.cdr)
162
+ allow(listener).to receive(:after_pair).with(runtime, nested_list.cdr.cdr)
163
+ allow(listener).to receive(:after_cdr).with(runtime, nested_list.cdr, nested_list.cdr.cdr)
164
+ allow(listener).to receive(:after_pair).with(runtime, nested_list.cdr)
165
+ allow(listener).to receive(:after_cdr).with(runtime, nested_list, nested_list.cdr)
166
+ allow(listener).to receive(:after_pair).with(runtime, nested_list)
167
+ allow(listener).to receive(:before_simple_datum).with(runtime, vec.members[3])
168
+ allow(listener).to receive(:after_simple_datum).with(runtime, vec.members[3])
169
+ allow(listener).to receive(:after_children).with(runtime, vec, vec.members)
170
+ allow(listener).to receive(:after_compound_datum).with(runtime, vec)
171
171
  instance.start(runtime)
172
172
  end
173
173
  end # context
174
174
  end # describe
175
- end # module
175
+ end # modulecls