dentaku 3.4.0 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +4 -3
  3. data/CHANGELOG.md +28 -0
  4. data/README.md +5 -4
  5. data/dentaku.gemspec +2 -0
  6. data/lib/dentaku/ast/access.rb +6 -0
  7. data/lib/dentaku/ast/arithmetic.rb +5 -1
  8. data/lib/dentaku/ast/array.rb +4 -0
  9. data/lib/dentaku/ast/bitwise.rb +8 -0
  10. data/lib/dentaku/ast/case/case_conditional.rb +4 -0
  11. data/lib/dentaku/ast/case/case_else.rb +6 -0
  12. data/lib/dentaku/ast/case/case_switch_variable.rb +6 -0
  13. data/lib/dentaku/ast/case/case_then.rb +6 -0
  14. data/lib/dentaku/ast/case/case_when.rb +10 -0
  15. data/lib/dentaku/ast/case.rb +6 -0
  16. data/lib/dentaku/ast/comparators.rb +25 -35
  17. data/lib/dentaku/ast/function.rb +6 -8
  18. data/lib/dentaku/ast/functions/all.rb +6 -19
  19. data/lib/dentaku/ast/functions/any.rb +6 -19
  20. data/lib/dentaku/ast/functions/duration.rb +2 -2
  21. data/lib/dentaku/ast/functions/enum.rb +37 -0
  22. data/lib/dentaku/ast/functions/filter.rb +23 -0
  23. data/lib/dentaku/ast/functions/if.rb +4 -0
  24. data/lib/dentaku/ast/functions/map.rb +5 -18
  25. data/lib/dentaku/ast/functions/mul.rb +2 -3
  26. data/lib/dentaku/ast/functions/pluck.rb +8 -7
  27. data/lib/dentaku/ast/functions/ruby_math.rb +6 -3
  28. data/lib/dentaku/ast/functions/sum.rb +2 -3
  29. data/lib/dentaku/ast/functions/xor.rb +44 -0
  30. data/lib/dentaku/ast/identifier.rb +11 -3
  31. data/lib/dentaku/ast/literal.rb +10 -0
  32. data/lib/dentaku/ast/negation.rb +4 -0
  33. data/lib/dentaku/ast/nil.rb +4 -0
  34. data/lib/dentaku/ast/node.rb +4 -0
  35. data/lib/dentaku/ast/operation.rb +9 -0
  36. data/lib/dentaku/ast/string.rb +7 -0
  37. data/lib/dentaku/ast.rb +2 -0
  38. data/lib/dentaku/bulk_expression_solver.rb +5 -3
  39. data/lib/dentaku/calculator.rb +1 -1
  40. data/lib/dentaku/parser.rb +5 -3
  41. data/lib/dentaku/print_visitor.rb +101 -0
  42. data/lib/dentaku/token_scanner.rb +1 -1
  43. data/lib/dentaku/version.rb +1 -1
  44. data/lib/dentaku/visitor/infix.rb +82 -0
  45. data/lib/dentaku.rb +4 -3
  46. data/spec/ast/all_spec.rb +25 -0
  47. data/spec/ast/any_spec.rb +23 -0
  48. data/spec/ast/comparator_spec.rb +6 -9
  49. data/spec/ast/filter_spec.rb +25 -0
  50. data/spec/ast/function_spec.rb +5 -0
  51. data/spec/ast/map_spec.rb +27 -0
  52. data/spec/ast/max_spec.rb +13 -0
  53. data/spec/ast/min_spec.rb +13 -0
  54. data/spec/ast/mul_spec.rb +3 -2
  55. data/spec/ast/pluck_spec.rb +32 -0
  56. data/spec/ast/sum_spec.rb +3 -2
  57. data/spec/ast/xor_spec.rb +35 -0
  58. data/spec/bulk_expression_solver_spec.rb +10 -0
  59. data/spec/calculator_spec.rb +66 -2
  60. data/spec/parser_spec.rb +18 -3
  61. data/spec/print_visitor_spec.rb +66 -0
  62. data/spec/tokenizer_spec.rb +6 -0
  63. data/spec/visitor/infix_spec.rb +31 -0
  64. data/spec/visitor_spec.rb +137 -0
  65. metadata +43 -6
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.4.0
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solomon White
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-07 00:00:00.000000000 Z
11
+ date: 2022-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: concurrent-ruby
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: codecov
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -162,6 +176,8 @@ files:
162
176
  - lib/dentaku/ast/functions/avg.rb
163
177
  - lib/dentaku/ast/functions/count.rb
164
178
  - lib/dentaku/ast/functions/duration.rb
179
+ - lib/dentaku/ast/functions/enum.rb
180
+ - lib/dentaku/ast/functions/filter.rb
165
181
  - lib/dentaku/ast/functions/if.rb
166
182
  - lib/dentaku/ast/functions/map.rb
167
183
  - lib/dentaku/ast/functions/max.rb
@@ -177,6 +193,7 @@ files:
177
193
  - lib/dentaku/ast/functions/string_functions.rb
178
194
  - lib/dentaku/ast/functions/sum.rb
179
195
  - lib/dentaku/ast/functions/switch.rb
196
+ - lib/dentaku/ast/functions/xor.rb
180
197
  - lib/dentaku/ast/grouping.rb
181
198
  - lib/dentaku/ast/identifier.rb
182
199
  - lib/dentaku/ast/literal.rb
@@ -194,6 +211,7 @@ files:
194
211
  - lib/dentaku/exceptions.rb
195
212
  - lib/dentaku/flat_hash.rb
196
213
  - lib/dentaku/parser.rb
214
+ - lib/dentaku/print_visitor.rb
197
215
  - lib/dentaku/string_casing.rb
198
216
  - lib/dentaku/token.rb
199
217
  - lib/dentaku/token_matcher.rb
@@ -201,16 +219,21 @@ files:
201
219
  - lib/dentaku/token_scanner.rb
202
220
  - lib/dentaku/tokenizer.rb
203
221
  - lib/dentaku/version.rb
222
+ - lib/dentaku/visitor/infix.rb
204
223
  - spec/ast/addition_spec.rb
224
+ - spec/ast/all_spec.rb
205
225
  - spec/ast/and_function_spec.rb
206
226
  - spec/ast/and_spec.rb
227
+ - spec/ast/any_spec.rb
207
228
  - spec/ast/arithmetic_spec.rb
208
229
  - spec/ast/avg_spec.rb
209
230
  - spec/ast/case_spec.rb
210
231
  - spec/ast/comparator_spec.rb
211
232
  - spec/ast/count_spec.rb
212
233
  - spec/ast/division_spec.rb
234
+ - spec/ast/filter_spec.rb
213
235
  - spec/ast/function_spec.rb
236
+ - spec/ast/map_spec.rb
214
237
  - spec/ast/max_spec.rb
215
238
  - spec/ast/min_spec.rb
216
239
  - spec/ast/mul_spec.rb
@@ -218,12 +241,14 @@ files:
218
241
  - spec/ast/node_spec.rb
219
242
  - spec/ast/numeric_spec.rb
220
243
  - spec/ast/or_spec.rb
244
+ - spec/ast/pluck_spec.rb
221
245
  - spec/ast/round_spec.rb
222
246
  - spec/ast/rounddown_spec.rb
223
247
  - spec/ast/roundup_spec.rb
224
248
  - spec/ast/string_functions_spec.rb
225
249
  - spec/ast/sum_spec.rb
226
250
  - spec/ast/switch_spec.rb
251
+ - spec/ast/xor_spec.rb
227
252
  - spec/benchmark.rb
228
253
  - spec/bulk_expression_solver_spec.rb
229
254
  - spec/calculator_spec.rb
@@ -231,16 +256,19 @@ files:
231
256
  - spec/exceptions_spec.rb
232
257
  - spec/external_function_spec.rb
233
258
  - spec/parser_spec.rb
259
+ - spec/print_visitor_spec.rb
234
260
  - spec/spec_helper.rb
235
261
  - spec/token_matcher_spec.rb
236
262
  - spec/token_scanner_spec.rb
237
263
  - spec/token_spec.rb
238
264
  - spec/tokenizer_spec.rb
265
+ - spec/visitor/infix_spec.rb
266
+ - spec/visitor_spec.rb
239
267
  homepage: http://github.com/rubysolo/dentaku
240
268
  licenses:
241
269
  - MIT
242
270
  metadata: {}
243
- post_install_message:
271
+ post_install_message:
244
272
  rdoc_options: []
245
273
  require_paths:
246
274
  - lib
@@ -255,21 +283,25 @@ required_rubygems_version: !ruby/object:Gem::Requirement
255
283
  - !ruby/object:Gem::Version
256
284
  version: '0'
257
285
  requirements: []
258
- rubygems_version: 3.1.4
259
- signing_key:
286
+ rubygems_version: 3.3.9
287
+ signing_key:
260
288
  specification_version: 4
261
289
  summary: A formula language parser and evaluator
262
290
  test_files:
263
291
  - spec/ast/addition_spec.rb
292
+ - spec/ast/all_spec.rb
264
293
  - spec/ast/and_function_spec.rb
265
294
  - spec/ast/and_spec.rb
295
+ - spec/ast/any_spec.rb
266
296
  - spec/ast/arithmetic_spec.rb
267
297
  - spec/ast/avg_spec.rb
268
298
  - spec/ast/case_spec.rb
269
299
  - spec/ast/comparator_spec.rb
270
300
  - spec/ast/count_spec.rb
271
301
  - spec/ast/division_spec.rb
302
+ - spec/ast/filter_spec.rb
272
303
  - spec/ast/function_spec.rb
304
+ - spec/ast/map_spec.rb
273
305
  - spec/ast/max_spec.rb
274
306
  - spec/ast/min_spec.rb
275
307
  - spec/ast/mul_spec.rb
@@ -277,12 +309,14 @@ test_files:
277
309
  - spec/ast/node_spec.rb
278
310
  - spec/ast/numeric_spec.rb
279
311
  - spec/ast/or_spec.rb
312
+ - spec/ast/pluck_spec.rb
280
313
  - spec/ast/round_spec.rb
281
314
  - spec/ast/rounddown_spec.rb
282
315
  - spec/ast/roundup_spec.rb
283
316
  - spec/ast/string_functions_spec.rb
284
317
  - spec/ast/sum_spec.rb
285
318
  - spec/ast/switch_spec.rb
319
+ - spec/ast/xor_spec.rb
286
320
  - spec/benchmark.rb
287
321
  - spec/bulk_expression_solver_spec.rb
288
322
  - spec/calculator_spec.rb
@@ -290,8 +324,11 @@ test_files:
290
324
  - spec/exceptions_spec.rb
291
325
  - spec/external_function_spec.rb
292
326
  - spec/parser_spec.rb
327
+ - spec/print_visitor_spec.rb
293
328
  - spec/spec_helper.rb
294
329
  - spec/token_matcher_spec.rb
295
330
  - spec/token_scanner_spec.rb
296
331
  - spec/token_spec.rb
297
332
  - spec/tokenizer_spec.rb
333
+ - spec/visitor/infix_spec.rb
334
+ - spec/visitor_spec.rb