skeem 0.2.14 → 0.2.18
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 +35 -1
- data/Gemfile +2 -0
- data/README.md +125 -56
- data/Rakefile +2 -0
- data/appveyor.yml +3 -4
- data/bin/cubic.skm +4 -0
- data/bin/hello-world.skm +1 -0
- data/bin/skeem +72 -0
- data/lib/skeem/datum_dsl.rb +40 -30
- data/lib/skeem/element_visitor.rb +5 -2
- data/lib/skeem/grammar.rb +88 -26
- data/lib/skeem/interpreter.rb +9 -7
- data/lib/skeem/parser.rb +6 -4
- data/lib/skeem/primitive/primitive_builder.rb +148 -122
- data/lib/skeem/primitive/primitive_procedure.rb +23 -25
- data/lib/skeem/runtime.rb +17 -15
- data/lib/skeem/s_expr_builder.rb +49 -117
- 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/standard/base.skm +4 -0
- data/lib/skeem/tokenizer.rb +38 -28
- data/lib/skeem/version.rb +3 -1
- data/lib/skeem.rb +2 -0
- data/skeem.gemspec +9 -6
- 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 +84 -44
- data/spec/skeem/lambda_spec.rb +13 -11
- data/spec/skeem/parser_spec.rb +23 -19
- data/spec/skeem/primitive/primitive_builder_spec.rb +65 -48
- 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 +18 -10
@@ -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], [])
|
@@ -174,11 +167,6 @@ module Skeem
|
|
174
167
|
[theChildren.last]
|
175
168
|
end
|
176
169
|
|
177
|
-
# rule('operand_plus' => 'operand').as 'last_operand'
|
178
|
-
def reduce_last_operand(_production, _range, _tokens, theChildren)
|
179
|
-
[theChildren.last]
|
180
|
-
end
|
181
|
-
|
182
170
|
# rule('def_formals' => 'identifier_star').as 'def_formals'
|
183
171
|
def reduce_def_formals(_production, _range, _tokens, theChildren)
|
184
172
|
SkmFormals.new(theChildren[0], :fixed)
|
@@ -192,9 +180,10 @@ module Skeem
|
|
192
180
|
|
193
181
|
# rule('lambda_expression' => 'LPAREN LAMBDA formals body RPAREN').as 'lambda_expression'
|
194
182
|
def reduce_lambda_expression(_production, aRange, _tokens, theChildren)
|
195
|
-
lmbd = SkmLambdaRep.new(aRange, theChildren[2], theChildren[3])
|
183
|
+
# lmbd = SkmLambdaRep.new(aRange, theChildren[2], theChildren[3])
|
196
184
|
# $stderr.puts lmbd.inspect
|
197
|
-
lmbd
|
185
|
+
# lmbd
|
186
|
+
SkmLambdaRep.new(aRange, theChildren[2], theChildren[3])
|
198
187
|
end
|
199
188
|
|
200
189
|
# rule('formals' => 'LPAREN identifier_star RPAREN').as 'fixed_arity_formals'
|
@@ -213,16 +202,6 @@ module Skeem
|
|
213
202
|
SkmFormals.new(formals, :variadic)
|
214
203
|
end
|
215
204
|
|
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
205
|
# rule('identifier_plus' => 'identifier_plus IDENTIFIER').as 'multiple_identifiers'
|
227
206
|
def reduce_multiple_identifiers(_production, _range, _tokens, theChildren)
|
228
207
|
theChildren[0] << theChildren[1]
|
@@ -239,32 +218,11 @@ module Skeem
|
|
239
218
|
{ defs: definitions, sequence: theChildren[1] }
|
240
219
|
end
|
241
220
|
|
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
221
|
# rule('sequence' => 'command_star expression').as 'sequence'
|
254
222
|
def reduce_sequence(_production, _range, _tokens, theChildren)
|
255
223
|
SkmPair.create_from_a(theChildren[0] << theChildren[1])
|
256
224
|
end
|
257
225
|
|
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
226
|
# rule('conditional' => 'LPAREN IF test consequent alternate RPAREN').as 'conditional'
|
269
227
|
def reduce_conditional(_production, aRange, _tokens, theChildren)
|
270
228
|
SkmCondition.new(aRange, theChildren[2], theChildren[3], theChildren[4])
|
@@ -286,7 +244,7 @@ module Skeem
|
|
286
244
|
end
|
287
245
|
|
288
246
|
# rule('derived_expression' => 'LPAREN LET LPAREN binding_spec_star RPAREN body RPAREN').as 'short_let_form'
|
289
|
-
def reduce_short_let_form(_production,
|
247
|
+
def reduce_short_let_form(_production, _range, _tokens, theChildren)
|
290
248
|
SkmBindingBlock.new(:let, theChildren[3], theChildren[5])
|
291
249
|
end
|
292
250
|
|
@@ -309,9 +267,9 @@ module Skeem
|
|
309
267
|
|
310
268
|
# We reky on utility 'builder' object
|
311
269
|
worker = SkmDoExprBuilder.new(theChildren[3], theChildren[6],
|
312
|
-
|
270
|
+
theChildren[7], theChildren[9])
|
313
271
|
do_expression = worker.do_expression
|
314
|
-
body = { :
|
272
|
+
body = { defs: [], sequence: do_expression }
|
315
273
|
SkmBindingBlock.new(:let_star, worker.bindings, body)
|
316
274
|
end
|
317
275
|
|
@@ -325,16 +283,6 @@ module Skeem
|
|
325
283
|
[theChildren[0]]
|
326
284
|
end
|
327
285
|
|
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
286
|
# rule('cond_clause' => 'LPAREN test sequence RPAREN').as 'cond_clause'
|
339
287
|
def reduce_cond_clause(_production, _range, _tokens, theChildren)
|
340
288
|
[theChildren[1], SkmSequencingBlock.new(SkmPair.create_from_a(theChildren[2]))]
|
@@ -346,40 +294,20 @@ module Skeem
|
|
346
294
|
end
|
347
295
|
|
348
296
|
# rule('quasiquotation' => 'LPAREN QUASIQUOTE qq_template RPAREN').as 'quasiquotation'
|
349
|
-
def reduce_quasiquotation(_production,
|
297
|
+
def reduce_quasiquotation(_production, _range, _tokens, theChildren)
|
350
298
|
SkmQuasiquotation.new(theChildren[2])
|
351
299
|
end
|
352
300
|
|
353
301
|
# rule('quasiquotation' => 'GRAVE_ACCENT qq_template').as 'quasiquotation_short'
|
354
|
-
def reduce_quasiquotation_short(_production,
|
302
|
+
def reduce_quasiquotation_short(_production, _range, _tokens, theChildren)
|
355
303
|
SkmQuasiquotation.new(theChildren[1])
|
356
304
|
end
|
357
305
|
|
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
306
|
# rule('binding_spec' => 'LPAREN IDENTIFIER expression RPAREN').as 'binding_spec'
|
369
|
-
def reduce_binding_spec(
|
307
|
+
def reduce_binding_spec(_production, _range, _tokens, theChildren)
|
370
308
|
SkmBinding.new(theChildren[1], theChildren[2])
|
371
309
|
end
|
372
310
|
|
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
311
|
# rule('iteration_spec' => 'LPAREN IDENTIFIER init step RPAREN').as 'iteration_spec_long'
|
384
312
|
def reduce_iteration_spec_long(_production, _range, _tokens, theChildren)
|
385
313
|
SkmIterationSpec.new(theChildren[1], theChildren[2], theChildren[3])
|
@@ -391,10 +319,26 @@ module Skeem
|
|
391
319
|
end
|
392
320
|
|
393
321
|
# rule('do_result' => []).as 'empty_do_result'
|
394
|
-
def reduce_empty_do_result(_production, _range, _tokens,
|
322
|
+
def reduce_empty_do_result(_production, _range, _tokens, _children)
|
395
323
|
SkmEmptyList.instance
|
396
324
|
end
|
397
325
|
|
326
|
+
# rule('includer' => 'LPAREN INCLUDE string_plus RPAREN').as 'include'
|
327
|
+
def reduce_include(_production, _range, _tokens, theChildren)
|
328
|
+
includer = SkmIncluder.new(theChildren[2])
|
329
|
+
includer.build
|
330
|
+
end
|
331
|
+
|
332
|
+
# rule('string_plus' => 'string_plus STRING_LIT').as 'multiple_string'
|
333
|
+
def reduce_multiple_string(_production, _range, _tokens, theChildren)
|
334
|
+
theChildren[0] << theChildren[1]
|
335
|
+
end
|
336
|
+
|
337
|
+
# rule('string_plus' => 'STRING_LIT').as 'last_single_string'
|
338
|
+
def reduce_last_single_string(_production, _range, _tokens, theChildren)
|
339
|
+
[theChildren[0]]
|
340
|
+
end
|
341
|
+
|
398
342
|
# rule('list_qq_template' => 'LPAREN qq_template_or_splice_star RPAREN').as 'list_qq'
|
399
343
|
def reduce_list_qq(_production, _range, _tokens, theChildren)
|
400
344
|
SkmPair.create_from_a(theChildren[1])
|
@@ -406,21 +350,9 @@ module Skeem
|
|
406
350
|
end
|
407
351
|
|
408
352
|
# rule('unquotation' => 'COMMA qq_template').as 'unquotation_short'
|
409
|
-
def reduce_unquotation_short(_production,
|
353
|
+
def reduce_unquotation_short(_production, _range, _tokens, theChildren)
|
410
354
|
SkmUnquotation.new(theChildren[1])
|
411
355
|
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
356
|
end # class
|
425
357
|
end # module
|
426
|
-
# End of file
|
358
|
+
# End of file
|