dentaku 3.5.2 → 3.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/README.md +1 -1
- data/dentaku.gemspec +1 -0
- data/lib/dentaku/ast/access.rb +0 -3
- data/lib/dentaku/ast/arithmetic.rb +25 -35
- data/lib/dentaku/ast/array.rb +1 -4
- data/lib/dentaku/ast/functions/all.rb +1 -5
- data/lib/dentaku/ast/functions/any.rb +1 -5
- data/lib/dentaku/ast/functions/enum.rb +13 -0
- data/lib/dentaku/ast/functions/if.rb +3 -7
- data/lib/dentaku/ast/functions/intercept.rb +33 -0
- data/lib/dentaku/ast/functions/map.rb +1 -5
- data/lib/dentaku/ast/functions/pluck.rb +6 -2
- data/lib/dentaku/ast/functions/reduce.rb +61 -0
- data/lib/dentaku/ast/node.rb +2 -1
- data/lib/dentaku/ast.rb +3 -1
- data/lib/dentaku/bulk_expression_solver.rb +37 -7
- data/lib/dentaku/calculator.rb +23 -7
- data/lib/dentaku/date_arithmetic.rb +26 -15
- data/lib/dentaku/dependency_resolver.rb +9 -4
- data/lib/dentaku/exceptions.rb +8 -3
- data/lib/dentaku/parser.rb +8 -5
- data/lib/dentaku/token.rb +12 -0
- data/lib/dentaku/token_scanner.rb +7 -2
- data/lib/dentaku/version.rb +1 -1
- data/spec/ast/addition_spec.rb +4 -4
- data/spec/ast/all_spec.rb +13 -0
- data/spec/ast/any_spec.rb +13 -0
- data/spec/ast/arithmetic_spec.rb +43 -2
- data/spec/ast/division_spec.rb +25 -0
- data/spec/ast/intercept_spec.rb +30 -0
- data/spec/ast/map_spec.rb +13 -0
- data/spec/ast/pluck_spec.rb +17 -0
- data/spec/ast/reduce_spec.rb +22 -0
- data/spec/bulk_expression_solver_spec.rb +33 -0
- data/spec/calculator_spec.rb +66 -7
- data/spec/dependency_resolver_spec.rb +18 -0
- data/spec/parser_spec.rb +3 -0
- data/spec/tokenizer_spec.rb +6 -4
- data/spec/visitor_spec.rb +2 -1
- metadata +25 -3
data/spec/visitor_spec.rb
CHANGED
@@ -108,7 +108,7 @@ describe TestVisitor do
|
|
108
108
|
it 'visits all concrete AST node types' do
|
109
109
|
@visited = Set.new
|
110
110
|
|
111
|
-
visit_nodes('(1 + 7) * (8 ^ 2) / - 3.0 - apples')
|
111
|
+
visit_nodes('(1 + 7) * (8 ^ 2) / - 3.0 - apples * 5%')
|
112
112
|
visit_nodes('1 < 2 and 3 <= 4 or 5 > 6 AND 7 >= 8 OR 9 != 10 and true')
|
113
113
|
visit_nodes('IF(a[0] = NULL, "five", \'seven\')')
|
114
114
|
visit_nodes('case (a % 5) when 0 then a else b end')
|
@@ -122,6 +122,7 @@ describe TestVisitor do
|
|
122
122
|
visit_nodes('duration(1, day)')
|
123
123
|
visit_nodes('MAP(vals, val, val + 1)')
|
124
124
|
visit_nodes('FILTER(vals, val, val > 1)')
|
125
|
+
visit_nodes('REDUCE(vals, memo, val, memo + val)')
|
125
126
|
|
126
127
|
@expected = Set.new(Dentaku::AST::constants - generic_subclasses)
|
127
128
|
expect(@visited.sort).to eq(@expected.sort)
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dentaku
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Solomon White
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bigdecimal
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: concurrent-ruby
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -180,6 +194,7 @@ files:
|
|
180
194
|
- lib/dentaku/ast/functions/enum.rb
|
181
195
|
- lib/dentaku/ast/functions/filter.rb
|
182
196
|
- lib/dentaku/ast/functions/if.rb
|
197
|
+
- lib/dentaku/ast/functions/intercept.rb
|
183
198
|
- lib/dentaku/ast/functions/map.rb
|
184
199
|
- lib/dentaku/ast/functions/max.rb
|
185
200
|
- lib/dentaku/ast/functions/min.rb
|
@@ -187,6 +202,7 @@ files:
|
|
187
202
|
- lib/dentaku/ast/functions/not.rb
|
188
203
|
- lib/dentaku/ast/functions/or.rb
|
189
204
|
- lib/dentaku/ast/functions/pluck.rb
|
205
|
+
- lib/dentaku/ast/functions/reduce.rb
|
190
206
|
- lib/dentaku/ast/functions/round.rb
|
191
207
|
- lib/dentaku/ast/functions/rounddown.rb
|
192
208
|
- lib/dentaku/ast/functions/roundup.rb
|
@@ -235,6 +251,7 @@ files:
|
|
235
251
|
- spec/ast/division_spec.rb
|
236
252
|
- spec/ast/filter_spec.rb
|
237
253
|
- spec/ast/function_spec.rb
|
254
|
+
- spec/ast/intercept_spec.rb
|
238
255
|
- spec/ast/map_spec.rb
|
239
256
|
- spec/ast/max_spec.rb
|
240
257
|
- spec/ast/min_spec.rb
|
@@ -244,6 +261,7 @@ files:
|
|
244
261
|
- spec/ast/numeric_spec.rb
|
245
262
|
- spec/ast/or_spec.rb
|
246
263
|
- spec/ast/pluck_spec.rb
|
264
|
+
- spec/ast/reduce_spec.rb
|
247
265
|
- spec/ast/round_spec.rb
|
248
266
|
- spec/ast/rounddown_spec.rb
|
249
267
|
- spec/ast/roundup_spec.rb
|
@@ -255,6 +273,7 @@ files:
|
|
255
273
|
- spec/bulk_expression_solver_spec.rb
|
256
274
|
- spec/calculator_spec.rb
|
257
275
|
- spec/dentaku_spec.rb
|
276
|
+
- spec/dependency_resolver_spec.rb
|
258
277
|
- spec/exceptions_spec.rb
|
259
278
|
- spec/external_function_spec.rb
|
260
279
|
- spec/parser_spec.rb
|
@@ -285,7 +304,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
285
304
|
- !ruby/object:Gem::Version
|
286
305
|
version: '0'
|
287
306
|
requirements: []
|
288
|
-
rubygems_version: 3.3.
|
307
|
+
rubygems_version: 3.3.9
|
289
308
|
signing_key:
|
290
309
|
specification_version: 4
|
291
310
|
summary: A formula language parser and evaluator
|
@@ -304,6 +323,7 @@ test_files:
|
|
304
323
|
- spec/ast/division_spec.rb
|
305
324
|
- spec/ast/filter_spec.rb
|
306
325
|
- spec/ast/function_spec.rb
|
326
|
+
- spec/ast/intercept_spec.rb
|
307
327
|
- spec/ast/map_spec.rb
|
308
328
|
- spec/ast/max_spec.rb
|
309
329
|
- spec/ast/min_spec.rb
|
@@ -313,6 +333,7 @@ test_files:
|
|
313
333
|
- spec/ast/numeric_spec.rb
|
314
334
|
- spec/ast/or_spec.rb
|
315
335
|
- spec/ast/pluck_spec.rb
|
336
|
+
- spec/ast/reduce_spec.rb
|
316
337
|
- spec/ast/round_spec.rb
|
317
338
|
- spec/ast/rounddown_spec.rb
|
318
339
|
- spec/ast/roundup_spec.rb
|
@@ -324,6 +345,7 @@ test_files:
|
|
324
345
|
- spec/bulk_expression_solver_spec.rb
|
325
346
|
- spec/calculator_spec.rb
|
326
347
|
- spec/dentaku_spec.rb
|
348
|
+
- spec/dependency_resolver_spec.rb
|
327
349
|
- spec/exceptions_spec.rb
|
328
350
|
- spec/external_function_spec.rb
|
329
351
|
- spec/parser_spec.rb
|