skeem 0.2.20 → 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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +33 -298
  3. data/CHANGELOG.md +17 -2
  4. data/LICENSE.txt +1 -1
  5. data/lib/skeem/grammar.rb +14 -15
  6. data/lib/skeem/interpreter.rb +1 -1
  7. data/lib/skeem/parser.rb +1 -1
  8. data/lib/skeem/primitive/primitive_builder.rb +4 -2
  9. data/lib/skeem/primitive/primitive_procedure.rb +1 -1
  10. data/lib/skeem/runtime.rb +3 -1
  11. data/lib/skeem/s_expr_builder.rb +7 -7
  12. data/lib/skeem/s_expr_nodes.rb +5 -3
  13. data/lib/skeem/skm_simple_datum.rb +2 -2
  14. data/lib/skeem/tokenizer.rb +18 -23
  15. data/lib/skeem/version.rb +1 -1
  16. data/lib/skeem.rb +2 -2
  17. data/skeem.gemspec +8 -5
  18. data/spec/skeem/datum_dsl_spec.rb +50 -50
  19. data/spec/skeem/element_visitor_spec.rb +108 -108
  20. data/spec/skeem/interpreter_spec.rb +171 -169
  21. data/spec/skeem/lambda_spec.rb +27 -27
  22. data/spec/skeem/parser_spec.rb +27 -25
  23. data/spec/skeem/primitive/primitive_builder_spec.rb +127 -131
  24. data/spec/skeem/primitive/primitive_procedure_spec.rb +28 -28
  25. data/spec/skeem/runtime_spec.rb +52 -51
  26. data/spec/skeem/s_expr_nodes_spec.rb +31 -31
  27. data/spec/skeem/skm_compound_datum_spec.rb +36 -35
  28. data/spec/skeem/skm_element_spec.rb +35 -34
  29. data/spec/skeem/skm_empty_list_spec.rb +19 -19
  30. data/spec/skeem/skm_frame_spec.rb +49 -46
  31. data/spec/skeem/skm_pair_spec.rb +93 -93
  32. data/spec/skeem/skm_procedure_exec_spec.rb +11 -11
  33. data/spec/skeem/skm_simple_datum_spec.rb +104 -95
  34. data/spec/skeem/skm_unary_expression_spec.rb +60 -61
  35. data/spec/skeem/tokenizer_spec.rb +52 -52
  36. data/spec/skeem_spec.rb +1 -1
  37. data/spec/spec_helper.rb +0 -2
  38. metadata +61 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f17c469661c1ebfa3ad17ae7685ac52a90b30fcd4b31d1d01b5af1c54ccfb765
4
- data.tar.gz: ccb061b50470a01a740c99f3e01c89a5e962216fa80d3147fa5d7bbc759b6a1d
3
+ metadata.gz: 60bb3901b33cd2d27438d530516ead6eba76ddad2b1b25bc1714b138cd4eea98
4
+ data.tar.gz: 2d1e4862d0be1fad47146fde29c31598e7dbcc096de7cdb061809b098fa3c49e
5
5
  SHA512:
6
- metadata.gz: bf7120cc110af075a3c5c3294492e5246e2857fe86d6090fba57fd8b8425f47871249710af82b1acf4471dc2ab2bf34770977acee3e98cee1cc7631382953930
7
- data.tar.gz: af3025b621249db56813fa5c91fee6b33a47943d025a18cf50e5490f92d99b6750225b2af47d66c57bd72947faafb6e96f84cf4ab3038bf437e306308c09fa89
6
+ metadata.gz: 4c6928ec6c977253e8f22f2ace0e09fb26117a39f17c599240e1eae8380fd136e65cfda81aeb01907faee608c8c88a7c785358eda8ccc1d8683bee0904a682b9
7
+ data.tar.gz: c5e07ae2fc4edefd4a17e63dd27bc2044d8646e2165c2d50dbe5614f6b985f2f0a9f7cd0f2d2ce1d0da50f9bf13b036322245f829376a79f4bc1620bd4a890a6
data/.rubocop.yml CHANGED
@@ -2,8 +2,10 @@ AllCops:
2
2
  Exclude:
3
3
  - 'exp/**/*'
4
4
  - 'demo/**/*'
5
+ NewCops: enable
6
+ SuggestExtensions: false
5
7
 
6
- Gemspec/DateAssignment:
8
+ Gemspec/RequireMFA: # new in 1.23
7
9
  Enabled: true
8
10
 
9
11
  Layout/ArgumentAlignment:
@@ -50,124 +52,13 @@ Layout/IndentationConsistency:
50
52
  Layout/HeredocIndentation:
51
53
  Enabled: false
52
54
 
53
- Layout/LineEndStringConcatenationIndentation:
54
- Enabled: true
55
-
56
- Layout/MultilineHashBraceLayout:
57
- Enabled: true
58
-
59
55
  Layout/MultilineMethodCallBraceLayout:
60
56
  Enabled: true
61
57
  EnforcedStyle: same_line
62
58
 
63
- Layout/SpaceAroundOperators:
64
- Enabled: true
65
-
66
- Layout/SpaceBeforeBrackets:
67
- Enabled: true
68
-
69
- Layout/SpaceInsideParens:
70
- Enabled: true
71
-
72
- Layout/IndentationStyle:
73
- Enabled: true
74
-
75
- Layout/SpaceAroundMethodCallOperator:
76
- Enabled: true
77
-
78
- Layout/TrailingEmptyLines:
79
- Enabled: true
80
-
81
- Layout/TrailingWhitespace:
82
- Enabled: true
83
-
84
- Lint/AmbiguousAssignment:
85
- Enabled: true
86
-
87
- Lint/AmbiguousOperatorPrecedence: # new in 1.21
88
- Enabled: true
89
-
90
- Lint/AmbiguousRange:
91
- Enabled: true
92
-
93
- Lint/DeprecatedConstants:
94
- Enabled: true
95
-
96
- Lint/DuplicateBranch:
97
- Enabled: true
98
-
99
- Lint/DuplicateRegexpCharacterClassElement:
100
- Enabled: true
101
-
102
- Lint/EmptyBlock:
103
- Enabled: true
104
-
105
- Lint/EmptyClass:
106
- Enabled: false
107
-
108
- Lint/EmptyInPattern:
109
- Enabled: true
110
-
111
- Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
112
- Enabled: true
113
-
114
- Lint/LambdaWithoutLiteralBlock:
115
- Enabled: true
116
-
117
- Lint/Loop:
118
- Enabled: true
119
-
120
- Lint/NoReturnInBeginEndBlocks:
121
- Enabled: true
122
-
123
- Lint/NumberedParameterAssignment:
124
- Enabled: true
125
-
126
- Lint/OrAssignmentToConstant:
127
- Enabled: true
128
-
129
- Lint/RaiseException:
130
- Enabled: true
131
-
132
- Lint/RedundantDirGlobSort:
133
- Enabled: true
134
-
135
- Lint/RequireRelativeSelfPath: # new in 1.22
136
- Enabled: true
137
-
138
- Lint/RescueException:
139
- Enabled: true
140
-
141
- Lint/StructNewOverride:
142
- Enabled: true
143
-
144
- Lint/SymbolConversion:
145
- Enabled: true
146
-
147
- Lint/ToEnumArguments:
148
- Enabled: true
149
-
150
- Lint/TripleQuotes:
151
- Enabled: true
152
-
153
- Lint/UnexpectedBlockArity:
154
- Enabled: true
155
-
156
- Lint/UnmodifiedReduceAccumulator:
157
- Enabled: true
158
-
159
- Lint/UnusedMethodArgument:
160
- Enabled: true
161
-
162
- Lint/UselessAccessModifier:
163
- Enabled: true
164
-
165
59
  Lint/Void:
166
60
  Enabled: false
167
61
 
168
- Lint/UselessAssignment:
169
- Enabled: true
170
-
171
62
  Metrics/AbcSize:
172
63
  Enabled: false
173
64
 
@@ -207,12 +98,6 @@ Naming/ConstantName:
207
98
  Naming/ClassAndModuleCamelCase:
208
99
  Enabled: false
209
100
 
210
- Naming/BlockParameterName:
211
- Enabled: true
212
-
213
- Naming/InclusiveLanguage:
214
- Enabled: true
215
-
216
101
  Naming/MethodParameterName:
217
102
  Enabled: false
218
103
 
@@ -222,15 +107,6 @@ Naming/MethodName:
222
107
  Naming/VariableName:
223
108
  Enabled: false
224
109
 
225
- Security/IoMethods: # new in 1.22
226
- Enabled: true
227
-
228
- Style/Alias:
229
- Enabled: true
230
-
231
- Style/ArgumentsForwarding:
232
- Enabled: true
233
-
234
110
  Style/AsciiComments:
235
111
  Enabled: false
236
112
 
@@ -249,9 +125,6 @@ Style/ClassCheck:
249
125
  Style/ClassVars:
250
126
  Enabled: false
251
127
 
252
- Style/CollectionCompact:
253
- Enabled: true
254
-
255
128
  Style/ColonMethodCall:
256
129
  Enabled: false
257
130
 
@@ -264,210 +137,72 @@ Style/CommentedKeyword:
264
137
  Style/ConditionalAssignment:
265
138
  Enabled: false
266
139
 
267
- Style/DefWithParentheses:
268
- Enabled: true
269
-
270
140
  Style/Documentation:
271
141
  Enabled: false
272
142
 
273
- Style/DocumentDynamicEvalDefinition:
274
- Enabled: true
275
-
276
143
  Style/ExpandPathArguments:
277
144
  Enabled: false
278
145
 
279
- Style/ExponentialNotation:
280
- Enabled: true
281
-
282
146
  Style/GuardClause:
283
147
  Enabled: false
284
148
 
285
- Style/HashEachMethods:
286
- Enabled: true
287
-
288
- Style/HashExcept:
289
- Enabled: true
290
-
291
- Style/HashTransformKeys:
292
- Enabled: true
293
-
294
- Style/HashTransformValues:
295
- Enabled: true
296
-
297
149
  Style/IfUnlessModifier:
298
150
  Enabled: false
299
151
 
300
- Style/InPatternThen:
301
- Enabled: true
302
-
303
152
  Style/InverseMethods:
304
153
  Enabled: false
305
154
 
306
155
  Style/MissingRespondToMissing:
307
156
  Enabled: false
308
157
 
309
- Style/MultilineInPatternThen:
310
- Enabled: true
311
-
312
- Style/NegatedIfElseCondition:
313
- Enabled: true
314
-
315
158
  Style/Next:
316
159
  Enabled: false
317
160
 
318
- Style/NilLambda:
319
- Enabled: true
320
-
321
- Style/NumberedParameters: # new in 1.22
322
- Enabled: true
323
-
324
- Style/NumberedParametersLimit: # new in 1.22
325
- Enabled: true
326
-
327
161
  Style/NumericLiterals:
328
162
  Enabled: false
329
163
 
330
- Style/QuotedSymbols:
331
- Enabled: true
332
-
333
- Style/RaiseArgs:
334
- Enabled: true
335
-
336
- Style/RedundantArgument:
337
- Enabled: true
338
-
339
- Style/RedundantReturn:
340
- Enabled: false
341
-
342
- Style/RedundantSelf:
343
- Enabled: true
344
-
345
- Style/RedundantSelfAssignmentBranch:
346
- Enabled: true
347
-
348
164
  Style/RegexpLiteral:
349
165
  Enabled: false
350
166
 
351
167
  Style/PercentLiteralDelimiters:
352
168
  Enabled: false
353
169
 
354
- Style/SelectByRegexp: # new in 1.22
355
- Enabled: true
356
-
357
170
  Style/StderrPuts:
358
171
  Enabled: false
359
172
 
360
- Style/StringLiterals:
361
- Enabled: true
362
-
363
- Style/SwapValues:
364
- Enabled: true
365
-
366
173
  Style/TernaryParentheses:
367
174
  Enabled: false
368
175
 
369
176
  Style/UnlessElse:
370
177
  Enabled: false
371
178
 
372
- # Rubocop complains when it doesn't find an explicit setting for the following cops:
373
- Layout/EmptyLinesAroundAttributeAccessor:
374
- Enabled: true
375
-
376
- Lint/BinaryOperatorWithIdenticalOperands:
377
- Enabled: true
378
-
379
- Lint/DeprecatedOpenSSLConstant:
380
- Enabled: true
381
-
382
- Lint/DuplicateElsifCondition:
383
- Enabled: true
384
-
385
- Lint/DuplicateRescueException:
386
- Enabled: true
387
-
388
- Lint/EmptyConditionalBody:
389
- Enabled: true
390
-
391
- Lint/FloatComparison:
392
- Enabled: true
393
-
394
- Lint/MissingSuper:
395
- Enabled: true
396
-
397
- Lint/MixedRegexpCaptureTypes:
398
- Enabled: true
399
-
400
- Lint/OutOfRangeRegexpRef:
401
- Enabled: true
402
-
403
- Lint/SelfAssignment:
404
- Enabled: true
405
-
406
- Lint/TopLevelReturnWithArgument:
407
- Enabled: true
408
-
409
- Lint/UnreachableLoop:
410
- Enabled: true
411
-
412
- Style/AccessorGrouping:
413
- Enabled: true
414
-
415
- Style/ArrayCoercion:
416
- Enabled: true
417
-
418
- Style/BisectedAttrAccessor:
419
- Enabled: true
420
-
421
- Style/CaseLikeIf:
422
- Enabled: true
423
-
424
- Style/EndlessMethod:
425
- Enabled: true
426
-
427
- Style/ExplicitBlockArgument:
428
- Enabled: true
429
-
430
- Style/GlobalStdStream:
431
- Enabled: true
432
-
433
- Style/HashAsLastArrayItem:
434
- Enabled: true
435
-
436
- Style/HashConversion:
437
- Enabled: true
438
-
439
- Style/HashLikeCase:
440
- Enabled: true
441
-
442
- Style/IfWithBooleanLiteralBranches:
443
- Enabled: true
444
-
445
- Style/OptionalBooleanParameter:
446
- Enabled: true
447
-
448
- Style/RedundantAssignment:
449
- Enabled: true
450
-
451
- Style/RedundantFetchBlock:
452
- Enabled: true
453
-
454
- Style/RedundantFileExtensionInRequire:
455
- Enabled: true
456
-
457
- Style/RedundantRegexpCharacterClass:
458
- Enabled: true
459
-
460
- Style/RedundantRegexpEscape:
461
- Enabled: true
462
-
463
- Style/SingleArgumentDig:
464
- Enabled: true
465
-
466
- Style/SlicingWithRange:
467
- Enabled: true
468
-
469
- Style/StringChars:
470
- Enabled: true
471
-
472
- Style/StringConcatenation:
473
- Enabled: true
179
+ ## Optional rubocop-rspec plugin rule checking
180
+ #RSpec/ContextWording:
181
+ # Enabled: false
182
+ #
183
+ #RSpec/DescribeClass:
184
+ # Enabled: false
185
+ #
186
+ #RSpec/ExampleLength:
187
+ # Max: 45
188
+ #
189
+ #RSpec/MultipleExpectations:
190
+ # Max: 25
191
+ #
192
+ #RSpec/NoExpectationExample:
193
+ # Enabled: false
194
+ #
195
+ #RSpec/RepeatedDescription:
196
+ # Enabled: false
197
+ #
198
+ #RSpec/RepeatedExample:
199
+ # Enabled: false
200
+ #
201
+ #RSpec/RepeatedExampleGroupDescription:
202
+ # Enabled: false
203
+ #
204
+ #RSpec/VerifiedDoubles:
205
+ # Enabled: false
206
+ #
207
+ #RSpec/IdenticalEqualityAssertion:
208
+ # Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,8 +1,23 @@
1
+ ## [0.2.22] - 2025-03-30
2
+ - Dependency updates, minor changes, tested against Ruby 3.4.1.
3
+
4
+ ### Changed
5
+ - Files updated to please Rubocop 1.75.1
6
+ - Files `*_spec.rb` updated to please `rubocop-rspec`.
7
+
8
+ ## [0.2.21] - 2022-04-24
9
+ - Dependencies updates, minor changes
10
+
11
+ ### Changed
12
+ - File `.rubocop.yml` Incorporating new Rubocop cops (up to version 1.28)
13
+ - File `grammar.rb`: Refactoring of a rule with grouping parentheses
14
+ - File `s_expr_builder` Change to relfect changes in grammar
15
+ - File `skeem.gempsec` Updated dependencies; minimal Ruby version is now 2.6+
16
+
1
17
  ## [0.2.20] - 2021-11-01
2
18
  - Code update to cope with changes in `Rley` v. 0.8.08
3
19
 
4
- ### Changed
5
- - File `grammar.rb`: Refactoring to cope with ? quantifier changes
20
+
6
21
  - File `s_expr_builder.rb`: Refactoring to cope with ? quantifier changes
7
22
  - File `skeem.gemspec` dependency updated for `Rley` v. 0.8.08
8
23
 
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2018-2019 Dimitri Geshef
3
+ Copyright (c) 2018-2025 Dimitri Geshef
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/lib/skeem/grammar.rb CHANGED
@@ -89,8 +89,7 @@ module Skeem
89
89
  rule 'number' => 'RATIONAL'
90
90
  rule 'number' => 'REAL'
91
91
  rule('assignment' => 'LPAREN SET! IDENTIFIER expression RPAREN').as 'assignment'
92
- rule('derived_expression' => 'LPAREN COND cond_clause+ RPAREN').as 'cond_form'
93
- rule('derived_expression' => 'LPAREN COND cond_clause* LPAREN ELSE sequence RPAREN RPAREN').as 'cond_else_form'
92
+ rule('derived_expression' => 'LPAREN COND cond_clause* (LPAREN ELSE sequence RPAREN)? RPAREN').as 'cond_form'
94
93
  rule('derived_expression' => 'LPAREN LET LPAREN binding_spec* RPAREN body RPAREN').as 'short_let_form'
95
94
  # TODO: implement "named let"
96
95
  rule('derived_expression' => 'LPAREN LET IDENTIFIER LPAREN binding_spec* RPAREN body RPAREN') # .as 'named_form'
@@ -138,14 +137,14 @@ END_SYNTAX
138
137
  rule('transformer_spec' => 'LPAREN SYNTAX-RULES IDENTIFIER LPAREN IDENTIFIER* RPAREN syntax_rule* RPAREN')
139
138
  rule('syntax_rule' => 'LPAREN pattern template RPAREN').as 'syntax_rule'
140
139
  rule('pattern' => 'pattern_identifier')
141
- rule('pattern' => 'UNDERSCORE')
142
- rule('pattern' => 'LPAREN pattern* RPAREN')
143
- rule('pattern' => 'LPAREN pattern+ PERIOD pattern RPAREN')
144
- rule('pattern' => 'LPAREN pattern+ ELLIPSIS pattern* RPAREN')
145
- rule('pattern' => 'LPAREN pattern+ ELLIPSIS pattern* PERIOD pattern RPAREN')
146
- rule('pattern' => 'VECTOR_BEGIN pattern* RPAREN')
147
- rule('pattern' => 'VECTOR_BEGIN pattern+ ELLIPSIS pattern* RPAREN')
148
- rule('pattern' => 'pattern_datum')
140
+ rule('pattern' => 'UNDERSCORE')
141
+ rule('pattern' => 'LPAREN pattern* RPAREN')
142
+ rule('pattern' => 'LPAREN pattern+ PERIOD pattern RPAREN')
143
+ rule('pattern' => 'LPAREN pattern+ ELLIPSIS pattern* RPAREN')
144
+ rule('pattern' => 'LPAREN pattern+ ELLIPSIS pattern* PERIOD pattern RPAREN')
145
+ rule('pattern' => 'VECTOR_BEGIN pattern* RPAREN')
146
+ rule('pattern' => 'VECTOR_BEGIN pattern+ ELLIPSIS pattern* RPAREN')
147
+ rule('pattern' => 'pattern_datum')
149
148
  rule('pattern_datum' => 'STRING_LIT')
150
149
  rule('pattern_datum' => 'CHAR')
151
150
  rule('pattern_datum' => 'BOOLEAN')
@@ -154,11 +153,11 @@ END_SYNTAX
154
153
  rule('template' => 'pattern_identifier')
155
154
  rule('template' => 'LPAREN template_element* RPAREN')
156
155
  rule('template' => 'LPAREN template_element+ PERIOD template RPAREN')
157
- rule('template' => 'VECTOR_BEGIN template_element* RPAREN')
158
- rule('template' => 'template_datum')
159
- rule('template_element' => 'template')
160
- rule('template_element' => 'template ELLIPSIS')
161
- rule('template_datum' => 'pattern_datum')
156
+ rule('template' => 'VECTOR_BEGIN template_element* RPAREN')
157
+ rule('template' => 'template_datum')
158
+ rule('template_element' => 'template')
159
+ rule('template_element' => 'template ELLIPSIS')
160
+ rule('template_datum' => 'pattern_datum')
162
161
  rule('pattern_identifier' => 'IDENTIFIER')
163
162
  # Ugly: specialized production rule per keyword...
164
163
  rule('pattern_identifier' => 'BEGIN')
@@ -3,7 +3,7 @@
3
3
  require_relative 'parser'
4
4
  require_relative 'skm_frame'
5
5
  require_relative 'runtime'
6
- require_relative './primitive/primitive_builder'
6
+ require_relative 'primitive/primitive_builder'
7
7
 
8
8
  module Skeem
9
9
  class Interpreter
data/lib/skeem/parser.rb CHANGED
@@ -36,7 +36,7 @@ module Skeem
36
36
  raise StandardError, line1 + line2
37
37
  end
38
38
 
39
- return engine.to_ptree(result)
39
+ engine.to_ptree(result)
40
40
  end
41
41
  end # class
42
42
  end # module
@@ -6,6 +6,7 @@ require_relative '../skm_exception'
6
6
  require_relative '../skm_pair'
7
7
 
8
8
  module Skeem
9
+ # rubocop: disable Metrics/ModuleLength
9
10
  module Primitive
10
11
  module PrimitiveBuilder
11
12
  include DatumDSL
@@ -1111,7 +1112,7 @@ module Skeem
1111
1112
  def create_display(aRuntime)
1112
1113
  primitive = lambda do |_runtime, arg_evaluated|
1113
1114
  # @TODO: make output stream configurable
1114
- print arg_evaluated.value.to_s
1115
+ print arg_evaluated.value
1115
1116
  SkmUndefined.instance
1116
1117
  end
1117
1118
 
@@ -1231,7 +1232,7 @@ module Skeem
1231
1232
  def remaining_args(arglist, aRuntime)
1232
1233
  case arglist
1233
1234
  when Array
1234
- raw_arg = arglist[1..-1]
1235
+ raw_arg = arglist[1..]
1235
1236
  when SkmPair
1236
1237
  raw_arg = arglist.cdr.to_a
1237
1238
  end
@@ -1239,4 +1240,5 @@ module Skeem
1239
1240
  end
1240
1241
  end # module
1241
1242
  end # module
1243
+ # rubocop: enable Metrics/ModuleLength
1242
1244
  end # module
@@ -70,7 +70,7 @@ module Skeem
70
70
  unless aRubyLambda.lambda?
71
71
  error_lambda('must be implemented with a Ruby lambda.')
72
72
  end
73
- if aRubyLambda.parameters.size.zero?
73
+ if aRubyLambda.parameters.empty?
74
74
  error_lambda('lambda takes no parameter.')
75
75
  end
76
76
 
data/lib/skeem/runtime.rb CHANGED
@@ -35,6 +35,7 @@ module Skeem
35
35
  def update_binding(aKey, anEntry)
36
36
  environment.update_binding(aKey, anEntry)
37
37
  end
38
+ # rubocop: disable Lint/UselessRescue
38
39
 
39
40
  def evaluate(aKey)
40
41
  key_value = normalize_key(aKey)
@@ -58,6 +59,7 @@ module Skeem
58
59
  raise err, err_msg
59
60
  end
60
61
  end
62
+ # rubocop: enable Lint/UselessRescue
61
63
 
62
64
  # @param aList[SkmPair] first member is an identifier.
63
65
  def evaluate_form(aList)
@@ -80,7 +82,7 @@ module Skeem
80
82
  end
81
83
 
82
84
  def depth
83
- return env_stack.size
85
+ env_stack.size
84
86
  end
85
87
 
86
88
  def push(anEnvironment)
@@ -214,14 +214,14 @@ module Skeem
214
214
  SkmUpdateBinding.new(theChildren[2], theChildren[3])
215
215
  end
216
216
 
217
- # rule('derived_expression' => 'LPAREN COND cond_clause_plus RPAREN').as 'cond_form'
217
+ # rule('derived_expression' => 'LPAREN COND cond_clause* (LPAREN ELSE sequence RPAREN)? RPAREN')
218
218
  def reduce_cond_form(_production, aRange, _tokens, theChildren)
219
- SkmConditional.new(aRange.low, theChildren[2], nil)
220
- end
221
-
222
- # rule('derived_expression' => 'LPAREN COND cond_clause_star LPAREN ELSE sequence RPAREN RPAREN').as 'cond_else_form'
223
- def reduce_cond_else_form(_production, aRange, _tokens, theChildren)
224
- SkmConditional.new(aRange.low, theChildren[2], SkmSequencingBlock.new(theChildren[5]))
219
+ if theChildren[3]
220
+ else_part = SkmSequencingBlock.new(theChildren[3][2])
221
+ else
222
+ else_part = nil
223
+ end
224
+ SkmConditional.new(aRange.low, theChildren[2], else_part)
225
225
  end
226
226
 
227
227
  # rule('derived_expression' => 'LPAREN LET LPAREN binding_spec_star RPAREN body RPAREN').as 'short_let_form'
@@ -105,7 +105,7 @@ module Skeem
105
105
  end
106
106
 
107
107
  def inspect
108
- result = +"#{inspect_prefix}#{operator.inspect}, "
108
+ result = "#{inspect_prefix}#{operator.inspect}, "
109
109
  result << "@operands #{operands.inspect}#{inspect_suffix}"
110
110
  result
111
111
  end
@@ -146,6 +146,7 @@ module Skeem
146
146
  end
147
147
 
148
148
  # rubocop: disable Style/RedundantAssignment
149
+ # rubocop: disable Lint/UselessRescue
149
150
 
150
151
  def fetch_callee(aRuntime, var_key)
151
152
  begin
@@ -176,6 +177,7 @@ module Skeem
176
177
  callee
177
178
  end
178
179
 
180
+ # rubocop: enable Lint/UselessRescue
179
181
  # rubocop: enable Style/RedundantAssignment
180
182
 
181
183
  def transform_operands(aRuntime)
@@ -229,7 +231,7 @@ module Skeem
229
231
  end
230
232
 
231
233
  def inspect
232
- result = +"#{inspect_prefix}@test #{test.inspect}, "
234
+ result = "#{inspect_prefix}@test #{test.inspect}, "
233
235
  result << "@consequent #{consequent.inspect}, "
234
236
  result << "@alternate #{alternate.inspect}#{inspect_suffix}"
235
237
  result
@@ -277,7 +279,7 @@ module Skeem
277
279
  consequent_qq = consequent.quasiquote(aRuntime)
278
280
  [test_qq, consequent_qq]
279
281
  end
280
- quasi_alternate = alternate ? alternate.quasiquote(aRuntime) : nil
282
+ quasi_alternate = alternate&.quasiquote(aRuntime)
281
283
 
282
284
  self.class.new(position, quasi_clauses, quasi_alternate)
283
285
  end
@@ -21,7 +21,7 @@ module Skeem
21
21
  def self.create(aValue)
22
22
  lightweight = allocate
23
23
  lightweight.init_value(aValue)
24
- return lightweight
24
+ lightweight
25
25
  end
26
26
 
27
27
  def symbol
@@ -62,7 +62,7 @@ module Skeem
62
62
  # Reminder: terminals evaluate to themselves.
63
63
  # @param _runtime [Skeem::Runtime]
64
64
  def evaluate(_runtime)
65
- return self
65
+ self
66
66
  end
67
67
 
68
68
  # Return this object un-evaluated.