gqlite 1.2.0 → 1.2.3

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 (85) hide show
  1. checksums.yaml +4 -4
  2. data/ext/gqliterb/.cargo/config.toml +2 -0
  3. data/ext/gqliterb/Cargo.lock +152 -135
  4. data/ext/gqliterb/Cargo.toml +4 -6
  5. data/ext/gqliterb/src/lib.rs +8 -2
  6. data/ext/gqliterb/vendor/gqlitedb/Cargo.lock +2115 -0
  7. data/ext/gqliterb/vendor/gqlitedb/Cargo.toml +138 -0
  8. data/ext/gqliterb/vendor/gqlitedb/askama.toml +3 -0
  9. data/ext/gqliterb/vendor/gqlitedb/benches/common/mod.rs +25 -0
  10. data/ext/gqliterb/vendor/gqlitedb/benches/common/pokec.rs +185 -0
  11. data/ext/gqliterb/vendor/gqlitedb/benches/pokec_divan.rs +137 -0
  12. data/ext/gqliterb/vendor/gqlitedb/benches/pokec_iai.rs +122 -0
  13. data/ext/gqliterb/vendor/gqlitedb/release.toml +7 -0
  14. data/ext/gqliterb/vendor/gqlitedb/src/aggregators/arithmetic.rs +96 -0
  15. data/ext/gqliterb/vendor/gqlitedb/src/aggregators/containers.rs +33 -0
  16. data/ext/gqliterb/vendor/gqlitedb/src/aggregators/count.rs +35 -0
  17. data/ext/gqliterb/vendor/gqlitedb/src/aggregators/stats.rs +168 -0
  18. data/ext/gqliterb/vendor/gqlitedb/src/aggregators.rs +74 -0
  19. data/ext/gqliterb/vendor/gqlitedb/src/capi.rs +259 -0
  20. data/ext/gqliterb/vendor/gqlitedb/src/compiler/expression_analyser.rs +431 -0
  21. data/ext/gqliterb/vendor/gqlitedb/src/compiler/variables_manager.rs +621 -0
  22. data/ext/gqliterb/vendor/gqlitedb/src/compiler.rs +1115 -0
  23. data/ext/gqliterb/vendor/gqlitedb/src/connection.rs +342 -0
  24. data/ext/gqliterb/vendor/gqlitedb/src/consts.rs +10 -0
  25. data/ext/gqliterb/vendor/gqlitedb/src/error.rs +613 -0
  26. data/ext/gqliterb/vendor/gqlitedb/src/functions/containers.rs +115 -0
  27. data/ext/gqliterb/vendor/gqlitedb/src/functions/edge.rs +20 -0
  28. data/ext/gqliterb/vendor/gqlitedb/src/functions/math.rs +44 -0
  29. data/ext/gqliterb/vendor/gqlitedb/src/functions/node.rs +16 -0
  30. data/ext/gqliterb/vendor/gqlitedb/src/functions/path.rs +80 -0
  31. data/ext/gqliterb/vendor/gqlitedb/src/functions/scalar.rs +86 -0
  32. data/ext/gqliterb/vendor/gqlitedb/src/functions/string.rs +28 -0
  33. data/ext/gqliterb/vendor/gqlitedb/src/functions/value.rs +99 -0
  34. data/ext/gqliterb/vendor/gqlitedb/src/functions.rs +410 -0
  35. data/ext/gqliterb/vendor/gqlitedb/src/graph.rs +283 -0
  36. data/ext/gqliterb/vendor/gqlitedb/src/interpreter/evaluators.rs +1776 -0
  37. data/ext/gqliterb/vendor/gqlitedb/src/interpreter/instructions.rs +267 -0
  38. data/ext/gqliterb/vendor/gqlitedb/src/interpreter/mod.rs +4 -0
  39. data/ext/gqliterb/vendor/gqlitedb/src/lib.rs +41 -0
  40. data/ext/gqliterb/vendor/gqlitedb/src/parser/ast.rs +611 -0
  41. data/ext/gqliterb/vendor/gqlitedb/src/parser/gql.pest +196 -0
  42. data/ext/gqliterb/vendor/gqlitedb/src/parser/parser.rs +1183 -0
  43. data/ext/gqliterb/vendor/gqlitedb/src/parser.rs +4 -0
  44. data/ext/gqliterb/vendor/gqlitedb/src/prelude.rs +8 -0
  45. data/ext/gqliterb/vendor/gqlitedb/src/serialize_with.rs +94 -0
  46. data/ext/gqliterb/vendor/gqlitedb/src/store/pgql.rs +121 -0
  47. data/ext/gqliterb/vendor/gqlitedb/src/store/redb.rs +1262 -0
  48. data/ext/gqliterb/vendor/gqlitedb/src/store/sqlite.rs +1026 -0
  49. data/ext/gqliterb/vendor/gqlitedb/src/store.rs +439 -0
  50. data/ext/gqliterb/vendor/gqlitedb/src/tests/compiler.rs +92 -0
  51. data/ext/gqliterb/vendor/gqlitedb/src/tests/evaluators.rs +227 -0
  52. data/ext/gqliterb/vendor/gqlitedb/src/tests/parser.rs +81 -0
  53. data/ext/gqliterb/vendor/gqlitedb/src/tests/store/redb.rs +46 -0
  54. data/ext/gqliterb/vendor/gqlitedb/src/tests/store/sqlite.rs +46 -0
  55. data/ext/gqliterb/vendor/gqlitedb/src/tests/store.rs +470 -0
  56. data/ext/gqliterb/vendor/gqlitedb/src/tests/templates/ast.rs +356 -0
  57. data/ext/gqliterb/vendor/gqlitedb/src/tests/templates/programs.rs +455 -0
  58. data/ext/gqliterb/vendor/gqlitedb/src/tests/templates.rs +2 -0
  59. data/ext/gqliterb/vendor/gqlitedb/src/tests.rs +39 -0
  60. data/ext/gqliterb/vendor/gqlitedb/src/utils.rs +28 -0
  61. data/ext/gqliterb/vendor/gqlitedb/src/value/compare.rs +212 -0
  62. data/ext/gqliterb/vendor/gqlitedb/src/value/contains.rs +47 -0
  63. data/ext/gqliterb/vendor/gqlitedb/src/value/value_map.rs +298 -0
  64. data/ext/gqliterb/vendor/gqlitedb/src/value.rs +609 -0
  65. data/ext/gqliterb/vendor/gqlitedb/src/value_table.rs +610 -0
  66. data/ext/gqliterb/vendor/gqlitedb/templates/sql/sqlite/call_stats.sql +22 -0
  67. data/ext/gqliterb/vendor/gqlitedb/templates/sql/sqlite/edge_count_for_node.sql +3 -0
  68. data/ext/gqliterb/vendor/gqlitedb/templates/sql/sqlite/edge_create.sql +6 -0
  69. data/ext/gqliterb/vendor/gqlitedb/templates/sql/sqlite/edge_delete.sql +1 -0
  70. data/ext/gqliterb/vendor/gqlitedb/templates/sql/sqlite/edge_delete_by_nodes.sql +2 -0
  71. data/ext/gqliterb/vendor/gqlitedb/templates/sql/sqlite/edge_select.sql +139 -0
  72. data/ext/gqliterb/vendor/gqlitedb/templates/sql/sqlite/edge_update.sql +4 -0
  73. data/ext/gqliterb/vendor/gqlitedb/templates/sql/sqlite/graph_create.sql +16 -0
  74. data/ext/gqliterb/vendor/gqlitedb/templates/sql/sqlite/graph_delete.sql +3 -0
  75. data/ext/gqliterb/vendor/gqlitedb/templates/sql/sqlite/metadata_create_table.sql +1 -0
  76. data/ext/gqliterb/vendor/gqlitedb/templates/sql/sqlite/metadata_get.sql +1 -0
  77. data/ext/gqliterb/vendor/gqlitedb/templates/sql/sqlite/metadata_set.sql +1 -0
  78. data/ext/gqliterb/vendor/gqlitedb/templates/sql/sqlite/node_create.sql +1 -0
  79. data/ext/gqliterb/vendor/gqlitedb/templates/sql/sqlite/node_delete.sql +1 -0
  80. data/ext/gqliterb/vendor/gqlitedb/templates/sql/sqlite/node_select.sql +42 -0
  81. data/ext/gqliterb/vendor/gqlitedb/templates/sql/sqlite/node_update.sql +4 -0
  82. data/ext/gqliterb/vendor/gqlitedb/templates/sql/sqlite/table_exists.sql +5 -0
  83. data/ext/gqliterb/vendor/gqlitedb/templates/sql/sqlite/upgrade_from_1_01.sql +2 -0
  84. data/ext/gqliterb/vendor/gqlitedb/templates/sql/sqlite/upgrade_graph_from_1_01.sql +65 -0
  85. metadata +82 -2
@@ -0,0 +1,611 @@
1
+ use std::{
2
+ cell::RefCell,
3
+ collections::{hash_map::Entry, HashMap},
4
+ sync::atomic::AtomicU64,
5
+ };
6
+
7
+ use crate::graph;
8
+
9
+ /// Represent a variable name. Some variable are explicitly created by the parser, if a node/edge should be considered equal and appear in different expression.
10
+ /// For instance `()-[]->()-[]->()` needs the creation of a variable.
11
+ #[derive(Debug, Clone, Eq)]
12
+ pub(crate) struct VariableIdentifier
13
+ {
14
+ /// Name of the variable, only useful for debug purposes
15
+ name: String,
16
+ /// Unique identifier of the variable, the uniqueness is only guaranteed within a compilation unit.
17
+ id: u64,
18
+ }
19
+
20
+ impl VariableIdentifier
21
+ {
22
+ pub(crate) fn name(&self) -> &String
23
+ {
24
+ &self.name
25
+ }
26
+ pub(crate) fn take_name(self) -> String
27
+ {
28
+ self.name
29
+ }
30
+ }
31
+
32
+ impl PartialEq for VariableIdentifier
33
+ {
34
+ fn eq(&self, other: &Self) -> bool
35
+ {
36
+ self.id == other.id
37
+ }
38
+ }
39
+
40
+ impl std::hash::Hash for VariableIdentifier
41
+ {
42
+ fn hash<H: std::hash::Hasher>(&self, state: &mut H)
43
+ {
44
+ self.id.hash(state);
45
+ }
46
+ }
47
+
48
+ #[derive(Default)]
49
+ pub(crate) struct VariableIdentifiers
50
+ {
51
+ next_id: AtomicU64,
52
+ identifiers: RefCell<HashMap<String, VariableIdentifier>>,
53
+ }
54
+
55
+ impl VariableIdentifiers
56
+ {
57
+ fn next_id(&self) -> u64
58
+ {
59
+ self
60
+ .next_id
61
+ .fetch_add(1, std::sync::atomic::Ordering::Relaxed)
62
+ }
63
+ pub(crate) fn from_name(&self, name: impl Into<String>) -> VariableIdentifier
64
+ {
65
+ let name = name.into();
66
+ match self.identifiers.borrow_mut().entry(name)
67
+ {
68
+ Entry::Occupied(entry) => entry.get().clone(),
69
+ Entry::Vacant(entry) =>
70
+ {
71
+ let vn = VariableIdentifier {
72
+ name: entry.key().clone(),
73
+ id: self.next_id(),
74
+ };
75
+ entry.insert(vn.clone());
76
+ vn
77
+ }
78
+ }
79
+ }
80
+ pub(crate) fn from_name_optional(&self, name: Option<String>) -> Option<VariableIdentifier>
81
+ {
82
+ name.map(|name| self.from_name(name))
83
+ }
84
+ pub(crate) fn anonymous(&self) -> VariableIdentifier
85
+ {
86
+ let id = self.next_id();
87
+ VariableIdentifier {
88
+ name: format!("anonymous_{}", id),
89
+ id,
90
+ }
91
+ }
92
+ }
93
+
94
+ #[derive(Debug)]
95
+ pub(crate) enum Statement
96
+ {
97
+ CreateGraph(CreateGraph),
98
+ DropGraph(DropGraph),
99
+ UseGraph(UseGraph),
100
+ Create(Create),
101
+ Match(Match),
102
+ Return(Return),
103
+ Call(Call),
104
+ With(With),
105
+ Unwind(Unwind),
106
+ Delete(Delete),
107
+ Update(Update),
108
+ }
109
+
110
+ macro_rules! create_into_statement {
111
+ ( $x:tt ) => {
112
+ impl Into<Statement> for $x
113
+ {
114
+ fn into(self) -> Statement
115
+ {
116
+ Statement::$x(self)
117
+ }
118
+ }
119
+ };
120
+ }
121
+
122
+ pub(crate) type Statements = Vec<Statement>;
123
+ pub(crate) type Queries = Vec<Statements>;
124
+
125
+ #[derive(Debug)]
126
+ pub(crate) struct CreateGraph
127
+ {
128
+ pub(crate) name: String,
129
+ }
130
+
131
+ #[derive(Debug)]
132
+ pub(crate) struct DropGraph
133
+ {
134
+ pub(crate) name: String,
135
+ pub(crate) if_exists: bool,
136
+ }
137
+
138
+ #[derive(Debug)]
139
+ pub(crate) struct UseGraph
140
+ {
141
+ pub(crate) name: String,
142
+ }
143
+
144
+ #[derive(Debug)]
145
+ pub(crate) struct Create
146
+ {
147
+ pub(crate) patterns: Vec<Pattern>,
148
+ }
149
+
150
+ create_into_statement! {Create}
151
+
152
+ #[derive(Debug)]
153
+ pub(crate) struct Match
154
+ {
155
+ pub(crate) patterns: Vec<Pattern>,
156
+ pub(crate) where_expression: Option<Expression>,
157
+ pub(crate) optional: bool,
158
+ }
159
+
160
+ create_into_statement! {Match}
161
+
162
+ #[derive(Debug)]
163
+ pub(crate) struct Return
164
+ {
165
+ pub(crate) all: bool,
166
+ pub(crate) expressions: Vec<NamedExpression>,
167
+ pub(crate) modifiers: Modifiers,
168
+ pub(crate) where_expression: Option<Expression>,
169
+ }
170
+
171
+ create_into_statement! {Return}
172
+
173
+ #[derive(Debug)]
174
+ pub(crate) struct With
175
+ {
176
+ pub(crate) all: bool,
177
+ pub(crate) expressions: Vec<NamedExpression>,
178
+ pub(crate) modifiers: Modifiers,
179
+ pub(crate) where_expression: Option<Expression>,
180
+ }
181
+
182
+ create_into_statement! {With}
183
+
184
+ #[derive(Debug)]
185
+ pub(crate) struct Unwind
186
+ {
187
+ pub(crate) identifier: VariableIdentifier,
188
+ pub(crate) expression: Expression,
189
+ }
190
+
191
+ create_into_statement! {Unwind}
192
+
193
+ #[derive(Debug)]
194
+ pub(crate) struct Delete
195
+ {
196
+ pub(crate) detach: bool,
197
+ pub(crate) expressions: Vec<Expression>,
198
+ }
199
+
200
+ #[derive(Debug)]
201
+ pub(crate) struct Update
202
+ {
203
+ pub(crate) updates: Vec<OneUpdate>,
204
+ }
205
+
206
+ #[derive(Debug)]
207
+ pub(crate) struct Call
208
+ {
209
+ pub(crate) name: String,
210
+ pub(crate) arguments: Vec<Expression>,
211
+ }
212
+
213
+ // Set/remove Statements
214
+
215
+ #[derive(Debug)]
216
+ pub(crate) enum OneUpdate
217
+ {
218
+ SetProperty(UpdateProperty),
219
+ AddProperty(UpdateProperty),
220
+ RemoveProperty(RemoveProperty),
221
+ AddLabels(AddRemoveLabels),
222
+ RemoveLabels(AddRemoveLabels),
223
+ }
224
+
225
+ #[derive(Debug)]
226
+ pub(crate) struct UpdateProperty
227
+ {
228
+ pub(crate) target: VariableIdentifier,
229
+ pub(crate) path: Vec<String>,
230
+ pub(crate) expression: Expression,
231
+ }
232
+
233
+ #[derive(Debug)]
234
+ pub(crate) struct RemoveProperty
235
+ {
236
+ pub(crate) target: VariableIdentifier,
237
+ pub(crate) path: Vec<String>,
238
+ }
239
+
240
+ #[derive(Debug)]
241
+ pub(crate) struct AddRemoveLabels
242
+ {
243
+ pub(crate) target: VariableIdentifier,
244
+ pub(crate) labels: Vec<String>,
245
+ }
246
+
247
+ // Modifiers
248
+
249
+ #[derive(Debug)]
250
+ pub(crate) struct OrderBy
251
+ {
252
+ pub(crate) expressions: Vec<OrderByExpression>,
253
+ }
254
+
255
+ #[derive(Default, Debug)]
256
+ pub(crate) struct Modifiers
257
+ {
258
+ pub(crate) skip: Option<Expression>,
259
+ pub(crate) limit: Option<Expression>,
260
+ pub(crate) order_by: Option<OrderBy>,
261
+ }
262
+
263
+ // Expressions
264
+
265
+ #[derive(Debug, Clone, PartialEq)]
266
+ pub(crate) enum Expression
267
+ {
268
+ Array(Array),
269
+ FunctionCall(FunctionCall),
270
+ Map(Map),
271
+ IndexAccess(Box<IndexAccess>),
272
+ RangeAccess(Box<RangeAccess>),
273
+ MemberAccess(Box<MemberAccess>),
274
+ Parameter(Parameter),
275
+ Value(Value),
276
+ Variable(Variable),
277
+
278
+ LogicalAnd(Box<LogicalAnd>),
279
+ LogicalOr(Box<LogicalOr>),
280
+ LogicalXor(Box<LogicalXor>),
281
+ RelationalEqual(Box<RelationalEqual>),
282
+ RelationalDifferent(Box<RelationalDifferent>),
283
+ RelationalInferior(Box<RelationalInferior>),
284
+ RelationalSuperior(Box<RelationalSuperior>),
285
+ RelationalInferiorEqual(Box<RelationalInferiorEqual>),
286
+ RelationalSuperiorEqual(Box<RelationalSuperiorEqual>),
287
+ RelationalIn(Box<RelationalIn>),
288
+ RelationalNotIn(Box<RelationalNotIn>),
289
+
290
+ Addition(Box<Addition>),
291
+ Subtraction(Box<Subtraction>),
292
+ Multiplication(Box<Multiplication>),
293
+ Division(Box<Division>),
294
+ Modulo(Box<Modulo>),
295
+ Exponent(Box<Exponent>),
296
+
297
+ Negation(Box<Negation>),
298
+ LogicalNegation(Box<LogicalNegation>),
299
+ IsNull(Box<IsNull>),
300
+ IsNotNull(Box<IsNotNull>),
301
+ }
302
+
303
+ // Order By Expression
304
+
305
+ #[derive(Debug)]
306
+ pub(crate) struct OrderByExpression
307
+ {
308
+ pub asc: bool,
309
+ pub expression: Expression,
310
+ }
311
+
312
+ // Values: CreatePatterns
313
+
314
+ #[derive(Debug)]
315
+ pub(crate) enum Pattern
316
+ {
317
+ Node(NodePattern),
318
+ Edge(EdgePattern),
319
+ Path(PathPattern),
320
+ }
321
+
322
+ #[derive(Debug, Clone)]
323
+ pub(crate) struct NodePattern
324
+ {
325
+ pub(crate) variable: Option<VariableIdentifier>,
326
+ pub(crate) labels: LabelExpression,
327
+ pub(crate) properties: Option<Expression>,
328
+ }
329
+
330
+ #[derive(Debug, Clone)]
331
+ pub(crate) struct EdgePattern
332
+ {
333
+ pub(crate) variable: Option<VariableIdentifier>,
334
+ pub(crate) source: NodePattern,
335
+ pub(crate) destination: NodePattern,
336
+ pub(crate) directivity: graph::EdgeDirectivity,
337
+ pub(crate) labels: LabelExpression,
338
+ pub(crate) properties: Option<Expression>,
339
+ }
340
+
341
+ #[derive(Debug, Clone)]
342
+ pub(crate) struct PathPattern
343
+ {
344
+ pub(crate) variable: VariableIdentifier,
345
+ pub(crate) edge: EdgePattern,
346
+ }
347
+
348
+ // Label Expression
349
+ #[derive(Debug, Clone, PartialEq)]
350
+ pub(crate) enum LabelExpression
351
+ {
352
+ #[allow(dead_code)]
353
+ Not(Box<LabelExpression>),
354
+ And(Vec<Box<LabelExpression>>),
355
+ Or(Vec<Box<LabelExpression>>),
356
+ String(String),
357
+ None,
358
+ }
359
+
360
+ impl LabelExpression
361
+ {
362
+ pub(crate) fn and(self, rhs: LabelExpression) -> LabelExpression
363
+ {
364
+ match self
365
+ {
366
+ LabelExpression::None => rhs,
367
+ LabelExpression::And(mut vec) => match rhs
368
+ {
369
+ LabelExpression::None => LabelExpression::And(vec),
370
+ LabelExpression::And(mut rhs_vec) =>
371
+ {
372
+ vec.append(&mut rhs_vec);
373
+ LabelExpression::And(vec)
374
+ }
375
+ other =>
376
+ {
377
+ vec.push(other.boxed());
378
+ LabelExpression::And(vec)
379
+ }
380
+ },
381
+ _ => match rhs
382
+ {
383
+ LabelExpression::None => self,
384
+ LabelExpression::And(mut vec) =>
385
+ {
386
+ vec.push(self.boxed());
387
+ LabelExpression::And(vec)
388
+ }
389
+ _ => LabelExpression::And(vec![self.boxed(), rhs.boxed()]),
390
+ },
391
+ }
392
+ }
393
+ pub(crate) fn or(self, rhs: LabelExpression) -> LabelExpression
394
+ {
395
+ match self
396
+ {
397
+ LabelExpression::None => rhs,
398
+ LabelExpression::Or(mut vec) => match rhs
399
+ {
400
+ LabelExpression::None => LabelExpression::And(vec),
401
+ LabelExpression::Or(mut rhs_vec) =>
402
+ {
403
+ vec.append(&mut rhs_vec);
404
+ LabelExpression::Or(vec)
405
+ }
406
+ other =>
407
+ {
408
+ vec.push(other.boxed());
409
+ LabelExpression::Or(vec)
410
+ }
411
+ },
412
+ _ => match rhs
413
+ {
414
+ LabelExpression::None => self,
415
+ LabelExpression::Or(mut vec) =>
416
+ {
417
+ vec.push(self.boxed());
418
+ LabelExpression::Or(vec)
419
+ }
420
+ _ => LabelExpression::Or(vec![self.boxed(), rhs.boxed()]),
421
+ },
422
+ }
423
+ }
424
+ pub(crate) fn boxed(self) -> Box<LabelExpression>
425
+ {
426
+ Box::new(self)
427
+ }
428
+ pub(crate) fn is_all_inclusive(&self) -> bool
429
+ {
430
+ match self
431
+ {
432
+ LabelExpression::None => true,
433
+ LabelExpression::And(exprs) => !exprs.iter().any(|f| !f.is_all_inclusive()),
434
+ LabelExpression::Or(_) => false,
435
+ LabelExpression::String(_) => true,
436
+ LabelExpression::Not(_) => false,
437
+ }
438
+ }
439
+ pub(crate) fn is_none(&self) -> bool
440
+ {
441
+ match self
442
+ {
443
+ LabelExpression::None => true,
444
+ _ => false,
445
+ }
446
+ }
447
+ pub(crate) fn is_string(&self) -> bool
448
+ {
449
+ match self
450
+ {
451
+ LabelExpression::String(_) => true,
452
+ _ => false,
453
+ }
454
+ }
455
+ }
456
+
457
+ // Expressions
458
+
459
+ macro_rules! create_into_expr {
460
+ ( $x:tt ) => {
461
+ impl Into<Expression> for $x
462
+ {
463
+ fn into(self) -> Expression
464
+ {
465
+ Expression::$x(self)
466
+ }
467
+ }
468
+ };
469
+ }
470
+
471
+ macro_rules! create_into_boxed_expr {
472
+ ( $x:tt ) => {
473
+ impl Into<Expression> for $x
474
+ {
475
+ fn into(self) -> Expression
476
+ {
477
+ Expression::$x(Box::new(self))
478
+ }
479
+ }
480
+ };
481
+ }
482
+
483
+ #[derive(Debug)]
484
+ pub(crate) struct NamedExpression
485
+ {
486
+ pub(crate) identifier: VariableIdentifier,
487
+ pub(crate) expression: Expression,
488
+ }
489
+
490
+ #[derive(Debug, Clone, PartialEq)]
491
+ pub(crate) struct Parameter
492
+ {
493
+ pub(crate) name: String,
494
+ }
495
+
496
+ #[derive(Debug, Clone, PartialEq)]
497
+ pub(crate) struct Variable
498
+ {
499
+ pub(crate) identifier: VariableIdentifier,
500
+ }
501
+
502
+ create_into_expr! {Variable}
503
+
504
+ #[derive(Debug, Clone, PartialEq)]
505
+ pub(crate) struct MemberAccess
506
+ {
507
+ pub(crate) left: Expression,
508
+ pub(crate) path: Vec<String>,
509
+ }
510
+
511
+ create_into_boxed_expr! {MemberAccess}
512
+
513
+ #[derive(Debug, Clone, PartialEq)]
514
+ pub(crate) struct IndexAccess
515
+ {
516
+ pub(crate) left: Expression,
517
+ pub(crate) index: Expression,
518
+ }
519
+
520
+ create_into_boxed_expr! {IndexAccess}
521
+
522
+ #[derive(Debug, Clone, PartialEq)]
523
+ pub(crate) struct RangeAccess
524
+ {
525
+ pub(crate) left: Expression,
526
+ pub(crate) start: Option<Expression>,
527
+ pub(crate) end: Option<Expression>,
528
+ }
529
+
530
+ #[derive(Debug, Clone, PartialEq)]
531
+ pub(crate) struct FunctionCall
532
+ {
533
+ pub(crate) name: String,
534
+ pub(crate) arguments: Vec<Expression>,
535
+ }
536
+
537
+ create_into_expr! {FunctionCall}
538
+
539
+ macro_rules! create_binary_op {
540
+ ( $x:tt ) => {
541
+ #[derive(Debug, Clone, PartialEq)]
542
+ pub(crate) struct $x
543
+ {
544
+ pub(crate) left: Expression,
545
+ pub(crate) right: Expression,
546
+ }
547
+
548
+ create_into_boxed_expr! { $x }
549
+ };
550
+ }
551
+
552
+ create_binary_op! {LogicalAnd}
553
+ create_binary_op! {LogicalOr}
554
+ create_binary_op! {LogicalXor}
555
+ create_binary_op! {RelationalEqual}
556
+ create_binary_op! {RelationalDifferent}
557
+ create_binary_op! {RelationalInferior}
558
+ create_binary_op! {RelationalSuperior}
559
+ create_binary_op! {RelationalInferiorEqual}
560
+ create_binary_op! {RelationalSuperiorEqual}
561
+ create_binary_op! {RelationalIn}
562
+ create_binary_op! {RelationalNotIn}
563
+
564
+ create_binary_op! {Addition}
565
+ create_binary_op! {Subtraction}
566
+ create_binary_op! {Multiplication}
567
+ create_binary_op! {Division}
568
+ create_binary_op! {Modulo}
569
+ create_binary_op! {Exponent}
570
+
571
+ macro_rules! create_unary_op {
572
+ ( $x:tt ) => {
573
+ #[derive(Debug, Clone, PartialEq)]
574
+ pub(crate) struct $x
575
+ {
576
+ pub(crate) value: Expression,
577
+ }
578
+ create_into_boxed_expr! { $x }
579
+ };
580
+ }
581
+
582
+ create_unary_op! {LogicalNegation}
583
+ create_unary_op! {Negation}
584
+ create_unary_op! {IsNull}
585
+ create_unary_op! {IsNotNull}
586
+
587
+ // Values
588
+
589
+ #[derive(Debug, Clone, PartialEq)]
590
+ pub(crate) struct Value
591
+ {
592
+ pub(crate) value: crate::value::Value,
593
+ }
594
+
595
+ create_into_expr! {Value}
596
+
597
+ #[derive(Debug, Clone, PartialEq)]
598
+ pub(crate) struct Map
599
+ {
600
+ pub(crate) map: Vec<(String, Expression)>,
601
+ }
602
+
603
+ create_into_expr! {Map}
604
+
605
+ #[derive(Debug, Clone, PartialEq)]
606
+ pub(crate) struct Array
607
+ {
608
+ pub(crate) array: Vec<Expression>,
609
+ }
610
+
611
+ create_into_expr! {Array}