skeem 0.2.15 → 0.2.19
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +451 -195
- data/.travis.yml +27 -0
- data/CHANGELOG.md +26 -0
- data/Gemfile +2 -0
- data/README.md +3 -2
- data/Rakefile +2 -0
- data/appveyor.yml +3 -4
- data/bin/skeem +15 -15
- data/lib/skeem/datum_dsl.rb +40 -30
- data/lib/skeem/element_visitor.rb +5 -2
- data/lib/skeem/grammar.rb +77 -54
- data/lib/skeem/interpreter.rb +9 -7
- data/lib/skeem/parser.rb +6 -4
- data/lib/skeem/primitive/primitive_builder.rb +130 -122
- data/lib/skeem/primitive/primitive_procedure.rb +23 -25
- data/lib/skeem/runtime.rb +17 -15
- data/lib/skeem/s_expr_builder.rb +39 -147
- data/lib/skeem/s_expr_nodes.rb +147 -132
- data/lib/skeem/skeem_exception.rb +1 -0
- data/lib/skeem/skm_binding.rb +9 -11
- data/lib/skeem/skm_compound_datum.rb +9 -6
- data/lib/skeem/skm_element.rb +15 -13
- data/lib/skeem/skm_empty_list.rb +6 -4
- data/lib/skeem/skm_exception.rb +9 -0
- data/lib/skeem/skm_expression.rb +3 -1
- data/lib/skeem/skm_frame.rb +3 -2
- data/lib/skeem/skm_pair.rb +26 -18
- data/lib/skeem/skm_procedure_exec.rb +11 -6
- data/lib/skeem/skm_simple_datum.rb +23 -20
- data/lib/skeem/skm_unary_expression.rb +34 -37
- data/lib/skeem/tokenizer.rb +40 -30
- data/lib/skeem/version.rb +3 -1
- data/lib/skeem.rb +2 -0
- data/skeem.gemspec +7 -5
- data/spec/skeem/add4.skm +4 -0
- data/spec/skeem/datum_dsl_spec.rb +13 -12
- data/spec/skeem/element_visitor_spec.rb +14 -10
- data/spec/skeem/interpreter_spec.rb +76 -46
- data/spec/skeem/lambda_spec.rb +13 -11
- data/spec/skeem/parser_spec.rb +23 -19
- data/spec/skeem/primitive/primitive_builder_spec.rb +55 -46
- data/spec/skeem/primitive/primitive_procedure_spec.rb +14 -12
- data/spec/skeem/runtime_spec.rb +20 -18
- data/spec/skeem/s_expr_nodes_spec.rb +8 -6
- data/spec/skeem/skm_compound_datum_spec.rb +12 -10
- data/spec/skeem/skm_element_spec.rb +7 -5
- data/spec/skeem/skm_empty_list_spec.rb +7 -5
- data/spec/skeem/skm_frame_spec.rb +5 -4
- data/spec/skeem/skm_pair_spec.rb +9 -8
- data/spec/skeem/skm_procedure_exec_spec.rb +2 -0
- data/spec/skeem/skm_simple_datum_spec.rb +24 -22
- data/spec/skeem/skm_unary_expression_spec.rb +11 -9
- data/spec/skeem/tokenizer_spec.rb +54 -43
- data/spec/skeem_spec.rb +2 -0
- data/spec/spec_helper.rb +15 -10
- metadata +13 -9
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative '../s_expr_nodes'
|
2
4
|
|
3
5
|
module Skeem
|
@@ -17,7 +19,7 @@ module Skeem
|
|
17
19
|
def callable?
|
18
20
|
true
|
19
21
|
end
|
20
|
-
|
22
|
+
|
21
23
|
def procedure?
|
22
24
|
true
|
23
25
|
end
|
@@ -40,10 +42,11 @@ module Skeem
|
|
40
42
|
check_actual_count(actuals)
|
41
43
|
# TODO: check that next line became useless
|
42
44
|
# aProcedureCall.operands_consumed = true
|
43
|
-
result = do_call(aRuntime, actuals)
|
45
|
+
# result = do_call(aRuntime, actuals)
|
44
46
|
# $stderr.puts " Result: #{result.inspect}"
|
45
47
|
# $stderr.puts "--- End of procedure #{identifier}"
|
46
|
-
result
|
48
|
+
# result
|
49
|
+
do_call(aRuntime, actuals)
|
47
50
|
end
|
48
51
|
|
49
52
|
def skm_equal?(other)
|
@@ -76,10 +79,8 @@ module Skeem
|
|
76
79
|
if (anArity.low + 2) != count_param
|
77
80
|
discrepancy_arity_argument_count(anArity.low, count_param, 2)
|
78
81
|
end
|
79
|
-
|
80
|
-
|
81
|
-
discrepancy_arity_argument_count(anArity.high, count_param, 1)
|
82
|
-
end
|
82
|
+
elsif (anArity.high + 1) != count_param # fixed arity...
|
83
|
+
discrepancy_arity_argument_count(anArity.high, count_param, 1)
|
83
84
|
end
|
84
85
|
|
85
86
|
anArity
|
@@ -102,10 +103,8 @@ module Skeem
|
|
102
103
|
if count_actuals > arity.high
|
103
104
|
wrong_number_arguments(arity.high, count_actuals)
|
104
105
|
end
|
105
|
-
|
106
|
-
|
107
|
-
wrong_number_arguments(arity.high, count_actuals)
|
108
|
-
end
|
106
|
+
elsif count_actuals != arity.high # fixed non-zero arity...
|
107
|
+
wrong_number_arguments(arity.high, count_actuals)
|
109
108
|
end
|
110
109
|
end
|
111
110
|
|
@@ -114,11 +113,11 @@ module Skeem
|
|
114
113
|
result = code.call(aRuntime)
|
115
114
|
elsif arity.variadic? || (arity.low < arity.high)
|
116
115
|
if arity.low.zero?
|
117
|
-
if [
|
116
|
+
if %w[and or append].include? identifier
|
118
117
|
# Defer the evaluation of arguments to the primitive
|
119
118
|
result = code.call(aRuntime, operands)
|
120
119
|
else
|
121
|
-
evaluated_args = operands.map {|opernd| opernd.evaluate(aRuntime) }
|
120
|
+
evaluated_args = operands.map { |opernd| opernd.evaluate(aRuntime) }
|
122
121
|
result = code.call(aRuntime, evaluated_args)
|
123
122
|
end
|
124
123
|
else
|
@@ -134,14 +133,13 @@ module Skeem
|
|
134
133
|
# p args.inspect
|
135
134
|
result = code.send(:call, aRuntime, *args)
|
136
135
|
end
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
end
|
136
|
+
elsif identifier.value =~ /^set-[a-zA-Z]+!/ || identifier.value =~ /[a-zA-Z]+-set!/
|
137
|
+
# Fixed arity...
|
138
|
+
# Defer evaluation inside the primitive
|
139
|
+
result = code.send(:call, aRuntime, *operands)
|
140
|
+
else
|
141
|
+
evaluated_args = operands.map { |opernd| opernd.evaluate(aRuntime) }
|
142
|
+
result = code.send(:call, aRuntime, *evaluated_args)
|
145
143
|
end
|
146
144
|
|
147
145
|
result
|
@@ -149,21 +147,21 @@ module Skeem
|
|
149
147
|
|
150
148
|
def error_lambda(message_suffix)
|
151
149
|
msg1 = "Primitive procedure '#{identifier.value}'"
|
152
|
-
raise StandardError, msg1
|
150
|
+
raise StandardError, "#{msg1} #{message_suffix}"
|
153
151
|
end
|
154
152
|
|
155
153
|
def discrepancy_arity_argument_count(arity_required, count_param, delta)
|
156
154
|
msg1 = "Discrepancy in primitive procedure '#{identifier.value}'"
|
157
155
|
msg2 = "between arity (#{arity_required}) + #{delta}"
|
158
156
|
msg3 = "and parameter count of lambda #{count_param}."
|
159
|
-
raise StandardError, msg1
|
157
|
+
raise StandardError, "#{msg1} #{msg2} #{msg3}"
|
160
158
|
end
|
161
159
|
|
162
160
|
def wrong_number_arguments(required, actual)
|
163
161
|
msg1 = "Wrong number of arguments for #<Procedure #{identifier.value}>"
|
164
162
|
msg2 = "(required at least #{required}, got #{actual})"
|
165
|
-
raise StandardError, msg1
|
163
|
+
raise StandardError, "#{msg1} #{msg2}"
|
166
164
|
end
|
167
165
|
end # class
|
168
166
|
end # module
|
169
|
-
end # module
|
167
|
+
end # module
|
data/lib/skeem/runtime.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 's_expr_nodes'
|
2
4
|
|
3
5
|
module Skeem
|
@@ -41,13 +43,12 @@ module Skeem
|
|
41
43
|
result = nil
|
42
44
|
begin
|
43
45
|
result = entry.evaluate(self)
|
44
|
-
|
45
|
-
rescue NoMethodError => exc
|
46
|
+
rescue NoMethodError => e
|
46
47
|
# $stderr.puts 'In rescue block'
|
47
48
|
# $stderr.puts key_value.inspect
|
48
49
|
# $stderr.puts entry.inspect
|
49
50
|
# $stderr.puts entry.expression.inspect
|
50
|
-
raise
|
51
|
+
raise e
|
51
52
|
end
|
52
53
|
result
|
53
54
|
else
|
@@ -66,13 +67,14 @@ module Skeem
|
|
66
67
|
invokation.evaluate(self)
|
67
68
|
end
|
68
69
|
|
69
|
-
def nest
|
70
|
+
def nest
|
70
71
|
nested = SkmFrame.new(environment)
|
71
72
|
push(nested)
|
72
73
|
end
|
73
74
|
|
74
75
|
def unnest
|
75
76
|
raise StandardError, 'Cannot unnest environment' unless environment.parent
|
77
|
+
|
76
78
|
environment.bindings.clear
|
77
79
|
pop
|
78
80
|
end
|
@@ -90,6 +92,7 @@ module Skeem
|
|
90
92
|
if env_stack.empty?
|
91
93
|
raise StandardError, 'Skeem environment stack empty!'
|
92
94
|
end
|
95
|
+
|
93
96
|
env_stack.pop
|
94
97
|
end
|
95
98
|
|
@@ -110,6 +113,7 @@ module Skeem
|
|
110
113
|
if call_stack.empty?
|
111
114
|
raise StandardError, 'Skeem call stack empty!'
|
112
115
|
end
|
116
|
+
|
113
117
|
call_stack.pop
|
114
118
|
end
|
115
119
|
|
@@ -120,16 +124,14 @@ module Skeem
|
|
120
124
|
private
|
121
125
|
|
122
126
|
def normalize_key(aKey)
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
result
|
127
|
+
case aKey
|
128
|
+
when String
|
129
|
+
aKey
|
130
|
+
when SkmVariableReference
|
131
|
+
aKey.child.value
|
132
|
+
else
|
133
|
+
aKey.evaluate(self).value
|
134
|
+
end
|
133
135
|
end
|
134
136
|
end # class
|
135
|
-
end # module
|
137
|
+
end # module
|
data/lib/skeem/s_expr_builder.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'stringio'
|
2
4
|
require_relative 'skm_pair'
|
3
5
|
require_relative 'skm_binding'
|
@@ -22,17 +24,6 @@ module Skeem
|
|
22
24
|
'STRING_LIT' => SkmString
|
23
25
|
}.freeze
|
24
26
|
|
25
|
-
# Create a new AST builder instance.
|
26
|
-
# @param theTokens [Array<Token>] The sequence of input tokens.
|
27
|
-
def initialize(theTokens)
|
28
|
-
super(theTokens)
|
29
|
-
end
|
30
|
-
|
31
|
-
# Notification that the parse tree construction is complete.
|
32
|
-
def done!
|
33
|
-
super
|
34
|
-
end
|
35
|
-
|
36
27
|
protected
|
37
28
|
|
38
29
|
def terminal2node
|
@@ -43,11 +34,23 @@ module Skeem
|
|
43
34
|
def reduce_main(_production, _range, _tokens, theChildren)
|
44
35
|
last_child = theChildren.last
|
45
36
|
# $stderr.puts last_child.inspect
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
37
|
+
if last_child.length == 1
|
38
|
+
last_child.car
|
39
|
+
else
|
40
|
+
last_child
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# Default semantic action for rules of the form:
|
45
|
+
# rule 'some_symbol_star' => 'some_symbol_star some_symbol'
|
46
|
+
def reduce_star_default(_production, _range, _tokens, theChildren)
|
47
|
+
theChildren[0] << theChildren[1]
|
48
|
+
end
|
49
|
+
|
50
|
+
# Default semantic action for rules of the form:
|
51
|
+
# rule 'some_symbol_star' => []
|
52
|
+
def reduce_star_base(_production, _range, _tokens, _children)
|
53
|
+
[]
|
51
54
|
end
|
52
55
|
|
53
56
|
# rule('cmd_or_def_plus' => 'cmd_or_def_plus cmd_or_def').as 'multiple_cmd_def'
|
@@ -81,7 +84,7 @@ module Skeem
|
|
81
84
|
end
|
82
85
|
|
83
86
|
# rule('definition' => 'LPAREN BEGIN definition_star RPAREN').as 'definitions_within_begin'
|
84
|
-
def reduce_definitions_within_begin(_production,
|
87
|
+
def reduce_definitions_within_begin(_production, _range, _tokens, theChildren)
|
85
88
|
SkmSequencingBlock.new(SkmPair.create_from_a(theChildren[2]))
|
86
89
|
end
|
87
90
|
|
@@ -135,20 +138,10 @@ module Skeem
|
|
135
138
|
end
|
136
139
|
|
137
140
|
# rule('vector' => 'VECTOR_BEGIN datum_star RPAREN').as 'vector'
|
138
|
-
def reduce_vector(_production,
|
141
|
+
def reduce_vector(_production, _range, _tokens, theChildren)
|
139
142
|
SkmVector.new(theChildren[1])
|
140
143
|
end
|
141
144
|
|
142
|
-
# rule('datum_star' => 'datum_star datum').as 'datum_star'
|
143
|
-
def reduce_datum_star(_production, aRange, _tokens, theChildren)
|
144
|
-
theChildren[0] << theChildren[1]
|
145
|
-
end
|
146
|
-
|
147
|
-
# rule('datum_star' => []).as 'no_datum_yet'
|
148
|
-
def reduce_no_datum_yet(_production, aRange, _tokens, theChildren)
|
149
|
-
[]
|
150
|
-
end
|
151
|
-
|
152
145
|
# rule('procedure_call' => 'LPAREN operator RPAREN').as 'proc_call_nullary'
|
153
146
|
def reduce_proc_call_nullary(_production, aRange, _tokens, theChildren)
|
154
147
|
ProcedureCall.new(aRange, theChildren[1], [])
|
@@ -164,21 +157,6 @@ module Skeem
|
|
164
157
|
pcall
|
165
158
|
end
|
166
159
|
|
167
|
-
# rule('operand_plus' => 'operand_plus operand').as 'multiple_operands'
|
168
|
-
def reduce_multiple_operands(_production, _range, _tokens, theChildren)
|
169
|
-
theChildren[0] << theChildren[1]
|
170
|
-
end
|
171
|
-
|
172
|
-
# rule('operand_plus' => 'operand').as 'last_operand'
|
173
|
-
def reduce_last_operand(_production, _range, _tokens, theChildren)
|
174
|
-
[theChildren.last]
|
175
|
-
end
|
176
|
-
|
177
|
-
# rule('operand_plus' => 'operand').as 'last_operand'
|
178
|
-
def reduce_last_operand(_production, _range, _tokens, theChildren)
|
179
|
-
[theChildren.last]
|
180
|
-
end
|
181
|
-
|
182
160
|
# rule('def_formals' => 'identifier_star').as 'def_formals'
|
183
161
|
def reduce_def_formals(_production, _range, _tokens, theChildren)
|
184
162
|
SkmFormals.new(theChildren[0], :fixed)
|
@@ -192,9 +170,10 @@ module Skeem
|
|
192
170
|
|
193
171
|
# rule('lambda_expression' => 'LPAREN LAMBDA formals body RPAREN').as 'lambda_expression'
|
194
172
|
def reduce_lambda_expression(_production, aRange, _tokens, theChildren)
|
195
|
-
lmbd = SkmLambdaRep.new(aRange, theChildren[2], theChildren[3])
|
173
|
+
# lmbd = SkmLambdaRep.new(aRange, theChildren[2], theChildren[3])
|
196
174
|
# $stderr.puts lmbd.inspect
|
197
|
-
lmbd
|
175
|
+
# lmbd
|
176
|
+
SkmLambdaRep.new(aRange, theChildren[2], theChildren[3])
|
198
177
|
end
|
199
178
|
|
200
179
|
# rule('formals' => 'LPAREN identifier_star RPAREN').as 'fixed_arity_formals'
|
@@ -213,58 +192,17 @@ module Skeem
|
|
213
192
|
SkmFormals.new(formals, :variadic)
|
214
193
|
end
|
215
194
|
|
216
|
-
# rule('identifier_star' => 'identifier_star IDENTIFIER').as 'identifier_star'
|
217
|
-
def reduce_identifier_star(_production, _range, _tokens, theChildren)
|
218
|
-
theChildren[0] << theChildren[1]
|
219
|
-
end
|
220
|
-
|
221
|
-
# rule('identifier_star' => []).as 'no_identifier_yet'
|
222
|
-
def reduce_no_identifier_yet(_production, _range, _tokens, theChildren)
|
223
|
-
[]
|
224
|
-
end
|
225
|
-
|
226
|
-
# rule('identifier_plus' => 'identifier_plus IDENTIFIER').as 'multiple_identifiers'
|
227
|
-
def reduce_multiple_identifiers(_production, _range, _tokens, theChildren)
|
228
|
-
theChildren[0] << theChildren[1]
|
229
|
-
end
|
230
|
-
|
231
|
-
# rule('identifier_plus' => 'IDENTIFIER').as 'last_identifier'
|
232
|
-
def reduce_last_identifier(_production, _range, _tokens, theChildren)
|
233
|
-
[theChildren[0]]
|
234
|
-
end
|
235
|
-
|
236
195
|
# rule('body' => 'definition_star sequence').as 'body'
|
237
196
|
def reduce_body(_production, _range, _tokens, theChildren)
|
238
197
|
definitions = theChildren[0].nil? ? [] : theChildren[0]
|
239
198
|
{ defs: definitions, sequence: theChildren[1] }
|
240
199
|
end
|
241
200
|
|
242
|
-
# rule('definition_star' => 'definition_star definition').as 'definition_star'
|
243
|
-
def reduce_definition_star(_production, _range, _tokens, theChildren)
|
244
|
-
theChildren[0] << theChildren[1]
|
245
|
-
end
|
246
|
-
|
247
|
-
|
248
|
-
# rule('definition_star' => []).as 'no_definition_yet'
|
249
|
-
def reduce_no_definition_yet(_production, _range, _tokens, theChildren)
|
250
|
-
[]
|
251
|
-
end
|
252
|
-
|
253
201
|
# rule('sequence' => 'command_star expression').as 'sequence'
|
254
202
|
def reduce_sequence(_production, _range, _tokens, theChildren)
|
255
203
|
SkmPair.create_from_a(theChildren[0] << theChildren[1])
|
256
204
|
end
|
257
205
|
|
258
|
-
# rule('command_star' => 'command_star command').as 'multiple_commands'
|
259
|
-
def reduce_multiple_commands(_production, _range, _tokens, theChildren)
|
260
|
-
theChildren[0] << theChildren[1]
|
261
|
-
end
|
262
|
-
|
263
|
-
# rule('command_star' => []).as 'no_command_yet'
|
264
|
-
def reduce_no_command_yet(_production, _range, _tokens, theChildren)
|
265
|
-
[]
|
266
|
-
end
|
267
|
-
|
268
206
|
# rule('conditional' => 'LPAREN IF test consequent alternate RPAREN').as 'conditional'
|
269
207
|
def reduce_conditional(_production, aRange, _tokens, theChildren)
|
270
208
|
SkmCondition.new(aRange, theChildren[2], theChildren[3], theChildren[4])
|
@@ -286,7 +224,7 @@ module Skeem
|
|
286
224
|
end
|
287
225
|
|
288
226
|
# rule('derived_expression' => 'LPAREN LET LPAREN binding_spec_star RPAREN body RPAREN').as 'short_let_form'
|
289
|
-
def reduce_short_let_form(_production,
|
227
|
+
def reduce_short_let_form(_production, _range, _tokens, theChildren)
|
290
228
|
SkmBindingBlock.new(:let, theChildren[3], theChildren[5])
|
291
229
|
end
|
292
230
|
|
@@ -309,32 +247,12 @@ module Skeem
|
|
309
247
|
|
310
248
|
# We reky on utility 'builder' object
|
311
249
|
worker = SkmDoExprBuilder.new(theChildren[3], theChildren[6],
|
312
|
-
|
250
|
+
theChildren[7], theChildren[9])
|
313
251
|
do_expression = worker.do_expression
|
314
|
-
body = { :
|
252
|
+
body = { defs: [], sequence: do_expression }
|
315
253
|
SkmBindingBlock.new(:let_star, worker.bindings, body)
|
316
254
|
end
|
317
255
|
|
318
|
-
# rule('cond_clause_plus' => 'cond_clause_plus cond_clause').as 'multiple_cond_clauses'
|
319
|
-
def reduce_multiple_cond_clauses(_production, _range, _tokens, theChildren)
|
320
|
-
theChildren[0] << theChildren[1]
|
321
|
-
end
|
322
|
-
|
323
|
-
# rule('cond_clause_plus' => 'cond_clause').as 'last_cond_clauses'
|
324
|
-
def reduce_last_cond_clauses(_production, _range, _tokens, theChildren)
|
325
|
-
[theChildren[0]]
|
326
|
-
end
|
327
|
-
|
328
|
-
# rule('cond_clause_star' => 'cond_clause_star cond_clause').as 'cond_clauses_star'
|
329
|
-
def reduce_cond_clauses_star(_production, _range, _tokens, theChildren)
|
330
|
-
theChildren[0] << theChildren[1]
|
331
|
-
end
|
332
|
-
|
333
|
-
# rule('cond_clause_star' => []).as 'last_cond_clauses_star'
|
334
|
-
def reduce_last_cond_clauses_star(_production, _range, _tokens, _children)
|
335
|
-
[]
|
336
|
-
end
|
337
|
-
|
338
256
|
# rule('cond_clause' => 'LPAREN test sequence RPAREN').as 'cond_clause'
|
339
257
|
def reduce_cond_clause(_production, _range, _tokens, theChildren)
|
340
258
|
[theChildren[1], SkmSequencingBlock.new(SkmPair.create_from_a(theChildren[2]))]
|
@@ -346,40 +264,20 @@ module Skeem
|
|
346
264
|
end
|
347
265
|
|
348
266
|
# rule('quasiquotation' => 'LPAREN QUASIQUOTE qq_template RPAREN').as 'quasiquotation'
|
349
|
-
def reduce_quasiquotation(_production,
|
267
|
+
def reduce_quasiquotation(_production, _range, _tokens, theChildren)
|
350
268
|
SkmQuasiquotation.new(theChildren[2])
|
351
269
|
end
|
352
270
|
|
353
271
|
# rule('quasiquotation' => 'GRAVE_ACCENT qq_template').as 'quasiquotation_short'
|
354
|
-
def reduce_quasiquotation_short(_production,
|
272
|
+
def reduce_quasiquotation_short(_production, _range, _tokens, theChildren)
|
355
273
|
SkmQuasiquotation.new(theChildren[1])
|
356
274
|
end
|
357
275
|
|
358
|
-
# rule('binding_spec_star' => 'binding_spec_star binding_spec').as 'multiple_binding_specs'
|
359
|
-
def reduce_multiple_binding_specs(_production, aRange, _tokens, theChildren)
|
360
|
-
theChildren[0] << theChildren[1]
|
361
|
-
end
|
362
|
-
|
363
|
-
# rule('binding_spec_star' => []).as 'no_binding_spec_yet'
|
364
|
-
def reduce_no_binding_spec_yet(_production, aRange, _tokens, _children)
|
365
|
-
[]
|
366
|
-
end
|
367
|
-
|
368
276
|
# rule('binding_spec' => 'LPAREN IDENTIFIER expression RPAREN').as 'binding_spec'
|
369
|
-
def reduce_binding_spec(
|
277
|
+
def reduce_binding_spec(_production, _range, _tokens, theChildren)
|
370
278
|
SkmBinding.new(theChildren[1], theChildren[2])
|
371
279
|
end
|
372
280
|
|
373
|
-
# rule('iteration_spec_star' => 'iteration_spec_star iteration_spec').as 'multiple_iter_specs'
|
374
|
-
def reduce_multiple_iter_specs(_production, _range, _tokens, theChildren)
|
375
|
-
theChildren[0] << theChildren[1]
|
376
|
-
end
|
377
|
-
|
378
|
-
# rule('iteration_spec_star' => []).as 'no_iter_spec_yet'
|
379
|
-
def reduce_no_iter_spec_yet(_production, _range, _tokens, _children)
|
380
|
-
[]
|
381
|
-
end
|
382
|
-
|
383
281
|
# rule('iteration_spec' => 'LPAREN IDENTIFIER init step RPAREN').as 'iteration_spec_long'
|
384
282
|
def reduce_iteration_spec_long(_production, _range, _tokens, theChildren)
|
385
283
|
SkmIterationSpec.new(theChildren[1], theChildren[2], theChildren[3])
|
@@ -391,10 +289,16 @@ module Skeem
|
|
391
289
|
end
|
392
290
|
|
393
291
|
# rule('do_result' => []).as 'empty_do_result'
|
394
|
-
def reduce_empty_do_result(_production, _range, _tokens,
|
292
|
+
def reduce_empty_do_result(_production, _range, _tokens, _children)
|
395
293
|
SkmEmptyList.instance
|
396
294
|
end
|
397
295
|
|
296
|
+
# rule('includer' => 'LPAREN INCLUDE string_plus RPAREN').as 'include'
|
297
|
+
def reduce_include(_production, _range, _tokens, theChildren)
|
298
|
+
includer = SkmIncluder.new(theChildren[2])
|
299
|
+
includer.build
|
300
|
+
end
|
301
|
+
|
398
302
|
# rule('list_qq_template' => 'LPAREN qq_template_or_splice_star RPAREN').as 'list_qq'
|
399
303
|
def reduce_list_qq(_production, _range, _tokens, theChildren)
|
400
304
|
SkmPair.create_from_a(theChildren[1])
|
@@ -406,21 +310,9 @@ module Skeem
|
|
406
310
|
end
|
407
311
|
|
408
312
|
# rule('unquotation' => 'COMMA qq_template').as 'unquotation_short'
|
409
|
-
def reduce_unquotation_short(_production,
|
313
|
+
def reduce_unquotation_short(_production, _range, _tokens, theChildren)
|
410
314
|
SkmUnquotation.new(theChildren[1])
|
411
315
|
end
|
412
|
-
|
413
|
-
# rule('qq_template_or_splice_star' => 'qq_template_or_splice_star qq_template_or_splice').as 'multiple_template_splice'
|
414
|
-
def reduce_multiple_template_splice(_production, _range, _tokens, theChildren)
|
415
|
-
theChildren[0] << theChildren[1]
|
416
|
-
end
|
417
|
-
|
418
|
-
# rule('qq_template_or_splice_star' => []).as 'no_template_splice_yet'
|
419
|
-
def reduce_no_template_splice_yet(_production, _range, _tokens, theChildren)
|
420
|
-
[]
|
421
|
-
end
|
422
|
-
|
423
|
-
|
424
316
|
end # class
|
425
317
|
end # module
|
426
|
-
# End of file
|
318
|
+
# End of file
|