skeem 0.2.17 → 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 +241 -13
- data/CHANGELOG.md +9 -0
- data/bin/skeem +4 -4
- data/lib/skeem/datum_dsl.rb +36 -35
- data/lib/skeem/grammar.rb +3 -3
- data/lib/skeem/interpreter.rb +1 -1
- data/lib/skeem/primitive/primitive_builder.rb +7 -12
- data/lib/skeem/primitive/primitive_procedure.rb +6 -5
- data/lib/skeem/runtime.rb +8 -10
- data/lib/skeem/s_expr_builder.rb +3 -13
- data/lib/skeem/s_expr_nodes.rb +34 -44
- data/lib/skeem/skeem_exception.rb +1 -0
- data/lib/skeem/skm_binding.rb +4 -5
- data/lib/skeem/skm_compound_datum.rb +2 -3
- data/lib/skeem/skm_element.rb +1 -1
- data/lib/skeem/skm_pair.rb +5 -2
- data/lib/skeem/skm_procedure_exec.rb +3 -0
- data/lib/skeem/skm_simple_datum.rb +12 -10
- data/lib/skeem/skm_unary_expression.rb +25 -26
- data/lib/skeem/tokenizer.rb +8 -4
- data/lib/skeem/version.rb +1 -1
- data/skeem.gemspec +4 -3
- data/spec/skeem/element_visitor_spec.rb +3 -1
- data/spec/skeem/interpreter_spec.rb +3 -1
- data/spec/skeem/lambda_spec.rb +4 -4
- data/spec/skeem/parser_spec.rb +2 -0
- data/spec/skeem/primitive/primitive_builder_spec.rb +5 -5
- data/spec/skeem/primitive/primitive_procedure_spec.rb +1 -1
- data/spec/skeem/skm_compound_datum_spec.rb +1 -1
- data/spec/skeem/skm_pair_spec.rb +5 -5
- data/spec/skeem/tokenizer_spec.rb +4 -2
- data/spec/spec_helper.rb +13 -10
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8031a69d8a362bbe17e4dabe5fb6ced12ff4ca70f2d6577f5ec13ff81b8bd3ad
|
4
|
+
data.tar.gz: 17f74953cc15cd97d84ede36c17f9d4e97873710d8c94ecfdb50e76019cf3bd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65521fe50624af6e01bacb890ae3b1ddf9f6acb5a1a3a31fd5cfb1b20143101c0aad531a1f3773b50585a6bed8a18380897f47786ecfdc3c53140e7686e17876
|
7
|
+
data.tar.gz: 3a5d8cac363099882da772135498df5c24449eedc6831a2fe09f840764afd12d22ad4fa74589dd92309875407cf77a334fc704d6914a93988debfd65b31a2d35
|
data/.rubocop.yml
CHANGED
@@ -2,6 +2,16 @@ AllCops:
|
|
2
2
|
Exclude:
|
3
3
|
- 'exp/**/*'
|
4
4
|
|
5
|
+
Gemspec/DateAssignment:
|
6
|
+
Enabled: true
|
7
|
+
|
8
|
+
Layout/ArgumentAlignment:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
Layout/ArrayAlignment:
|
12
|
+
Enabled: true
|
13
|
+
EnforcedStyle: with_fixed_indentation
|
14
|
+
|
5
15
|
Layout/CaseIndentation:
|
6
16
|
Enabled: false
|
7
17
|
|
@@ -24,6 +34,12 @@ Layout/EndOfLine:
|
|
24
34
|
Enabled: true
|
25
35
|
EnforcedStyle: lf
|
26
36
|
|
37
|
+
Layout/FirstArgumentIndentation:
|
38
|
+
Enabled: false
|
39
|
+
|
40
|
+
Layout/HashAlignment:
|
41
|
+
Enabled: false
|
42
|
+
|
27
43
|
Layout/IndentationWidth:
|
28
44
|
Enabled: false
|
29
45
|
|
@@ -33,18 +49,28 @@ Layout/IndentationConsistency:
|
|
33
49
|
Layout/HeredocIndentation:
|
34
50
|
Enabled: false
|
35
51
|
|
52
|
+
Layout/LineEndStringConcatenationIndentation:
|
53
|
+
Enabled: true
|
54
|
+
|
36
55
|
Layout/MultilineHashBraceLayout:
|
37
56
|
Enabled: true
|
38
57
|
|
58
|
+
Layout/MultilineMethodCallBraceLayout:
|
59
|
+
Enabled: true
|
60
|
+
EnforcedStyle: same_line
|
61
|
+
|
39
62
|
Layout/SpaceAroundOperators:
|
40
63
|
Enabled: true
|
41
64
|
|
65
|
+
Layout/SpaceBeforeBrackets:
|
66
|
+
Enabled: true
|
67
|
+
|
42
68
|
Layout/SpaceInsideParens:
|
43
69
|
Enabled: true
|
44
70
|
|
45
71
|
Layout/IndentationStyle:
|
46
72
|
Enabled: true
|
47
|
-
|
73
|
+
|
48
74
|
Layout/SpaceAroundMethodCallOperator:
|
49
75
|
Enabled: true
|
50
76
|
|
@@ -54,18 +80,72 @@ Layout/TrailingEmptyLines:
|
|
54
80
|
Layout/TrailingWhitespace:
|
55
81
|
Enabled: true
|
56
82
|
|
83
|
+
Lint/AmbiguousAssignment:
|
84
|
+
Enabled: true
|
85
|
+
|
86
|
+
Lint/AmbiguousRange:
|
87
|
+
Enabled: true
|
88
|
+
|
89
|
+
Lint/DeprecatedConstants:
|
90
|
+
Enabled: true
|
91
|
+
|
92
|
+
Lint/DuplicateBranch:
|
93
|
+
Enabled: true
|
94
|
+
|
95
|
+
Lint/DuplicateRegexpCharacterClassElement:
|
96
|
+
Enabled: true
|
97
|
+
|
98
|
+
Lint/EmptyBlock:
|
99
|
+
Enabled: true
|
100
|
+
|
101
|
+
Lint/EmptyClass:
|
102
|
+
Enabled: false
|
103
|
+
|
104
|
+
Lint/EmptyInPattern:
|
105
|
+
Enabled: true
|
106
|
+
|
107
|
+
Lint/LambdaWithoutLiteralBlock:
|
108
|
+
Enabled: true
|
109
|
+
|
57
110
|
Lint/Loop:
|
58
111
|
Enabled: true
|
59
|
-
|
112
|
+
|
113
|
+
Lint/NoReturnInBeginEndBlocks:
|
114
|
+
Enabled: true
|
115
|
+
|
116
|
+
Lint/NumberedParameterAssignment:
|
117
|
+
Enabled: true
|
118
|
+
|
119
|
+
Lint/OrAssignmentToConstant:
|
120
|
+
Enabled: true
|
121
|
+
|
60
122
|
Lint/RaiseException:
|
61
123
|
Enabled: true
|
62
124
|
|
125
|
+
Lint/RedundantDirGlobSort:
|
126
|
+
Enabled: true
|
127
|
+
|
63
128
|
Lint/RescueException:
|
64
129
|
Enabled: true
|
65
|
-
|
130
|
+
|
66
131
|
Lint/StructNewOverride:
|
67
132
|
Enabled: true
|
68
133
|
|
134
|
+
Lint/SymbolConversion:
|
135
|
+
Enabled: true
|
136
|
+
|
137
|
+
Lint/ToEnumArguments:
|
138
|
+
Enabled: true
|
139
|
+
|
140
|
+
Lint/TripleQuotes:
|
141
|
+
Enabled: true
|
142
|
+
|
143
|
+
Lint/UnexpectedBlockArity:
|
144
|
+
Enabled: true
|
145
|
+
|
146
|
+
Lint/UnmodifiedReduceAccumulator:
|
147
|
+
Enabled: true
|
148
|
+
|
69
149
|
Lint/UnusedMethodArgument:
|
70
150
|
Enabled: true
|
71
151
|
|
@@ -85,9 +165,13 @@ Metrics/BlockLength:
|
|
85
165
|
Enabled: true
|
86
166
|
Max: 350
|
87
167
|
|
168
|
+
Metrics/BlockNesting:
|
169
|
+
Enabled: true
|
170
|
+
Max: 5
|
171
|
+
|
88
172
|
Metrics/ClassLength:
|
89
173
|
Enabled: true
|
90
|
-
Max:
|
174
|
+
Max: 450
|
91
175
|
|
92
176
|
Metrics/CyclomaticComplexity:
|
93
177
|
Enabled: false
|
@@ -98,7 +182,7 @@ Layout/LineLength:
|
|
98
182
|
|
99
183
|
Metrics/MethodLength:
|
100
184
|
Enabled: true
|
101
|
-
Max:
|
185
|
+
Max: 60
|
102
186
|
|
103
187
|
Metrics/ModuleLength:
|
104
188
|
Enabled: true
|
@@ -116,17 +200,26 @@ Naming/ClassAndModuleCamelCase:
|
|
116
200
|
Naming/BlockParameterName:
|
117
201
|
Enabled: true
|
118
202
|
|
203
|
+
Naming/InclusiveLanguage:
|
204
|
+
Enabled: true
|
205
|
+
|
119
206
|
Naming/MethodParameterName:
|
120
207
|
Enabled: false
|
121
208
|
|
209
|
+
Naming/MethodName:
|
210
|
+
Enabled: false
|
211
|
+
|
122
212
|
Naming/VariableName:
|
123
213
|
Enabled: false
|
124
214
|
|
215
|
+
Style/AccessorGrouping:
|
216
|
+
Enabled: false
|
217
|
+
|
125
218
|
Style/Alias:
|
126
219
|
Enabled: true
|
127
220
|
|
128
|
-
|
129
|
-
Enabled:
|
221
|
+
Style/ArgumentsForwarding:
|
222
|
+
Enabled: true
|
130
223
|
|
131
224
|
Style/AsciiComments:
|
132
225
|
Enabled: false
|
@@ -146,6 +239,9 @@ Style/ClassCheck:
|
|
146
239
|
Style/ClassVars:
|
147
240
|
Enabled: false
|
148
241
|
|
242
|
+
Style/CollectionCompact:
|
243
|
+
Enabled: true
|
244
|
+
|
149
245
|
Style/ColonMethodCall:
|
150
246
|
Enabled: false
|
151
247
|
|
@@ -164,46 +260,75 @@ Style/DefWithParentheses:
|
|
164
260
|
Style/Documentation:
|
165
261
|
Enabled: false
|
166
262
|
|
263
|
+
Style/DocumentDynamicEvalDefinition:
|
264
|
+
Enabled: false
|
265
|
+
|
167
266
|
Style/ExpandPathArguments:
|
168
267
|
Enabled: false
|
169
|
-
|
268
|
+
|
170
269
|
Style/ExponentialNotation:
|
171
270
|
Enabled: true
|
172
271
|
|
173
272
|
Style/GuardClause:
|
174
273
|
Enabled: false
|
175
|
-
|
274
|
+
|
176
275
|
Style/HashEachMethods:
|
177
276
|
Enabled: true
|
178
|
-
|
277
|
+
|
278
|
+
Style/HashExcept:
|
279
|
+
Enabled: true
|
280
|
+
|
179
281
|
Style/HashTransformKeys:
|
180
282
|
Enabled: true
|
181
|
-
|
283
|
+
|
182
284
|
Style/HashTransformValues:
|
183
285
|
Enabled: true
|
184
286
|
|
185
|
-
|
186
287
|
Style/IfUnlessModifier:
|
187
288
|
Enabled: false
|
188
289
|
|
290
|
+
Style/InPatternThen:
|
291
|
+
Enabled: true
|
292
|
+
|
189
293
|
Style/InverseMethods:
|
294
|
+
Enabled: false
|
295
|
+
|
296
|
+
Style/MissingRespondToMissing:
|
297
|
+
Enabled: false
|
298
|
+
|
299
|
+
Style/MultilineInPatternThen:
|
300
|
+
Enabled: true
|
301
|
+
|
302
|
+
Style/NegatedIfElseCondition:
|
190
303
|
Enabled: true
|
191
304
|
|
192
305
|
Style/Next:
|
193
306
|
Enabled: false
|
194
307
|
|
308
|
+
Style/NilLambda:
|
309
|
+
Enabled: true
|
310
|
+
|
195
311
|
Style/NumericLiterals:
|
196
312
|
Enabled: false
|
197
313
|
|
314
|
+
Style/QuotedSymbols:
|
315
|
+
Enabled: true
|
316
|
+
|
198
317
|
Style/RaiseArgs:
|
199
318
|
Enabled: true
|
200
319
|
|
320
|
+
Style/RedundantArgument:
|
321
|
+
Enabled: true
|
322
|
+
|
201
323
|
Style/RedundantReturn:
|
202
324
|
Enabled: false
|
203
325
|
|
204
326
|
Style/RedundantSelf:
|
205
327
|
Enabled: true
|
206
328
|
|
329
|
+
Style/RedundantSelfAssignmentBranch:
|
330
|
+
Enabled: true
|
331
|
+
|
207
332
|
Style/RegexpLiteral:
|
208
333
|
Enabled: false
|
209
334
|
|
@@ -216,8 +341,111 @@ Style/StderrPuts:
|
|
216
341
|
Style/StringLiterals:
|
217
342
|
Enabled: true
|
218
343
|
|
344
|
+
Style/SwapValues:
|
345
|
+
Enabled: true
|
346
|
+
|
219
347
|
Style/TernaryParentheses:
|
220
348
|
Enabled: false
|
221
349
|
|
222
350
|
Style/UnlessElse:
|
223
|
-
Enabled: false
|
351
|
+
Enabled: false
|
352
|
+
|
353
|
+
# Rubocop complains when it doesn't find an explicit setting for the following cops:
|
354
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
355
|
+
Enabled: true
|
356
|
+
|
357
|
+
Lint/BinaryOperatorWithIdenticalOperands:
|
358
|
+
Enabled: true
|
359
|
+
|
360
|
+
Lint/DeprecatedOpenSSLConstant:
|
361
|
+
Enabled: true
|
362
|
+
|
363
|
+
Lint/DuplicateElsifCondition:
|
364
|
+
Enabled: true
|
365
|
+
|
366
|
+
Lint/DuplicateRescueException:
|
367
|
+
Enabled: true
|
368
|
+
|
369
|
+
Lint/EmptyConditionalBody:
|
370
|
+
Enabled: true
|
371
|
+
|
372
|
+
Lint/FloatComparison:
|
373
|
+
Enabled: true
|
374
|
+
|
375
|
+
Lint/MissingSuper:
|
376
|
+
Enabled: true
|
377
|
+
|
378
|
+
Lint/MixedRegexpCaptureTypes:
|
379
|
+
Enabled: true
|
380
|
+
|
381
|
+
Lint/OutOfRangeRegexpRef:
|
382
|
+
Enabled: true
|
383
|
+
|
384
|
+
Lint/SelfAssignment:
|
385
|
+
Enabled: true
|
386
|
+
|
387
|
+
Lint/TopLevelReturnWithArgument:
|
388
|
+
Enabled: true
|
389
|
+
|
390
|
+
Lint/UnreachableLoop:
|
391
|
+
Enabled: true
|
392
|
+
|
393
|
+
Style/ArrayCoercion:
|
394
|
+
Enabled: true
|
395
|
+
|
396
|
+
Style/BisectedAttrAccessor:
|
397
|
+
Enabled: true
|
398
|
+
|
399
|
+
Style/CaseLikeIf:
|
400
|
+
Enabled: true
|
401
|
+
|
402
|
+
Style/EndlessMethod:
|
403
|
+
Enabled: true
|
404
|
+
|
405
|
+
Style/ExplicitBlockArgument:
|
406
|
+
Enabled: true
|
407
|
+
|
408
|
+
Style/GlobalStdStream:
|
409
|
+
Enabled: true
|
410
|
+
|
411
|
+
Style/HashAsLastArrayItem:
|
412
|
+
Enabled: true
|
413
|
+
|
414
|
+
Style/HashConversion:
|
415
|
+
Enabled: true
|
416
|
+
|
417
|
+
Style/HashLikeCase:
|
418
|
+
Enabled: true
|
419
|
+
|
420
|
+
Style/IfWithBooleanLiteralBranches:
|
421
|
+
Enabled: true
|
422
|
+
|
423
|
+
Style/OptionalBooleanParameter:
|
424
|
+
Enabled: true
|
425
|
+
|
426
|
+
Style/RedundantAssignment:
|
427
|
+
Enabled: true
|
428
|
+
|
429
|
+
Style/RedundantFetchBlock:
|
430
|
+
Enabled: true
|
431
|
+
|
432
|
+
Style/RedundantFileExtensionInRequire:
|
433
|
+
Enabled: true
|
434
|
+
|
435
|
+
Style/RedundantRegexpCharacterClass:
|
436
|
+
Enabled: true
|
437
|
+
|
438
|
+
Style/RedundantRegexpEscape:
|
439
|
+
Enabled: true
|
440
|
+
|
441
|
+
Style/SingleArgumentDig:
|
442
|
+
Enabled: true
|
443
|
+
|
444
|
+
Style/SlicingWithRange:
|
445
|
+
Enabled: true
|
446
|
+
|
447
|
+
Style/StringChars:
|
448
|
+
Enabled: true
|
449
|
+
|
450
|
+
Style/StringConcatenation:
|
451
|
+
Enabled: true
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## [0.2.18] - 2021-08-29
|
2
|
+
- Minor refactoring for Rley 0.8.03
|
3
|
+
- Code restyling to please rubocop 1.19.1.
|
4
|
+
|
5
|
+
### Changed
|
6
|
+
- File `.rubocop.yml` updated with newer Rubocop cops
|
7
|
+
- File `grammar.rb`: Calling `Rley::grammar_builder`, replace `LET*` token by `LET_STAR`
|
8
|
+
- Other files changed to get rid of Rubocop offences
|
9
|
+
|
1
10
|
## [0.2.17] - 2020-05-09
|
2
11
|
- Updated `.rubocop.yml` file.
|
3
12
|
- Code restyling to please rubocop 0.8.0.
|
data/bin/skeem
CHANGED
@@ -25,10 +25,10 @@ class SkeemREPL
|
|
25
25
|
if File.exist?(aFilename)
|
26
26
|
valid_fname = aFilename
|
27
27
|
elsif File.extname(aFilename).empty? # Retry by adding extension...
|
28
|
-
if File.exist?(aFilename
|
29
|
-
valid_fname = aFilename
|
30
|
-
elsif File.exist?(aFilename
|
31
|
-
valid_fname = aFilename
|
28
|
+
if File.exist?("#{aFilename}.skm")
|
29
|
+
valid_fname = "#{aFilename}.skm"
|
30
|
+
elsif File.exist?("#{aFilename}.scm")
|
31
|
+
valid_fname = "#{aFilename}.scm"
|
32
32
|
else
|
33
33
|
valid_fname = nil
|
34
34
|
end
|
data/lib/skeem/datum_dsl.rb
CHANGED
@@ -11,7 +11,7 @@ module Skeem
|
|
11
11
|
def boolean(aBoolean)
|
12
12
|
return aBoolean if aBoolean.kind_of?(SkmBoolean)
|
13
13
|
|
14
|
-
|
14
|
+
case aBoolean
|
15
15
|
when TrueClass, FalseClass
|
16
16
|
SkmBoolean.create(aBoolean)
|
17
17
|
when /^#t(?:rue)?|true$/
|
@@ -21,13 +21,12 @@ module Skeem
|
|
21
21
|
else
|
22
22
|
raise StandardError, aBoolean.inspect
|
23
23
|
end
|
24
|
-
result
|
25
24
|
end
|
26
25
|
|
27
26
|
def integer(aLiteral)
|
28
27
|
return aLiteral if aLiteral.kind_of?(SkmInteger)
|
29
28
|
|
30
|
-
|
29
|
+
case aLiteral
|
31
30
|
when Integer
|
32
31
|
SkmInteger.create(aLiteral)
|
33
32
|
when /^[+-]?\d+$/
|
@@ -35,13 +34,12 @@ module Skeem
|
|
35
34
|
else
|
36
35
|
raise StandardError, aLiteral.inspect
|
37
36
|
end
|
38
|
-
result
|
39
37
|
end
|
40
38
|
|
41
39
|
def rational(aLiteral)
|
42
40
|
return aLiteral if aLiteral.kind_of?(SkmRational)
|
43
41
|
|
44
|
-
|
42
|
+
case aLiteral
|
45
43
|
when Rational
|
46
44
|
SkmRational.create(aLiteral)
|
47
45
|
when /^[+-]?\d+\/\d+$/
|
@@ -49,13 +47,12 @@ module Skeem
|
|
49
47
|
else
|
50
48
|
raise StandardError, aLiteral.inspect
|
51
49
|
end
|
52
|
-
result
|
53
50
|
end
|
54
51
|
|
55
52
|
def real(aLiteral)
|
56
53
|
return aLiteral if aLiteral.kind_of?(SkmReal)
|
57
54
|
|
58
|
-
|
55
|
+
case aLiteral
|
59
56
|
when Numeric
|
60
57
|
SkmReal.create(aLiteral)
|
61
58
|
when /^[+-]?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?$/
|
@@ -63,13 +60,12 @@ module Skeem
|
|
63
60
|
else
|
64
61
|
raise StandardError, aLiteral.inspect
|
65
62
|
end
|
66
|
-
result
|
67
63
|
end
|
68
64
|
|
69
65
|
def char(aLiteral)
|
70
66
|
return aLiteral if aLiteral.kind_of?(SkmChar)
|
71
67
|
|
72
|
-
|
68
|
+
case aLiteral
|
73
69
|
when Numeric
|
74
70
|
SkmChar.create_from_int(aLiteral)
|
75
71
|
when String
|
@@ -81,13 +77,12 @@ module Skeem
|
|
81
77
|
else
|
82
78
|
raise StandardError, aLiteral.inspect
|
83
79
|
end
|
84
|
-
result
|
85
80
|
end
|
86
81
|
|
87
82
|
def string(aLiteral)
|
88
83
|
return aLiteral if aLiteral.kind_of?(SkmString)
|
89
84
|
|
90
|
-
|
85
|
+
case aLiteral
|
91
86
|
when String
|
92
87
|
SkmString.create(aLiteral)
|
93
88
|
when SkmIdentifier
|
@@ -95,13 +90,12 @@ module Skeem
|
|
95
90
|
else
|
96
91
|
SkmString.create(aLiteral.to_s)
|
97
92
|
end
|
98
|
-
result
|
99
93
|
end
|
100
94
|
|
101
95
|
def identifier(aLiteral)
|
102
96
|
return aLiteral if aLiteral.kind_of?(SkmIdentifier)
|
103
97
|
|
104
|
-
|
98
|
+
case aLiteral
|
105
99
|
when String
|
106
100
|
SkmIdentifier.create(aLiteral)
|
107
101
|
when SkmString
|
@@ -109,13 +103,12 @@ module Skeem
|
|
109
103
|
else
|
110
104
|
raise StandardError, aLiteral.inspect
|
111
105
|
end
|
112
|
-
result
|
113
106
|
end
|
114
107
|
|
115
108
|
alias symbol identifier
|
116
109
|
|
117
110
|
def list(aLiteral)
|
118
|
-
|
111
|
+
case aLiteral
|
119
112
|
when Array
|
120
113
|
SkmPair.create_from_a(to_datum(aLiteral))
|
121
114
|
when SkmPair
|
@@ -123,12 +116,10 @@ module Skeem
|
|
123
116
|
else
|
124
117
|
SkmPair.new(to_datum(aLiteral), SkmEmptyList.instance)
|
125
118
|
end
|
126
|
-
|
127
|
-
result
|
128
119
|
end
|
129
120
|
|
130
121
|
def vector(aLiteral)
|
131
|
-
|
122
|
+
case aLiteral
|
132
123
|
when Array
|
133
124
|
SkmVector.new(to_datum(aLiteral))
|
134
125
|
when SkmVector
|
@@ -136,8 +127,6 @@ module Skeem
|
|
136
127
|
else
|
137
128
|
SkmVector.new([to_datum(aLiteral)])
|
138
129
|
end
|
139
|
-
|
140
|
-
result
|
141
130
|
end
|
142
131
|
|
143
132
|
# Conversion from Ruby object value to Skeem datum
|
@@ -146,7 +135,7 @@ module Skeem
|
|
146
135
|
return vector(aLiteral.members) if aLiteral.kind_of?(SkmVector)
|
147
136
|
return aLiteral if aLiteral.kind_of?(Primitive::PrimitiveProcedure)
|
148
137
|
|
149
|
-
|
138
|
+
case aLiteral
|
150
139
|
when Array
|
151
140
|
aLiteral.map { |elem| to_datum(elem) }
|
152
141
|
when Integer
|
@@ -166,25 +155,37 @@ module Skeem
|
|
166
155
|
aLiteral
|
167
156
|
else
|
168
157
|
raise StandardError, aLiteral.inspect
|
169
|
-
|
170
|
-
result
|
158
|
+
end
|
171
159
|
end
|
172
160
|
|
173
161
|
private
|
174
162
|
|
175
163
|
def parse_literal(aLiteral)
|
176
|
-
if aLiteral =~ /^#t(?:rue)?|true$/
|
177
|
-
boolean(aLiteral)
|
178
|
-
elsif aLiteral =~ /^#f(?:alse)?|false$/
|
179
|
-
boolean(aLiteral)
|
180
|
-
elsif aLiteral =~ /^[+-]?\d+\/\d+$/
|
181
|
-
rational(aLiteral)
|
182
|
-
elsif aLiteral =~ /^[+-]?\d+$/
|
183
|
-
integer(aLiteral)
|
184
|
-
elsif aLiteral =~ /^[+-]?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?$/
|
185
|
-
real(aLiteral)
|
186
|
-
else
|
187
|
-
string(aLiteral)
|
164
|
+
# if aLiteral =~ /^#t(?:rue)?|true$/
|
165
|
+
# boolean(aLiteral)
|
166
|
+
# elsif aLiteral =~ /^#f(?:alse)?|false$/
|
167
|
+
# boolean(aLiteral)
|
168
|
+
# elsif aLiteral =~ /^[+-]?\d+\/\d+$/
|
169
|
+
# rational(aLiteral)
|
170
|
+
# elsif aLiteral =~ /^[+-]?\d+$/
|
171
|
+
# integer(aLiteral)
|
172
|
+
# elsif aLiteral =~ /^[+-]?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?$/
|
173
|
+
# real(aLiteral)
|
174
|
+
# else
|
175
|
+
# string(aLiteral)
|
176
|
+
# end
|
177
|
+
|
178
|
+
case aLiteral
|
179
|
+
when /^#t(?:rue)?|true$/, /^#f(?:alse)?|false$/
|
180
|
+
boolean(aLiteral)
|
181
|
+
when /^[+-]?\d+\/\d+$/
|
182
|
+
rational(aLiteral)
|
183
|
+
when /^[+-]?\d+$/
|
184
|
+
integer(aLiteral)
|
185
|
+
when /^[+-]?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?$/
|
186
|
+
real(aLiteral)
|
187
|
+
else
|
188
|
+
string(aLiteral)
|
188
189
|
end
|
189
190
|
end
|
190
191
|
end # module
|