@react-querybuilder/core 8.9.2 → 8.11.0

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 (113) hide show
  1. package/dist/{arrayUtils-BF1P8iHS.mjs → arrayUtils-A_OXU9W1.mjs} +3 -75
  2. package/dist/arrayUtils-A_OXU9W1.mjs.map +1 -0
  3. package/dist/arrayUtils-QxZOZTf6.js +73 -0
  4. package/dist/arrayUtils-QxZOZTf6.js.map +1 -0
  5. package/dist/basic-DEc65Kng.d.mts +363 -0
  6. package/dist/basic-Dd_M2f3M.d.ts +363 -0
  7. package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +806 -1366
  8. package/dist/cjs/react-querybuilder_core.cjs.development.js +455 -116
  9. package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
  10. package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +806 -1366
  11. package/dist/cjs/react-querybuilder_core.cjs.production.js +1 -1
  12. package/dist/cjs/react-querybuilder_core.cjs.production.js.map +1 -1
  13. package/dist/{convertQuery-H7RhQiIc.mjs → convertQuery-CqX3rPvj.mjs} +3 -3
  14. package/dist/{convertQuery-H7RhQiIc.mjs.map → convertQuery-CqX3rPvj.mjs.map} +1 -1
  15. package/dist/{export-DyrnTh6K.d.ts → export-Dy4FckB-.d.ts} +7 -6
  16. package/dist/{export-r-V7bU31.d.mts → export-t1V2N8pz.d.mts} +7 -6
  17. package/dist/formatQuery.d.mts +3 -2
  18. package/dist/formatQuery.d.ts +3 -2
  19. package/dist/formatQuery.js +217 -87
  20. package/dist/formatQuery.js.map +1 -1
  21. package/dist/formatQuery.mjs +217 -87
  22. package/dist/formatQuery.mjs.map +1 -1
  23. package/dist/{import-Cksobmln.d.ts → import-Cz8canKo.d.mts} +3 -3
  24. package/dist/{import-BwbbP4oU.d.mts → import-DtS9Ocx5.d.ts} +3 -3
  25. package/dist/{isRuleGroup-CnhYpLOM.mjs → isRuleGroup-CYcfPgbg.mjs} +2 -2
  26. package/dist/{isRuleGroup-CnhYpLOM.mjs.map → isRuleGroup-CYcfPgbg.mjs.map} +1 -1
  27. package/dist/lexer-C53tqS2p.js +406 -0
  28. package/dist/lexer-C53tqS2p.js.map +1 -0
  29. package/dist/{optGroupUtils-CXLgyg2i.js → optGroupUtils-B0hTpodo.js} +114 -1
  30. package/dist/optGroupUtils-B0hTpodo.js.map +1 -0
  31. package/dist/{optGroupUtils-Duv-M8rf.mjs → optGroupUtils-VeZ3k7-1.mjs} +86 -3
  32. package/dist/optGroupUtils-VeZ3k7-1.mjs.map +1 -0
  33. package/dist/parseCEL.d.mts +292 -11
  34. package/dist/parseCEL.d.ts +292 -11
  35. package/dist/parseCEL.js +874 -1125
  36. package/dist/parseCEL.js.map +1 -1
  37. package/dist/parseCEL.mjs +828 -1126
  38. package/dist/parseCEL.mjs.map +1 -1
  39. package/dist/parseJSONata.d.mts +3 -2
  40. package/dist/parseJSONata.d.ts +3 -2
  41. package/dist/parseJSONata.js +49 -77
  42. package/dist/parseJSONata.js.map +1 -1
  43. package/dist/parseJSONata.mjs +4 -5
  44. package/dist/parseJSONata.mjs.map +1 -1
  45. package/dist/parseJsonLogic.d.mts +4 -3
  46. package/dist/parseJsonLogic.d.ts +4 -3
  47. package/dist/parseJsonLogic.js +5 -6
  48. package/dist/parseJsonLogic.js.map +1 -1
  49. package/dist/parseJsonLogic.mjs +5 -6
  50. package/dist/parseJsonLogic.mjs.map +1 -1
  51. package/dist/parseMongoDB.d.mts +3 -2
  52. package/dist/parseMongoDB.d.ts +3 -2
  53. package/dist/parseMongoDB.js +15 -16
  54. package/dist/parseMongoDB.js.map +1 -1
  55. package/dist/parseMongoDB.mjs +5 -6
  56. package/dist/parseMongoDB.mjs.map +1 -1
  57. package/dist/{parseNumber-BtGKa58z.mjs → parseNumber-CXdMVNFx.mjs} +2 -2
  58. package/dist/{parseNumber-BtGKa58z.mjs.map → parseNumber-CXdMVNFx.mjs.map} +1 -1
  59. package/dist/{parseNumber-Bcys1kOH.js → parseNumber-D4iQDxK-.js} +1 -1
  60. package/dist/{parseNumber-Bcys1kOH.js.map → parseNumber-D4iQDxK-.js.map} +1 -1
  61. package/dist/parseSQL.d.mts +3 -2
  62. package/dist/parseSQL.d.ts +3 -2
  63. package/dist/parseSQL.js +2691 -3036
  64. package/dist/parseSQL.js.map +1 -1
  65. package/dist/parseSQL.mjs +2691 -3037
  66. package/dist/parseSQL.mjs.map +1 -1
  67. package/dist/parseSpEL.d.mts +3 -2
  68. package/dist/parseSpEL.d.ts +3 -2
  69. package/dist/parseSpEL.js +7 -9
  70. package/dist/parseSpEL.js.map +1 -1
  71. package/dist/parseSpEL.mjs +5 -6
  72. package/dist/parseSpEL.mjs.map +1 -1
  73. package/dist/{prepareQueryObjects-BqFEs4eV.js → prepareQueryObjects-BOUWfel5.js} +4 -5
  74. package/dist/prepareQueryObjects-BOUWfel5.js.map +1 -0
  75. package/dist/{prepareQueryObjects-CS6Wmhmf.mjs → prepareQueryObjects-DPCC-iHp.mjs} +6 -7
  76. package/dist/prepareQueryObjects-DPCC-iHp.mjs.map +1 -0
  77. package/dist/query-builder-layout.css +1 -1
  78. package/dist/query-builder-layout.css.map +1 -1
  79. package/dist/query-builder.css +1 -1
  80. package/dist/query-builder.css.map +1 -1
  81. package/dist/react-querybuilder_core.d.mts +806 -1366
  82. package/dist/react-querybuilder_core.legacy-esm.d.ts +806 -1366
  83. package/dist/react-querybuilder_core.legacy-esm.js +455 -114
  84. package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
  85. package/dist/react-querybuilder_core.mjs +448 -117
  86. package/dist/react-querybuilder_core.mjs.map +1 -1
  87. package/dist/react-querybuilder_core.production.d.mts +806 -1366
  88. package/dist/react-querybuilder_core.production.mjs +1 -1
  89. package/dist/react-querybuilder_core.production.mjs.map +1 -1
  90. package/dist/styles/_layout.scss +61 -17
  91. package/dist/styles/_main.scss +22 -4
  92. package/dist/{transformQuery-FL_nlpp5.js → transformQuery-CWDPogO5.js} +1 -1
  93. package/dist/{transformQuery-FL_nlpp5.js.map → transformQuery-CWDPogO5.js.map} +1 -1
  94. package/dist/{transformQuery-DdMvmrCh.mjs → transformQuery-DCCpjtyq.mjs} +3 -3
  95. package/dist/{transformQuery-DdMvmrCh.mjs.map → transformQuery-DCCpjtyq.mjs.map} +1 -1
  96. package/dist/transformQuery.d.mts +1 -1
  97. package/dist/transformQuery.d.ts +1 -1
  98. package/dist/transformQuery.js +1 -1
  99. package/dist/transformQuery.mjs +2 -2
  100. package/package.json +14 -12
  101. package/dist/arrayUtils-BF1P8iHS.mjs.map +0 -1
  102. package/dist/arrayUtils-D5EoIsKP.js +0 -164
  103. package/dist/arrayUtils-D5EoIsKP.js.map +0 -1
  104. package/dist/basic-BfD-7CN3.d.mts +0 -1235
  105. package/dist/basic-C8xXKHIA.d.ts +0 -1235
  106. package/dist/objectUtils-BBZSfZJz.js +0 -17
  107. package/dist/objectUtils-BBZSfZJz.js.map +0 -1
  108. package/dist/objectUtils-BtWdcZVG.mjs +0 -11
  109. package/dist/objectUtils-BtWdcZVG.mjs.map +0 -1
  110. package/dist/optGroupUtils-CXLgyg2i.js.map +0 -1
  111. package/dist/optGroupUtils-Duv-M8rf.mjs.map +0 -1
  112. package/dist/prepareQueryObjects-BqFEs4eV.js.map +0 -1
  113. package/dist/prepareQueryObjects-CS6Wmhmf.mjs.map +0 -1
package/dist/parseCEL.js CHANGED
@@ -1,567 +1,283 @@
1
1
  const require_isRuleGroup = require('./isRuleGroup-DqAs2x4E.js');
2
- const require_arrayUtils = require('./arrayUtils-D5EoIsKP.js');
3
- require('./optGroupUtils-CXLgyg2i.js');
4
- const require_prepareQueryObjects = require('./prepareQueryObjects-BqFEs4eV.js');
2
+ const require_optGroupUtils = require('./optGroupUtils-B0hTpodo.js');
3
+ const require_arrayUtils = require('./arrayUtils-QxZOZTf6.js');
4
+ const require_prepareQueryObjects = require('./prepareQueryObjects-BOUWfel5.js');
5
+ const require_lexer$1 = require('./lexer-C53tqS2p.js');
5
6
 
6
- //#region src/utils/parseCEL/celParser.js
7
- var celParser = (function() {
8
- var o = function(k, v, o$1, l) {
9
- for (o$1 = o$1 || {}, l = k.length; l--; o$1[k[l]] = v);
10
- return o$1;
11
- }, $V0 = [1, 27], $V1 = [1, 31], $V2 = [1, 32], $V3 = [1, 28], $V4 = [1, 29], $V5 = [1, 30], $V6 = [1, 33], $V7 = [1, 34], $V8 = [1, 18], $V9 = [1, 26], $Va = [1, 12], $Vb = [1, 13], $Vc = [1, 19], $Vd = [1, 20], $Ve = [1, 40], $Vf = [1, 39], $Vg = [1, 41], $Vh = [1, 42], $Vi = [1, 43], $Vj = [1, 36], $Vk = [1, 37], $Vl = [1, 38], $Vm = [
12
- 5,
13
- 37,
14
- 43,
15
- 45,
16
- 49,
17
- 50,
18
- 53,
19
- 54,
20
- 55,
21
- 56,
22
- 60,
23
- 61,
24
- 62,
25
- 63
26
- ], $Vn = [1, 44], $Vo = [1, 45], $Vp = [1, 46], $Vq = [
27
- 5,
28
- 23,
29
- 24,
30
- 25,
31
- 26,
32
- 27,
33
- 28,
34
- 31,
35
- 37,
36
- 40,
37
- 43,
38
- 44,
39
- 45,
40
- 46,
41
- 49,
42
- 50,
43
- 53,
44
- 54,
45
- 55,
46
- 56,
47
- 60,
48
- 61,
49
- 62,
50
- 63
51
- ], $Vr = [
52
- 7,
53
- 9,
54
- 10,
55
- 12,
56
- 13,
57
- 14,
58
- 16,
59
- 18,
60
- 21,
61
- 35,
62
- 40,
63
- 41,
64
- 44,
65
- 46
66
- ], $Vs = [2, 36], $Vt = [1, 85], $Vu = [
67
- 43,
68
- 45,
69
- 50
70
- ], $Vv = [
71
- 5,
72
- 37,
73
- 43,
74
- 45,
75
- 49,
76
- 50,
77
- 53,
78
- 61,
79
- 62,
80
- 63
81
- ], $Vw = [
82
- 5,
83
- 37,
84
- 43,
85
- 45,
86
- 49,
87
- 50,
88
- 53,
89
- 54,
90
- 55,
91
- 56,
92
- 61,
93
- 62,
94
- 63
95
- ], $Vx = [2, 37], $Vy = [49, 50];
96
- var parser = {
97
- trace: function trace() {},
98
- yy: {},
99
- symbols_: {
100
- "error": 2,
101
- "main": 3,
102
- "expr": 4,
103
- "EOF": 5,
104
- "string_literal": 6,
105
- "STRING_LIT": 7,
106
- "bytes_literal": 8,
107
- "b": 9,
108
- "B": 10,
109
- "number_literal": 11,
110
- "INT_LIT": 12,
111
- "UINT_LIT": 13,
112
- "FLOAT_LIT": 14,
113
- "boolean_literal": 15,
114
- "BOOL_LIT": 16,
115
- "null_literal": 17,
116
- "NULL_LIT": 18,
117
- "literal": 19,
118
- "ident": 20,
119
- "IDENT": 21,
120
- "relop": 22,
121
- "==": 23,
122
- ">=": 24,
123
- ">": 25,
124
- "<=": 26,
125
- "<": 27,
126
- "!=": 28,
127
- "relation": 29,
128
- "member": 30,
129
- "in": 31,
130
- "list": 32,
131
- "map": 33,
132
- "negation": 34,
133
- "!": 35,
134
- "negative": 36,
135
- "-": 37,
136
- "unary": 38,
137
- "primary": 39,
138
- "DOT": 40,
139
- "(": 41,
140
- "expr_list": 42,
141
- ")": 43,
142
- "[": 44,
143
- "]": 45,
144
- "{": 46,
145
- "field_inits": 47,
146
- "trailing_comma": 48,
147
- "}": 49,
148
- ",": 50,
149
- "map_inits": 51,
150
- "math_operation": 52,
151
- "+": 53,
152
- "*": 54,
153
- "/": 55,
154
- "%": 56,
155
- "conditional_expr": 57,
156
- "conditional_and": 58,
157
- "conditional_or": 59,
158
- "?": 60,
159
- ":": 61,
160
- "&&": 62,
161
- "||": 63,
162
- "$accept": 0,
163
- "$end": 1
164
- },
165
- terminals_: {
166
- 2: "error",
167
- 5: "EOF",
168
- 7: "STRING_LIT",
169
- 9: "b",
170
- 10: "B",
171
- 12: "INT_LIT",
172
- 13: "UINT_LIT",
173
- 14: "FLOAT_LIT",
174
- 16: "BOOL_LIT",
175
- 18: "NULL_LIT",
176
- 21: "IDENT",
177
- 23: "==",
178
- 24: ">=",
179
- 25: ">",
180
- 26: "<=",
181
- 27: "<",
182
- 28: "!=",
183
- 31: "in",
184
- 35: "!",
185
- 37: "-",
186
- 40: "DOT",
187
- 41: "(",
188
- 43: ")",
189
- 44: "[",
190
- 45: "]",
191
- 46: "{",
192
- 49: "}",
193
- 50: ",",
194
- 53: "+",
195
- 54: "*",
196
- 55: "/",
197
- 56: "%",
198
- 60: "?",
199
- 61: ":",
200
- 62: "&&",
201
- 63: "||"
202
- },
203
- productions_: [
204
- 0,
205
- [3, 2],
206
- [6, 1],
207
- [8, 2],
208
- [8, 2],
209
- [11, 1],
210
- [11, 1],
211
- [11, 1],
212
- [15, 1],
213
- [17, 1],
214
- [19, 1],
215
- [19, 1],
216
- [19, 1],
217
- [19, 1],
218
- [19, 1],
219
- [20, 1],
220
- [22, 1],
221
- [22, 1],
222
- [22, 1],
223
- [22, 1],
224
- [22, 1],
225
- [22, 1],
226
- [29, 3],
227
- [29, 3],
228
- [29, 3],
229
- [34, 1],
230
- [34, 2],
231
- [36, 1],
232
- [36, 2],
233
- [38, 2],
234
- [30, 1],
235
- [30, 1],
236
- [30, 3],
237
- [30, 6],
238
- [30, 4],
239
- [30, 5],
240
- [48, 0],
241
- [48, 1],
242
- [39, 1],
243
- [39, 2],
244
- [39, 5],
245
- [39, 6],
246
- [39, 3],
247
- [39, 1],
248
- [39, 1],
249
- [39, 1],
250
- [32, 4],
251
- [33, 4],
252
- [52, 3],
253
- [52, 3],
254
- [52, 3],
255
- [52, 3],
256
- [52, 3],
257
- [4, 1],
258
- [4, 1],
259
- [4, 1],
260
- [4, 1],
261
- [4, 1],
262
- [4, 1],
263
- [57, 5],
264
- [58, 3],
265
- [59, 3],
266
- [42, 1],
267
- [42, 3],
268
- [47, 3],
269
- [47, 5],
270
- [51, 3],
271
- [51, 5]
272
- ],
273
- performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
274
- var $0 = $$.length - 1;
275
- switch (yystate) {
276
- case 1: return {
277
- nodeType: "Main",
278
- value: $$[$0 - 1]
279
- };
280
- case 2:
281
- this.$ = {
282
- type: "StringLiteral",
283
- value: $$[$0]
284
- };
285
- break;
286
- case 3:
287
- case 4:
288
- this.$ = {
289
- type: "BytesLiteral",
290
- value: $$[$0]
291
- };
292
- break;
293
- case 5:
294
- this.$ = {
295
- type: "IntegerLiteral",
296
- value: parseInt($$[$0], /x/.test($$[$0]) ? 16 : 10)
297
- };
298
- break;
299
- case 6:
300
- this.$ = {
301
- type: "UnsignedIntegerLiteral",
302
- value: parseInt($$[$0].replace(/u$/i, ""), /^0x/.test($$[$0]) ? 16 : 10)
303
- };
304
- break;
305
- case 7:
306
- this.$ = {
307
- type: "FloatLiteral",
308
- value: parseFloat($$[$0])
309
- };
310
- break;
311
- case 8:
312
- this.$ = {
313
- type: "BooleanLiteral",
314
- value: $$[$0] === "true"
315
- };
316
- break;
317
- case 9:
318
- this.$ = {
319
- type: "NullLiteral",
320
- value: null
321
- };
322
- break;
323
- case 10:
324
- case 11:
325
- case 12:
326
- case 13:
327
- case 14:
328
- case 16:
329
- case 17:
330
- case 18:
331
- case 19:
332
- case 20:
333
- case 21:
334
- case 38:
335
- case 43:
336
- case 44:
337
- case 45:
338
- case 53:
339
- case 54:
340
- case 55:
341
- case 56:
342
- case 57:
343
- case 58:
344
- this.$ = $$[$0];
345
- break;
346
- case 15:
347
- this.$ = {
348
- type: "Identifier",
349
- value: $$[$0]
350
- };
351
- break;
352
- case 22:
353
- case 23:
354
- case 24:
355
- this.$ = {
356
- type: "Relation",
357
- left: $$[$0 - 2],
358
- operator: $$[$0 - 1],
359
- right: $$[$0]
360
- };
361
- break;
362
- case 25:
363
- case 27:
364
- this.$ = 1;
365
- break;
366
- case 26:
367
- case 28:
368
- this.$ = this.$ += 1;
369
- break;
370
- case 29:
371
- this.$ = {
372
- type: "Negation",
373
- negations: $$[$0 - 1],
374
- value: $$[$0]
375
- };
376
- break;
377
- case 30:
378
- case 31:
379
- this.$ = $$[$0];
380
- break;
381
- case 32:
382
- this.$ = {
383
- type: "Member",
384
- left: $$[$0 - 2],
385
- right: $$[$0]
386
- };
387
- break;
388
- case 33:
389
- this.$ = {
390
- type: "Member",
391
- left: $$[$0 - 5],
392
- right: $$[$0 - 3],
393
- list: $$[$0 - 1]
394
- };
395
- break;
396
- case 34:
397
- this.$ = {
398
- type: "DynamicPropertyAccessor",
399
- left: $$[$0 - 3],
400
- right: $$[$0 - 1]
401
- };
402
- break;
403
- case 35:
404
- this.$ = {
405
- type: "FieldsObject",
406
- left: $$[$0 - 4],
407
- list: $$[$0 - 2],
408
- trailingComma: $$[$0 - 1]
409
- };
410
- break;
411
- case 36:
412
- this.$ = false;
413
- break;
414
- case 37:
415
- this.$ = true;
416
- break;
417
- case 39:
418
- this.$ = {
419
- type: "Property",
420
- value: $$[$0]
421
- };
422
- break;
423
- case 40:
424
- this.$ = {
425
- type: "FunctionCall",
426
- name: $$[$0 - 4],
427
- args: $$[$0 - 2],
428
- trailingComma: $$[$0 - 1]
429
- };
430
- break;
431
- case 41:
432
- this.$ = {
433
- type: "Property",
434
- value: $$[$0 - 4],
435
- args: $$[$0 - 2],
436
- trailingComma: $$[$0 - 1]
437
- };
438
- break;
439
- case 42:
440
- this.$ = {
441
- type: "ExpressionGroup",
442
- value: $$[$0 - 1]
443
- };
444
- break;
445
- case 46:
446
- this.$ = {
447
- type: "List",
448
- value: $$[$0 - 2],
449
- trailingComma: $$[$0 - 1]
450
- };
451
- break;
452
- case 47:
453
- this.$ = {
454
- type: "Map",
455
- value: $$[$0 - 2],
456
- trailingComma: $$[$0 - 1]
457
- };
458
- break;
459
- case 48:
460
- this.$ = {
461
- type: "Addition",
462
- left: $$[$0 - 2],
463
- right: $$[$0]
464
- };
465
- break;
466
- case 49:
467
- this.$ = {
468
- type: "Subtraction",
469
- left: $$[$0 - 2],
470
- right: $$[$0]
471
- };
472
- break;
473
- case 50:
474
- this.$ = {
475
- type: "Multiplication",
476
- left: $$[$0 - 2],
477
- right: $$[$0]
478
- };
479
- break;
480
- case 51:
481
- this.$ = {
482
- type: "Division",
483
- left: $$[$0 - 2],
484
- right: $$[$0]
485
- };
486
- break;
487
- case 52:
488
- this.$ = {
489
- type: "Modulo",
490
- left: $$[$0 - 2],
491
- right: $$[$0]
492
- };
493
- break;
494
- case 59:
495
- this.$ = {
496
- type: "ConditionalExpr",
497
- condition: $$[$0 - 4],
498
- valueIfTrue: $$[$0 - 2],
499
- valueIfFalse: $$[$0]
500
- };
501
- break;
502
- case 60:
503
- this.$ = {
504
- type: "ConditionalAnd",
505
- left: $$[$0 - 2],
506
- right: $$[$0]
507
- };
508
- break;
509
- case 61:
510
- this.$ = {
511
- type: "ConditionalOr",
512
- left: $$[$0 - 2],
513
- right: $$[$0]
514
- };
515
- break;
516
- case 62:
517
- this.$ = {
518
- type: "ExpressionList",
519
- value: [$$[$0]]
520
- };
521
- break;
522
- case 63:
523
- this.$ = $$[$0 - 2];
524
- this.$.value.push($$[$0]);
525
- break;
526
- case 64:
527
- this.$ = {
528
- type: "FieldInits",
529
- value: [{
530
- type: "FieldInit",
531
- left: $$[$0 - 2],
532
- right: $$[$0]
533
- }]
534
- };
535
- break;
536
- case 65:
537
- this.$ = $$[$0 - 4];
538
- this.$.value.push({
539
- type: "FieldInit",
540
- left: $$[$0 - 2],
541
- right: $$[$0]
542
- });
543
- break;
544
- case 66:
545
- this.$ = {
546
- type: "MapInits",
547
- value: [{
548
- type: "MapInit",
549
- left: $$[$0 - 2],
550
- right: $$[$0]
551
- }]
552
- };
553
- break;
554
- case 67:
555
- this.$ = $$[$0 - 4];
556
- this.$.value.push({
557
- type: "MapInit",
558
- left: $$[$0 - 2],
559
- right: $$[$0]
560
- });
561
- break;
562
- }
563
- },
564
- table: [
7
+ //#region src/utils/parseCEL/celParser.ts
8
+ var import_parser = /* @__PURE__ */ require_isRuleGroup.__toESM(require_lexer$1.require_parser());
9
+ var import_lexer = /* @__PURE__ */ require_isRuleGroup.__toESM(require_lexer$1.require_lexer());
10
+ /**
11
+ * parser generated by @ts-jison/parser-generator 0.4.1-alpha.2
12
+ * @returns Parser implementing JisonParserApi and a Lexer implementing JisonLexerApi.
13
+ */
14
+ var CELParser = class extends import_parser.JisonParser {
15
+ $;
16
+ symbols_ = {
17
+ "error": 2,
18
+ "main": 3,
19
+ "expr": 4,
20
+ "EOF": 5,
21
+ "string_literal": 6,
22
+ "STRING_LIT": 7,
23
+ "bytes_literal": 8,
24
+ "b": 9,
25
+ "B": 10,
26
+ "number_literal": 11,
27
+ "INT_LIT": 12,
28
+ "UINT_LIT": 13,
29
+ "FLOAT_LIT": 14,
30
+ "boolean_literal": 15,
31
+ "BOOL_LIT": 16,
32
+ "null_literal": 17,
33
+ "NULL_LIT": 18,
34
+ "literal": 19,
35
+ "ident": 20,
36
+ "IDENT": 21,
37
+ "relop": 22,
38
+ "==": 23,
39
+ ">=": 24,
40
+ ">": 25,
41
+ "<=": 26,
42
+ "<": 27,
43
+ "!=": 28,
44
+ "relation": 29,
45
+ "member": 30,
46
+ "in": 31,
47
+ "list": 32,
48
+ "map": 33,
49
+ "negation": 34,
50
+ "!": 35,
51
+ "negative": 36,
52
+ "-": 37,
53
+ "unary": 38,
54
+ "primary": 39,
55
+ "DOT": 40,
56
+ "(": 41,
57
+ "expr_list": 42,
58
+ ")": 43,
59
+ "[": 44,
60
+ "]": 45,
61
+ "{": 46,
62
+ "field_inits": 47,
63
+ "trailing_comma": 48,
64
+ "}": 49,
65
+ ",": 50,
66
+ "map_inits": 51,
67
+ "math_operation": 52,
68
+ "+": 53,
69
+ "*": 54,
70
+ "/": 55,
71
+ "%": 56,
72
+ "conditional_expr": 57,
73
+ "conditional_and": 58,
74
+ "conditional_or": 59,
75
+ "?": 60,
76
+ ":": 61,
77
+ "&&": 62,
78
+ "||": 63,
79
+ "$accept": 0,
80
+ "$end": 1
81
+ };
82
+ terminals_ = {
83
+ 2: "error",
84
+ 5: "EOF",
85
+ 7: "STRING_LIT",
86
+ 9: "b",
87
+ 10: "B",
88
+ 12: "INT_LIT",
89
+ 13: "UINT_LIT",
90
+ 14: "FLOAT_LIT",
91
+ 16: "BOOL_LIT",
92
+ 18: "NULL_LIT",
93
+ 21: "IDENT",
94
+ 23: "==",
95
+ 24: ">=",
96
+ 25: ">",
97
+ 26: "<=",
98
+ 27: "<",
99
+ 28: "!=",
100
+ 31: "in",
101
+ 35: "!",
102
+ 37: "-",
103
+ 40: "DOT",
104
+ 41: "(",
105
+ 43: ")",
106
+ 44: "[",
107
+ 45: "]",
108
+ 46: "{",
109
+ 49: "}",
110
+ 50: ",",
111
+ 53: "+",
112
+ 54: "*",
113
+ 55: "/",
114
+ 56: "%",
115
+ 60: "?",
116
+ 61: ":",
117
+ 62: "&&",
118
+ 63: "||"
119
+ };
120
+ productions_ = [
121
+ 0,
122
+ [3, 2],
123
+ [6, 1],
124
+ [8, 2],
125
+ [8, 2],
126
+ [11, 1],
127
+ [11, 1],
128
+ [11, 1],
129
+ [15, 1],
130
+ [17, 1],
131
+ [19, 1],
132
+ [19, 1],
133
+ [19, 1],
134
+ [19, 1],
135
+ [19, 1],
136
+ [20, 1],
137
+ [22, 1],
138
+ [22, 1],
139
+ [22, 1],
140
+ [22, 1],
141
+ [22, 1],
142
+ [22, 1],
143
+ [29, 3],
144
+ [29, 3],
145
+ [29, 3],
146
+ [34, 1],
147
+ [34, 2],
148
+ [36, 1],
149
+ [36, 2],
150
+ [38, 2],
151
+ [30, 1],
152
+ [30, 1],
153
+ [30, 3],
154
+ [30, 6],
155
+ [30, 4],
156
+ [30, 5],
157
+ [48, 0],
158
+ [48, 1],
159
+ [39, 1],
160
+ [39, 2],
161
+ [39, 5],
162
+ [39, 6],
163
+ [39, 3],
164
+ [39, 1],
165
+ [39, 1],
166
+ [39, 1],
167
+ [32, 4],
168
+ [33, 4],
169
+ [52, 3],
170
+ [52, 3],
171
+ [52, 3],
172
+ [52, 3],
173
+ [52, 3],
174
+ [4, 1],
175
+ [4, 1],
176
+ [4, 1],
177
+ [4, 1],
178
+ [4, 1],
179
+ [4, 1],
180
+ [57, 5],
181
+ [58, 3],
182
+ [59, 3],
183
+ [42, 1],
184
+ [42, 3],
185
+ [47, 3],
186
+ [47, 5],
187
+ [51, 3],
188
+ [51, 5]
189
+ ];
190
+ table;
191
+ defaultActions = { 35: [2, 1] };
192
+ constructor(yy = {}, lexer = new CELLexer(yy)) {
193
+ super(yy, lexer);
194
+ const $V0 = [1, 27], $V1 = [1, 31], $V2 = [1, 32], $V3 = [1, 28], $V4 = [1, 29], $V5 = [1, 30], $V6 = [1, 33], $V7 = [1, 34], $V8 = [1, 18], $V9 = [1, 26], $Va = [1, 12], $Vb = [1, 13], $Vc = [1, 19], $Vd = [1, 20], $Ve = [1, 40], $Vf = [1, 39], $Vg = [1, 41], $Vh = [1, 42], $Vi = [1, 43], $Vj = [1, 36], $Vk = [1, 37], $Vl = [1, 38], $Vm = [
195
+ 5,
196
+ 37,
197
+ 43,
198
+ 45,
199
+ 49,
200
+ 50,
201
+ 53,
202
+ 54,
203
+ 55,
204
+ 56,
205
+ 60,
206
+ 61,
207
+ 62,
208
+ 63
209
+ ], $Vn = [1, 44], $Vo = [1, 45], $Vp = [1, 46], $Vq = [
210
+ 5,
211
+ 23,
212
+ 24,
213
+ 25,
214
+ 26,
215
+ 27,
216
+ 28,
217
+ 31,
218
+ 37,
219
+ 40,
220
+ 43,
221
+ 44,
222
+ 45,
223
+ 46,
224
+ 49,
225
+ 50,
226
+ 53,
227
+ 54,
228
+ 55,
229
+ 56,
230
+ 60,
231
+ 61,
232
+ 62,
233
+ 63
234
+ ], $Vr = [
235
+ 7,
236
+ 9,
237
+ 10,
238
+ 12,
239
+ 13,
240
+ 14,
241
+ 16,
242
+ 18,
243
+ 21,
244
+ 35,
245
+ 40,
246
+ 41,
247
+ 44,
248
+ 46
249
+ ], $Vs = [2, 36], $Vt = [1, 85], $Vu = [
250
+ 43,
251
+ 45,
252
+ 50
253
+ ], $Vv = [
254
+ 5,
255
+ 37,
256
+ 43,
257
+ 45,
258
+ 49,
259
+ 50,
260
+ 53,
261
+ 61,
262
+ 62,
263
+ 63
264
+ ], $Vw = [
265
+ 5,
266
+ 37,
267
+ 43,
268
+ 45,
269
+ 49,
270
+ 50,
271
+ 53,
272
+ 54,
273
+ 55,
274
+ 56,
275
+ 61,
276
+ 62,
277
+ 63
278
+ ], $Vx = [2, 37], $Vy = [49, 50];
279
+ const o = import_parser.JisonParser.expandParseTable;
280
+ this.table = [
565
281
  {
566
282
  3: 1,
567
283
  4: 2,
@@ -1800,548 +1516,496 @@ var celParser = (function() {
1800
1516
  62: $Vk,
1801
1517
  63: $Vl
1802
1518
  })
1803
- ],
1804
- defaultActions: { 35: [2, 1] },
1805
- parseError: function parseError(str, hash) {
1806
- if (hash.recoverable) this.trace(str);
1807
- else {
1808
- var error = Error(str);
1809
- error.hash = hash;
1810
- throw error;
1811
- }
1812
- },
1813
- parse: function parse(input) {
1814
- var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1, args = lstack.slice.call(arguments, 1), lexer = Object.create(this.lexer), sharedState = { yy: {} };
1815
- for (var k in this.yy) if (Object.prototype.hasOwnProperty.call(this.yy, k)) sharedState.yy[k] = this.yy[k];
1816
- lexer.setInput(input, sharedState.yy);
1817
- sharedState.yy.lexer = lexer;
1818
- sharedState.yy.parser = this;
1819
- if (typeof lexer.yylloc > "u") lexer.yylloc = {};
1820
- var yyloc = lexer.yylloc;
1821
- lstack.push(yyloc);
1822
- var ranges = lexer.options && lexer.options.ranges;
1823
- if (typeof sharedState.yy.parseError === "function") this.parseError = sharedState.yy.parseError;
1824
- else this.parseError = Object.getPrototypeOf(this).parseError;
1825
- function popStack(n) {
1826
- stack.length = stack.length - 2 * n;
1827
- vstack.length = vstack.length - n;
1828
- lstack.length = lstack.length - n;
1829
- }
1830
- var lex = function() {
1831
- var token = lexer.lex() || EOF;
1832
- if (typeof token !== "number") token = self.symbols_[token] || token;
1833
- return token;
1834
- }, symbol, preErrorSymbol, state, action, r, yyval = {}, p, len, newState, expected;
1835
- while (!0) {
1836
- state = stack[stack.length - 1];
1837
- if (this.defaultActions[state]) action = this.defaultActions[state];
1838
- else {
1839
- if (symbol === null || typeof symbol > "u") symbol = lex();
1840
- action = table[state] && table[state][symbol];
1841
- }
1842
- if (typeof action > "u" || !action.length || !action[0]) {
1843
- let locateNearestErrorRecoveryRule = function(state$1) {
1844
- var stack_probe = stack.length - 1, depth = 0;
1845
- for (;;) {
1846
- if (TERROR.toString() in table[state$1]) return depth;
1847
- if (state$1 === 0 || stack_probe < 2) return !1;
1848
- stack_probe -= 2;
1849
- state$1 = stack[stack_probe];
1850
- ++depth;
1851
- }
1852
- };
1853
- var error_rule_depth, errStr = "";
1854
- if (!recovering) {
1855
- error_rule_depth = locateNearestErrorRecoveryRule(state);
1856
- expected = [];
1857
- for (p in table[state]) if (this.terminals_[p] && p > TERROR) expected.push("'" + this.terminals_[p] + "'");
1858
- if (lexer.showPosition) errStr = "Parse error on line " + (yylineno + 1) + `:
1859
- ` + lexer.showPosition() + `
1860
- Expecting ` + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
1861
- else errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
1862
- this.parseError(errStr, {
1863
- text: lexer.match,
1864
- token: this.terminals_[symbol] || symbol,
1865
- line: lexer.yylineno,
1866
- loc: yyloc,
1867
- expected,
1868
- recoverable: error_rule_depth !== !1
1869
- });
1870
- } else if (preErrorSymbol !== EOF) error_rule_depth = locateNearestErrorRecoveryRule(state);
1871
- if (recovering == 3) {
1872
- if (symbol === EOF || preErrorSymbol === EOF) throw Error(errStr || "Parsing halted while starting to recover from another error.");
1873
- yyleng = lexer.yyleng;
1874
- yytext = lexer.yytext;
1875
- yylineno = lexer.yylineno;
1876
- yyloc = lexer.yylloc;
1877
- symbol = lex();
1878
- }
1879
- if (error_rule_depth === !1) throw Error(errStr || "Parsing halted. No suitable error recovery rule available.");
1880
- popStack(error_rule_depth);
1881
- preErrorSymbol = symbol == TERROR ? null : symbol;
1882
- symbol = TERROR;
1883
- state = stack[stack.length - 1];
1884
- action = table[state] && table[state][TERROR];
1885
- recovering = 3;
1886
- }
1887
- if (action[0] instanceof Array && action.length > 1) throw Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
1888
- switch (action[0]) {
1889
- case 1:
1890
- stack.push(symbol);
1891
- vstack.push(lexer.yytext);
1892
- lstack.push(lexer.yylloc);
1893
- stack.push(action[1]);
1894
- symbol = null;
1895
- if (!preErrorSymbol) {
1896
- yyleng = lexer.yyleng;
1897
- yytext = lexer.yytext;
1898
- yylineno = lexer.yylineno;
1899
- yyloc = lexer.yylloc;
1900
- if (recovering > 0) recovering--;
1901
- } else {
1902
- symbol = preErrorSymbol;
1903
- preErrorSymbol = null;
1904
- }
1905
- break;
1906
- case 2:
1907
- len = this.productions_[action[1]][1];
1908
- yyval.$ = vstack[vstack.length - len];
1909
- yyval._$ = {
1910
- first_line: lstack[lstack.length - (len || 1)].first_line,
1911
- last_line: lstack[lstack.length - 1].last_line,
1912
- first_column: lstack[lstack.length - (len || 1)].first_column,
1913
- last_column: lstack[lstack.length - 1].last_column
1914
- };
1915
- if (ranges) yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]];
1916
- r = this.performAction.apply(yyval, [
1917
- yytext,
1918
- yyleng,
1919
- yylineno,
1920
- sharedState.yy,
1921
- action[1],
1922
- vstack,
1923
- lstack
1924
- ].concat(args));
1925
- if (typeof r < "u") return r;
1926
- if (len) {
1927
- stack = stack.slice(0, -1 * len * 2);
1928
- vstack = vstack.slice(0, -1 * len);
1929
- lstack = lstack.slice(0, -1 * len);
1930
- }
1931
- stack.push(this.productions_[action[1]][0]);
1932
- vstack.push(yyval.$);
1933
- lstack.push(yyval._$);
1934
- newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
1935
- stack.push(newState);
1936
- break;
1937
- case 3: return !0;
1938
- }
1939
- }
1940
- return !0;
1941
- }
1942
- };
1943
- parser.lexer = (function() {
1944
- return {
1945
- EOF: 1,
1946
- parseError: function parseError(str, hash) {
1947
- if (this.yy.parser) this.yy.parser.parseError(str, hash);
1948
- else throw Error(str);
1949
- },
1950
- setInput: function(input, yy) {
1951
- this.yy = yy || this.yy || {};
1952
- this._input = input;
1953
- this._more = this._backtrack = this.done = !1;
1954
- this.yylineno = this.yyleng = 0;
1955
- this.yytext = this.matched = this.match = "";
1956
- this.conditionStack = ["INITIAL"];
1957
- this.yylloc = {
1958
- first_line: 1,
1959
- first_column: 0,
1960
- last_line: 1,
1961
- last_column: 0
1519
+ ];
1520
+ }
1521
+ performAction(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
1522
+ var $0 = $$.length - 1;
1523
+ switch (yystate) {
1524
+ case 1: return {
1525
+ nodeType: "Main",
1526
+ value: $$[$0 - 1]
1527
+ };
1528
+ case 2:
1529
+ this.$ = {
1530
+ type: "StringLiteral",
1531
+ value: $$[$0]
1962
1532
  };
1963
- if (this.options.ranges) this.yylloc.range = [0, 0];
1964
- this.offset = 0;
1965
- return this;
1966
- },
1967
- input: function() {
1968
- var ch = this._input[0];
1969
- this.yytext += ch;
1970
- this.yyleng++;
1971
- this.offset++;
1972
- this.match += ch;
1973
- this.matched += ch;
1974
- if (ch.match(/(?:\r\n?|\n).*/g)) {
1975
- this.yylineno++;
1976
- this.yylloc.last_line++;
1977
- } else this.yylloc.last_column++;
1978
- if (this.options.ranges) this.yylloc.range[1]++;
1979
- this._input = this._input.slice(1);
1980
- return ch;
1981
- },
1982
- unput: function(ch) {
1983
- var len = ch.length, lines = ch.split(/(?:\r\n?|\n)/g);
1984
- this._input = ch + this._input;
1985
- this.yytext = this.yytext.substr(0, this.yytext.length - len);
1986
- this.offset -= len;
1987
- var oldLines = this.match.split(/(?:\r\n?|\n)/g);
1988
- this.match = this.match.substr(0, this.match.length - 1);
1989
- this.matched = this.matched.substr(0, this.matched.length - 1);
1990
- if (lines.length - 1) this.yylineno -= lines.length - 1;
1991
- var r = this.yylloc.range;
1992
- this.yylloc = {
1993
- first_line: this.yylloc.first_line,
1994
- last_line: this.yylineno + 1,
1995
- first_column: this.yylloc.first_column,
1996
- last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
1533
+ break;
1534
+ case 3:
1535
+ case 4:
1536
+ this.$ = {
1537
+ type: "BytesLiteral",
1538
+ value: $$[$0]
1997
1539
  };
1998
- if (this.options.ranges) this.yylloc.range = [r[0], r[0] + this.yyleng - len];
1999
- this.yyleng = this.yytext.length;
2000
- return this;
2001
- },
2002
- more: function() {
2003
- this._more = !0;
2004
- return this;
2005
- },
2006
- reject: function() {
2007
- if (this.options.backtrack_lexer) this._backtrack = !0;
2008
- else return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
2009
- ` + this.showPosition(), {
2010
- text: "",
2011
- token: null,
2012
- line: this.yylineno
1540
+ break;
1541
+ case 5:
1542
+ this.$ = {
1543
+ type: "IntegerLiteral",
1544
+ value: parseInt($$[$0], /x/.test($$[$0]) ? 16 : 10)
1545
+ };
1546
+ break;
1547
+ case 6:
1548
+ this.$ = {
1549
+ type: "UnsignedIntegerLiteral",
1550
+ value: parseInt($$[$0].replace(/u$/i, ""), /^0x/.test($$[$0]) ? 16 : 10)
1551
+ };
1552
+ break;
1553
+ case 7:
1554
+ this.$ = {
1555
+ type: "FloatLiteral",
1556
+ value: parseFloat($$[$0])
1557
+ };
1558
+ break;
1559
+ case 8:
1560
+ this.$ = {
1561
+ type: "BooleanLiteral",
1562
+ value: $$[$0] === "true"
1563
+ };
1564
+ break;
1565
+ case 9:
1566
+ this.$ = {
1567
+ type: "NullLiteral",
1568
+ value: null
1569
+ };
1570
+ break;
1571
+ case 10:
1572
+ case 11:
1573
+ case 12:
1574
+ case 13:
1575
+ case 14:
1576
+ case 16:
1577
+ case 17:
1578
+ case 18:
1579
+ case 19:
1580
+ case 20:
1581
+ case 21:
1582
+ case 38:
1583
+ case 43:
1584
+ case 44:
1585
+ case 45:
1586
+ case 53:
1587
+ case 54:
1588
+ case 55:
1589
+ case 56:
1590
+ case 57:
1591
+ case 58:
1592
+ this.$ = $$[$0];
1593
+ break;
1594
+ case 15:
1595
+ this.$ = {
1596
+ type: "Identifier",
1597
+ value: $$[$0]
1598
+ };
1599
+ break;
1600
+ case 22:
1601
+ case 23:
1602
+ case 24:
1603
+ this.$ = {
1604
+ type: "Relation",
1605
+ left: $$[$0 - 2],
1606
+ operator: $$[$0 - 1],
1607
+ right: $$[$0]
1608
+ };
1609
+ break;
1610
+ case 25:
1611
+ case 27:
1612
+ this.$ = 1;
1613
+ break;
1614
+ case 26:
1615
+ case 28:
1616
+ this.$ = this.$ += 1;
1617
+ break;
1618
+ case 29:
1619
+ this.$ = {
1620
+ type: "Negation",
1621
+ negations: $$[$0 - 1],
1622
+ value: $$[$0]
1623
+ };
1624
+ break;
1625
+ case 30:
1626
+ case 31:
1627
+ this.$ = $$[$0];
1628
+ break;
1629
+ case 32:
1630
+ this.$ = {
1631
+ type: "Member",
1632
+ left: $$[$0 - 2],
1633
+ right: $$[$0]
1634
+ };
1635
+ break;
1636
+ case 33:
1637
+ this.$ = {
1638
+ type: "Member",
1639
+ left: $$[$0 - 5],
1640
+ right: $$[$0 - 3],
1641
+ list: $$[$0 - 1]
1642
+ };
1643
+ break;
1644
+ case 34:
1645
+ this.$ = {
1646
+ type: "DynamicPropertyAccessor",
1647
+ left: $$[$0 - 3],
1648
+ right: $$[$0 - 1]
1649
+ };
1650
+ break;
1651
+ case 35:
1652
+ this.$ = {
1653
+ type: "FieldsObject",
1654
+ left: $$[$0 - 4],
1655
+ list: $$[$0 - 2],
1656
+ trailingComma: $$[$0 - 1]
1657
+ };
1658
+ break;
1659
+ case 36:
1660
+ this.$ = false;
1661
+ break;
1662
+ case 37:
1663
+ this.$ = true;
1664
+ break;
1665
+ case 39:
1666
+ this.$ = {
1667
+ type: "Property",
1668
+ value: $$[$0]
1669
+ };
1670
+ break;
1671
+ case 40:
1672
+ this.$ = {
1673
+ type: "FunctionCall",
1674
+ name: $$[$0 - 4],
1675
+ args: $$[$0 - 2],
1676
+ trailingComma: $$[$0 - 1]
1677
+ };
1678
+ break;
1679
+ case 41:
1680
+ this.$ = {
1681
+ type: "Property",
1682
+ value: $$[$0 - 4],
1683
+ args: $$[$0 - 2],
1684
+ trailingComma: $$[$0 - 1]
1685
+ };
1686
+ break;
1687
+ case 42:
1688
+ this.$ = {
1689
+ type: "ExpressionGroup",
1690
+ value: $$[$0 - 1]
1691
+ };
1692
+ break;
1693
+ case 46:
1694
+ this.$ = {
1695
+ type: "List",
1696
+ value: $$[$0 - 2],
1697
+ trailingComma: $$[$0 - 1]
1698
+ };
1699
+ break;
1700
+ case 47:
1701
+ this.$ = {
1702
+ type: "Map",
1703
+ value: $$[$0 - 2],
1704
+ trailingComma: $$[$0 - 1]
1705
+ };
1706
+ break;
1707
+ case 48:
1708
+ this.$ = {
1709
+ type: "Addition",
1710
+ left: $$[$0 - 2],
1711
+ right: $$[$0]
1712
+ };
1713
+ break;
1714
+ case 49:
1715
+ this.$ = {
1716
+ type: "Subtraction",
1717
+ left: $$[$0 - 2],
1718
+ right: $$[$0]
1719
+ };
1720
+ break;
1721
+ case 50:
1722
+ this.$ = {
1723
+ type: "Multiplication",
1724
+ left: $$[$0 - 2],
1725
+ right: $$[$0]
1726
+ };
1727
+ break;
1728
+ case 51:
1729
+ this.$ = {
1730
+ type: "Division",
1731
+ left: $$[$0 - 2],
1732
+ right: $$[$0]
1733
+ };
1734
+ break;
1735
+ case 52:
1736
+ this.$ = {
1737
+ type: "Modulo",
1738
+ left: $$[$0 - 2],
1739
+ right: $$[$0]
1740
+ };
1741
+ break;
1742
+ case 59:
1743
+ this.$ = {
1744
+ type: "ConditionalExpr",
1745
+ condition: $$[$0 - 4],
1746
+ valueIfTrue: $$[$0 - 2],
1747
+ valueIfFalse: $$[$0]
1748
+ };
1749
+ break;
1750
+ case 60:
1751
+ this.$ = {
1752
+ type: "ConditionalAnd",
1753
+ left: $$[$0 - 2],
1754
+ right: $$[$0]
1755
+ };
1756
+ break;
1757
+ case 61:
1758
+ this.$ = {
1759
+ type: "ConditionalOr",
1760
+ left: $$[$0 - 2],
1761
+ right: $$[$0]
1762
+ };
1763
+ break;
1764
+ case 62:
1765
+ this.$ = {
1766
+ type: "ExpressionList",
1767
+ value: [$$[$0]]
1768
+ };
1769
+ break;
1770
+ case 63:
1771
+ this.$ = $$[$0 - 2];
1772
+ this.$.value.push($$[$0]);
1773
+ break;
1774
+ case 64:
1775
+ this.$ = {
1776
+ type: "FieldInits",
1777
+ value: [{
1778
+ type: "FieldInit",
1779
+ left: $$[$0 - 2],
1780
+ right: $$[$0]
1781
+ }]
1782
+ };
1783
+ break;
1784
+ case 65:
1785
+ this.$ = $$[$0 - 4];
1786
+ this.$.value.push({
1787
+ type: "FieldInit",
1788
+ left: $$[$0 - 2],
1789
+ right: $$[$0]
2013
1790
  });
2014
- return this;
2015
- },
2016
- less: function(n) {
2017
- this.unput(this.match.slice(n));
2018
- },
2019
- pastInput: function() {
2020
- var past = this.matched.substr(0, this.matched.length - this.match.length);
2021
- return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
2022
- },
2023
- upcomingInput: function() {
2024
- var next = this.match;
2025
- if (next.length < 20) next += this._input.substr(0, 20 - next.length);
2026
- return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
2027
- },
2028
- showPosition: function() {
2029
- var pre = this.pastInput(), c = Array(pre.length + 1).join("-");
2030
- return pre + this.upcomingInput() + `
2031
- ` + c + "^";
2032
- },
2033
- test_match: function(match, indexed_rule) {
2034
- var token, lines, backup;
2035
- if (this.options.backtrack_lexer) {
2036
- backup = {
2037
- yylineno: this.yylineno,
2038
- yylloc: {
2039
- first_line: this.yylloc.first_line,
2040
- last_line: this.last_line,
2041
- first_column: this.yylloc.first_column,
2042
- last_column: this.yylloc.last_column
2043
- },
2044
- yytext: this.yytext,
2045
- match: this.match,
2046
- matches: this.matches,
2047
- matched: this.matched,
2048
- yyleng: this.yyleng,
2049
- offset: this.offset,
2050
- _more: this._more,
2051
- _input: this._input,
2052
- yy: this.yy,
2053
- conditionStack: this.conditionStack.slice(0),
2054
- done: this.done
2055
- };
2056
- if (this.options.ranges) backup.yylloc.range = this.yylloc.range.slice(0);
2057
- }
2058
- lines = match[0].match(/(?:\r\n?|\n).*/g);
2059
- if (lines) this.yylineno += lines.length;
2060
- this.yylloc = {
2061
- first_line: this.yylloc.last_line,
2062
- last_line: this.yylineno + 1,
2063
- first_column: this.yylloc.last_column,
2064
- last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
1791
+ break;
1792
+ case 66:
1793
+ this.$ = {
1794
+ type: "MapInits",
1795
+ value: [{
1796
+ type: "MapInit",
1797
+ left: $$[$0 - 2],
1798
+ right: $$[$0]
1799
+ }]
2065
1800
  };
2066
- this.yytext += match[0];
2067
- this.match += match[0];
2068
- this.matches = match;
2069
- this.yyleng = this.yytext.length;
2070
- if (this.options.ranges) this.yylloc.range = [this.offset, this.offset += this.yyleng];
2071
- this._more = !1;
2072
- this._backtrack = !1;
2073
- this._input = this._input.slice(match[0].length);
2074
- this.matched += match[0];
2075
- token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
2076
- if (this.done && this._input) this.done = !1;
2077
- if (token) return token;
2078
- else if (this._backtrack) {
2079
- for (var k in backup) this[k] = backup[k];
2080
- return !1;
2081
- }
2082
- return !1;
2083
- },
2084
- next: function() {
2085
- if (this.done) return this.EOF;
2086
- if (!this._input) this.done = !0;
2087
- var token, match, tempMatch, index;
2088
- if (!this._more) {
2089
- this.yytext = "";
2090
- this.match = "";
2091
- }
2092
- var rules = this._currentRules();
2093
- for (var i = 0; i < rules.length; i++) {
2094
- tempMatch = this._input.match(this.rules[rules[i]]);
2095
- if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
2096
- match = tempMatch;
2097
- index = i;
2098
- if (this.options.backtrack_lexer) {
2099
- token = this.test_match(tempMatch, rules[i]);
2100
- if (token !== !1) return token;
2101
- else if (this._backtrack) {
2102
- match = !1;
2103
- continue;
2104
- } else return !1;
2105
- } else if (!this.options.flex) break;
2106
- }
2107
- }
2108
- if (match) {
2109
- token = this.test_match(match, rules[index]);
2110
- if (token !== !1) return token;
2111
- return !1;
2112
- }
2113
- if (this._input === "") return this.EOF;
2114
- else return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
2115
- ` + this.showPosition(), {
2116
- text: "",
2117
- token: null,
2118
- line: this.yylineno
1801
+ break;
1802
+ case 67:
1803
+ this.$ = $$[$0 - 4];
1804
+ this.$.value.push({
1805
+ type: "MapInit",
1806
+ left: $$[$0 - 2],
1807
+ right: $$[$0]
2119
1808
  });
2120
- },
2121
- lex: function lex() {
2122
- var r = this.next();
2123
- if (r) return r;
2124
- else return this.lex();
2125
- },
2126
- begin: function begin(condition) {
2127
- this.conditionStack.push(condition);
2128
- },
2129
- popState: function popState() {
2130
- if (this.conditionStack.length - 1 > 0) return this.conditionStack.pop();
2131
- else return this.conditionStack[0];
2132
- },
2133
- _currentRules: function _currentRules() {
2134
- if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
2135
- else return this.conditions.INITIAL.rules;
2136
- },
2137
- topState: function topState(n) {
2138
- n = this.conditionStack.length - 1 - Math.abs(n || 0);
2139
- if (n >= 0) return this.conditionStack[n];
2140
- else return "INITIAL";
2141
- },
2142
- pushState: function pushState(condition) {
2143
- this.begin(condition);
2144
- },
2145
- stateStackSize: function stateStackSize() {
2146
- return this.conditionStack.length;
2147
- },
2148
- options: { "flex": true },
2149
- performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
2150
- switch ($avoiding_name_collisions) {
2151
- case 0: break;
2152
- case 1: break;
2153
- case 2: return 31;
2154
- case 3: return "as";
2155
- case 4: return "break";
2156
- case 5: return "const";
2157
- case 6: return "continue";
2158
- case 7: return "else";
2159
- case 8: return "for";
2160
- case 9: return "function";
2161
- case 10: return "if";
2162
- case 11: return "import";
2163
- case 12: return "let";
2164
- case 13: return "loop";
2165
- case 14: return "package";
2166
- case 15: return "namespace";
2167
- case 16: return "return";
2168
- case 17: return "var";
2169
- case 18: return "void";
2170
- case 19: return "while";
2171
- case 20: return 18;
2172
- case 21: return 16;
2173
- case 22: return 16;
2174
- case 23: return 40;
2175
- case 24: return 60;
2176
- case 25: return 61;
2177
- case 26: return 50;
2178
- case 27: return 44;
2179
- case 28: return 45;
2180
- case 29: return 41;
2181
- case 30: return 43;
2182
- case 31: return 28;
2183
- case 32: return 35;
2184
- case 33: return 53;
2185
- case 34: return 37;
2186
- case 35: return 54;
2187
- case 36: return 55;
2188
- case 37: return 56;
2189
- case 38: return 23;
2190
- case 39: return 24;
2191
- case 40: return 25;
2192
- case 41: return 26;
2193
- case 42: return 27;
2194
- case 43: return 46;
2195
- case 44: return 49;
2196
- case 45: return 62;
2197
- case 46: return 63;
2198
- case 47: return 21;
2199
- case 48: return 7;
2200
- case 49: return 7;
2201
- case 50: return 7;
2202
- case 51: return 7;
2203
- case 52: return 12;
2204
- case 53: return 13;
2205
- case 54: return 14;
2206
- case 55: return 5;
2207
- case 56: return "INVALID";
2208
- case 57:
2209
- console.log(yy_.yytext);
2210
- break;
2211
- }
2212
- },
2213
- rules: [
2214
- /^(?:[/][/]\s.*\n)/,
2215
- /^(?:\s+)/,
2216
- /^(?:in)/,
2217
- /^(?:as)/,
2218
- /^(?:break)/,
2219
- /^(?:const)/,
2220
- /^(?:continue)/,
2221
- /^(?:else)/,
2222
- /^(?:for)/,
2223
- /^(?:function)/,
2224
- /^(?:if)/,
2225
- /^(?:import)/,
2226
- /^(?:let)/,
2227
- /^(?:loop)/,
2228
- /^(?:package)/,
2229
- /^(?:namespace)/,
2230
- /^(?:return)/,
2231
- /^(?:var)/,
2232
- /^(?:void)/,
2233
- /^(?:while)/,
2234
- /^(?:null)/,
2235
- /^(?:true)/,
2236
- /^(?:false)/,
2237
- /^(?:\.)/,
2238
- /^(?:\?)/,
2239
- /^(?::)/,
2240
- /^(?:,)/,
2241
- /^(?:\[)/,
2242
- /^(?:\])/,
2243
- /^(?:\()/,
2244
- /^(?:\))/,
2245
- /^(?:!=)/,
2246
- /^(?:!)/,
2247
- /^(?:\+)/,
2248
- /^(?:-)/,
2249
- /^(?:\*)/,
2250
- /^(?:\/)/,
2251
- /^(?:%)/,
2252
- /^(?:==)/,
2253
- /^(?:>=)/,
2254
- /^(?:>)/,
2255
- /^(?:<=)/,
2256
- /^(?:<)/,
2257
- /^(?:\{)/,
2258
- /^(?:\})/,
2259
- /^(?:&&)/,
2260
- /^(?:\|\|)/,
2261
- /^(?:[_a-zA-Z][_a-zA-Z0-9]*)/,
2262
- /^(?:[rR]?['][']['](\.|[^'])*['][']['])/,
2263
- /^(?:[rR]?["]["]["](\.|[^"])*["]["]["])/,
2264
- /^(?:[rR]?['](\.|[^'\n\r])*['])/,
2265
- /^(?:[rR]?["](\.|[^"\n\r])*["])/,
2266
- /^(?:[-]?([0-9]+|0x[0-9a-fA-F]+))/,
2267
- /^(?:([0-9]+|0x[0-9a-fA-F]+)[uU])/,
2268
- /^(?:[-]?[0-9]+(\.[0-9]+)?([eE][+-]?[0-9]+(\.[0-9]+)?)?)/,
2269
- /^(?:$)/,
2270
- /^(?:.)/,
2271
- /^(?:.)/
2272
- ],
2273
- conditions: { "INITIAL": {
2274
- "rules": [
2275
- 0,
2276
- 1,
2277
- 2,
2278
- 3,
2279
- 4,
2280
- 5,
2281
- 6,
2282
- 7,
2283
- 8,
2284
- 9,
2285
- 10,
2286
- 11,
2287
- 12,
2288
- 13,
2289
- 14,
2290
- 15,
2291
- 16,
2292
- 17,
2293
- 18,
2294
- 19,
2295
- 20,
2296
- 21,
2297
- 22,
2298
- 23,
2299
- 24,
2300
- 25,
2301
- 26,
2302
- 27,
2303
- 28,
2304
- 29,
2305
- 30,
2306
- 31,
2307
- 32,
2308
- 33,
2309
- 34,
2310
- 35,
2311
- 36,
2312
- 37,
2313
- 38,
2314
- 39,
2315
- 40,
2316
- 41,
2317
- 42,
2318
- 43,
2319
- 44,
2320
- 45,
2321
- 46,
2322
- 47,
2323
- 48,
2324
- 49,
2325
- 50,
2326
- 51,
2327
- 52,
2328
- 53,
2329
- 54,
2330
- 55,
2331
- 56,
2332
- 57
2333
- ],
2334
- "inclusive": true
2335
- } }
2336
- };
2337
- })();
2338
- function Parser() {
2339
- this.yy = {};
1809
+ break;
1810
+ }
1811
+ }
1812
+ };
1813
+ var CELLexer = class extends import_lexer.JisonLexer {
1814
+ options = {
1815
+ "flex": true,
1816
+ "moduleName": "CEL"
1817
+ };
1818
+ constructor(yy = {}) {
1819
+ super(yy);
2340
1820
  }
2341
- Parser.prototype = parser;
2342
- parser.Parser = Parser;
2343
- return new Parser();
2344
- })();
1821
+ rules = [
1822
+ /^(?:[/][/]\s.*\n)/,
1823
+ /^(?:\s+)/,
1824
+ /^(?:in)/,
1825
+ /^(?:as)/,
1826
+ /^(?:break)/,
1827
+ /^(?:const)/,
1828
+ /^(?:continue)/,
1829
+ /^(?:else)/,
1830
+ /^(?:for)/,
1831
+ /^(?:function)/,
1832
+ /^(?:if)/,
1833
+ /^(?:import)/,
1834
+ /^(?:let)/,
1835
+ /^(?:loop)/,
1836
+ /^(?:package)/,
1837
+ /^(?:namespace)/,
1838
+ /^(?:return)/,
1839
+ /^(?:var)/,
1840
+ /^(?:void)/,
1841
+ /^(?:while)/,
1842
+ /^(?:null)/,
1843
+ /^(?:true)/,
1844
+ /^(?:false)/,
1845
+ /^(?:\.)/,
1846
+ /^(?:\?)/,
1847
+ /^(?::)/,
1848
+ /^(?:,)/,
1849
+ /^(?:\[)/,
1850
+ /^(?:\])/,
1851
+ /^(?:\()/,
1852
+ /^(?:\))/,
1853
+ /^(?:!=)/,
1854
+ /^(?:!)/,
1855
+ /^(?:\+)/,
1856
+ /^(?:-)/,
1857
+ /^(?:\*)/,
1858
+ /^(?:\/)/,
1859
+ /^(?:%)/,
1860
+ /^(?:==)/,
1861
+ /^(?:>=)/,
1862
+ /^(?:>)/,
1863
+ /^(?:<=)/,
1864
+ /^(?:<)/,
1865
+ /^(?:\{)/,
1866
+ /^(?:\})/,
1867
+ /^(?:&&)/,
1868
+ /^(?:\|\|)/,
1869
+ /^(?:[_a-zA-Z][_a-zA-Z0-9]*)/,
1870
+ /^(?:[rR]?['][']['](?:\.|[^'])*['][']['])/,
1871
+ /^(?:[rR]?["]["]["](?:\.|[^"])*["]["]["])/,
1872
+ /^(?:[rR]?['](?:\.|[^'\n\r])*['])/,
1873
+ /^(?:[rR]?["](?:\.|[^"\n\r])*["])/,
1874
+ /^(?:[-]?(?:[0-9]+|0x[0-9a-fA-F]+))/,
1875
+ /^(?:(?:[0-9]+|0x[0-9a-fA-F]+)[uU])/,
1876
+ /^(?:[-]?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+(?:\.[0-9]+)?)?)/,
1877
+ /^(?:$)/,
1878
+ /^(?:.)/,
1879
+ /^(?:.)/
1880
+ ];
1881
+ conditions = { "INITIAL": {
1882
+ "rules": [
1883
+ 0,
1884
+ 1,
1885
+ 2,
1886
+ 3,
1887
+ 4,
1888
+ 5,
1889
+ 6,
1890
+ 7,
1891
+ 8,
1892
+ 9,
1893
+ 10,
1894
+ 11,
1895
+ 12,
1896
+ 13,
1897
+ 14,
1898
+ 15,
1899
+ 16,
1900
+ 17,
1901
+ 18,
1902
+ 19,
1903
+ 20,
1904
+ 21,
1905
+ 22,
1906
+ 23,
1907
+ 24,
1908
+ 25,
1909
+ 26,
1910
+ 27,
1911
+ 28,
1912
+ 29,
1913
+ 30,
1914
+ 31,
1915
+ 32,
1916
+ 33,
1917
+ 34,
1918
+ 35,
1919
+ 36,
1920
+ 37,
1921
+ 38,
1922
+ 39,
1923
+ 40,
1924
+ 41,
1925
+ 42,
1926
+ 43,
1927
+ 44,
1928
+ 45,
1929
+ 46,
1930
+ 47,
1931
+ 48,
1932
+ 49,
1933
+ 50,
1934
+ 51,
1935
+ 52,
1936
+ 53,
1937
+ 54,
1938
+ 55,
1939
+ 56,
1940
+ 57
1941
+ ],
1942
+ "inclusive": true
1943
+ } };
1944
+ performAction(yy, yy_, $avoiding_name_collisions, YY_START) {
1945
+ switch ($avoiding_name_collisions) {
1946
+ case 0: break;
1947
+ case 1: break;
1948
+ case 2: return 31;
1949
+ case 3: return "as";
1950
+ case 4: return "break";
1951
+ case 5: return "const";
1952
+ case 6: return "continue";
1953
+ case 7: return "else";
1954
+ case 8: return "for";
1955
+ case 9: return "function";
1956
+ case 10: return "if";
1957
+ case 11: return "import";
1958
+ case 12: return "let";
1959
+ case 13: return "loop";
1960
+ case 14: return "package";
1961
+ case 15: return "namespace";
1962
+ case 16: return "return";
1963
+ case 17: return "var";
1964
+ case 18: return "void";
1965
+ case 19: return "while";
1966
+ case 20: return 18;
1967
+ case 21: return 16;
1968
+ case 22: return 16;
1969
+ case 23: return 40;
1970
+ case 24: return 60;
1971
+ case 25: return 61;
1972
+ case 26: return 50;
1973
+ case 27: return 44;
1974
+ case 28: return 45;
1975
+ case 29: return 41;
1976
+ case 30: return 43;
1977
+ case 31: return 28;
1978
+ case 32: return 35;
1979
+ case 33: return 53;
1980
+ case 34: return 37;
1981
+ case 35: return 54;
1982
+ case 36: return 55;
1983
+ case 37: return 56;
1984
+ case 38: return 23;
1985
+ case 39: return 24;
1986
+ case 40: return 25;
1987
+ case 41: return 26;
1988
+ case 42: return 27;
1989
+ case 43: return 46;
1990
+ case 44: return 49;
1991
+ case 45: return 62;
1992
+ case 46: return 63;
1993
+ case 47: return 21;
1994
+ case 48: return 7;
1995
+ case 49: return 7;
1996
+ case 50: return 7;
1997
+ case 51: return 7;
1998
+ case 52: return 12;
1999
+ case 53: return 13;
2000
+ case 54: return 14;
2001
+ case 55: return 5;
2002
+ case 56: return "INVALID";
2003
+ case 57:
2004
+ console.log(yy_.yytext);
2005
+ break;
2006
+ }
2007
+ }
2008
+ };
2345
2009
 
2346
2010
  //#endregion
2347
2011
  //#region src/utils/parseCEL/utils.ts
@@ -2349,26 +2013,64 @@ const isCELExpressionGroup = (expr) => expr.type === "ExpressionGroup";
2349
2013
  const isCELConditionalAnd = (expr) => expr.type === "ConditionalAnd";
2350
2014
  const isCELConditionalOr = (expr) => expr.type === "ConditionalOr";
2351
2015
  const isCELStringLiteral = (expr) => expr.type === "StringLiteral";
2352
- const isCELLiteral = (expr) => isCELNumericLiteral(expr) || isCELStringLiteral(expr) || expr.type === "BooleanLiteral" || expr.type === "NullLiteral" || expr.type === "BytesLiteral";
2353
- const isCELNumericLiteral = (expr) => expr.type === "FloatLiteral" || expr.type === "IntegerLiteral" || expr.type === "UnsignedIntegerLiteral";
2016
+ const isCELLiteral = (expr) => isCELNumericLiteral(expr) || isCELStringLiteral(expr) || isCELBooleanLiteral(expr) || isCELNullLiteral(expr) || isCELBytesLiteral(expr);
2017
+ const isCELNumericLiteral = (expr) => isCELFloatLiteral(expr) || isCELIntegerLiteral(expr) || isCELUnsignedIntegerLiteral(expr);
2354
2018
  const isCELRelation = (expr) => expr.type === "Relation";
2355
2019
  const isCELList = (expr) => expr.type === "List";
2356
2020
  const isCELMap = (expr) => expr.type === "Map";
2357
2021
  const isCELIdentifier = (expr) => expr.type === "Identifier";
2358
2022
  const isCELNegation = (expr) => expr.type === "Negation";
2359
2023
  const isCELMember = (expr) => expr.type === "Member";
2024
+ // istanbul ignore next
2025
+ const isCELAddition = (expr) => expr.type === "Addition";
2026
+ const isCELBooleanLiteral = (expr) => expr.type === "BooleanLiteral";
2027
+ const isCELBytesLiteral = (expr) => expr.type === "BytesLiteral";
2028
+ // istanbul ignore next
2029
+ const isCELConditionalExpr = (expr) => expr.type === "ConditionalExpr";
2030
+ // istanbul ignore next
2031
+ const isCELDivision = (expr) => expr.type === "Division";
2032
+ // istanbul ignore next
2033
+ const isCELDynamicPropertyAccessor = (expr) => expr.type === "DynamicPropertyAccessor";
2034
+ // istanbul ignore next
2035
+ const isCELExpressionList = (expr) => expr.type === "ExpressionList";
2036
+ // istanbul ignore next
2037
+ const isCELFieldInit = (expr) => expr.type === "FieldInit";
2038
+ // istanbul ignore next
2039
+ const isCELFieldInits = (expr) => expr.type === "FieldInits";
2040
+ // istanbul ignore next
2041
+ const isCELFieldsObject = (expr) => expr.type === "FieldsObject";
2042
+ const isCELFloatLiteral = (expr) => expr.type === "FloatLiteral";
2043
+ // istanbul ignore next
2044
+ const isCELFunctionCall = (expr) => expr.type === "FunctionCall";
2045
+ const isCELIntegerLiteral = (expr) => expr.type === "IntegerLiteral";
2046
+ // istanbul ignore next
2047
+ const isCELMapInit = (expr) => expr.type === "MapInit";
2048
+ // istanbul ignore next
2049
+ const isCELMapInits = (expr) => expr.type === "MapInits";
2050
+ // istanbul ignore next
2051
+ const isCELModulo = (expr) => expr.type === "Modulo";
2052
+ // istanbul ignore next
2053
+ const isCELMultiplication = (expr) => expr.type === "Multiplication";
2054
+ // istanbul ignore next
2055
+ const isCELNegative = (expr) => expr.type === "Negative";
2056
+ const isCELNullLiteral = (expr) => expr.type === "NullLiteral";
2057
+ // istanbul ignore next
2058
+ const isCELProperty = (expr) => expr.type === "Property";
2059
+ // istanbul ignore next
2060
+ const isCELSubtraction = (expr) => expr.type === "Subtraction";
2061
+ const isCELUnsignedIntegerLiteral = (expr) => expr.type === "UnsignedIntegerLiteral";
2360
2062
  const isCELIdentifierOrChain = (expr) => isCELIdentifier(expr) || isCELMember(expr) && !!expr.left && !!expr.right && !expr.list && !expr.value && isCELIdentifierOrChain(expr.left) && isCELIdentifier(expr.right);
2361
2063
  const isCELNegatedIdentifier = (expr) => isCELNegation(expr) && isCELIdentifier(expr.value);
2362
2064
  const isCELNegatedIdentifierOrChain = (expr) => isCELNegatedIdentifier(expr) || isCELMember(expr) && !!expr.left && !!expr.right && !expr.list && !expr.value && isCELIdentifierOrChain(expr.right) && isCELNegatedIdentifier(expr.left);
2363
2065
  const isCELLikeExpression = (expr) => isCELMember(expr) && !!expr.left && !!expr.right && !!expr.list && isCELIdentifierOrChain(expr.left) && isCELIdentifier(expr.right) && (expr.right.value === "contains" || expr.right.value === "startsWith" || expr.right.value === "endsWith") && expr.list.value.length === 1 && (isCELStringLiteral(expr.list.value[0]) || isCELIdentifier(expr.list.value[0]));
2364
2066
  const isCELNegatedLikeExpression = (expr) => isCELMember(expr) && !!expr.left && !!expr.right && !!expr.list && isCELNegatedIdentifierOrChain(expr.left) && isCELIdentifier(expr.right) && (expr.right.value === "contains" || expr.right.value === "startsWith" || expr.right.value === "endsWith") && expr.list.value.length === 1 && (isCELStringLiteral(expr.list.value[0]) || isCELIdentifier(expr.list.value[0]));
2365
- const getIdentifierFromChain = (expr) => {
2067
+ const getCELIdentifierFromChain = (expr) => {
2366
2068
  if (isCELIdentifier(expr)) return expr.value;
2367
- return `${getIdentifierFromChain(expr.left)}.${expr.right.value}`;
2069
+ return `${getCELIdentifierFromChain(expr.left)}.${expr.right.value}`;
2368
2070
  };
2369
- const getIdentifierFromNegatedChain = (expr) => {
2071
+ const getCELIdentifierFromNegatedChain = (expr) => {
2370
2072
  if (isCELNegatedIdentifier(expr)) return `${``.padStart(expr.negations, `!`)}${expr.value.value}`;
2371
- return `${getIdentifierFromNegatedChain(expr.left)}.${expr.right.value}`;
2073
+ return `${getCELIdentifierFromNegatedChain(expr.left)}.${expr.right.value}`;
2372
2074
  };
2373
2075
  function evalCELLiteralValue(literal) {
2374
2076
  switch (literal.type) {
@@ -2379,8 +2081,8 @@ function evalCELLiteralValue(literal) {
2379
2081
  default: return literal.value;
2380
2082
  }
2381
2083
  }
2382
- const normalizeCombinator = (c) => c === "||" ? "or" : "and";
2383
- const normalizeOperator = (op, flip) => {
2084
+ const celNormalizeCombinator = (c) => c === "||" ? "or" : "and";
2085
+ const celNormalizeOperator = (op, flip) => {
2384
2086
  if (flip) {
2385
2087
  if (op === "<") return ">";
2386
2088
  if (op === "<=") return ">=";
@@ -2390,11 +2092,11 @@ const normalizeOperator = (op, flip) => {
2390
2092
  if (op === "==") return "=";
2391
2093
  return op;
2392
2094
  };
2393
- const generateFlatAndOrList = (expr) => {
2394
- const combinator = normalizeCombinator(expr.type === "ConditionalAnd" ? "&&" : "||");
2095
+ const celGenerateFlatAndOrList = (expr) => {
2096
+ const combinator = celNormalizeCombinator(expr.type === "ConditionalAnd" ? "&&" : "||");
2395
2097
  const { left, right } = expr;
2396
2098
  if (isCELConditionalAnd(left) || isCELConditionalOr(left)) return [
2397
- ...generateFlatAndOrList(left),
2099
+ ...celGenerateFlatAndOrList(left),
2398
2100
  combinator,
2399
2101
  right
2400
2102
  ];
@@ -2404,8 +2106,8 @@ const generateFlatAndOrList = (expr) => {
2404
2106
  right
2405
2107
  ];
2406
2108
  };
2407
- const generateMixedAndOrList = (expr) => {
2408
- const arr = generateFlatAndOrList(expr);
2109
+ const celGenerateMixedAndOrList = (expr) => {
2110
+ const arr = celGenerateFlatAndOrList(expr);
2409
2111
  const returnArray = [];
2410
2112
  let startIndex = 0;
2411
2113
  for (let i = 0; i < arr.length; i += 2) if (arr[i + 1] === "and") {
@@ -2431,7 +2133,7 @@ const generateMixedAndOrList = (expr) => {
2431
2133
  //#endregion
2432
2134
  //#region src/utils/parseCEL/parseCEL.ts
2433
2135
  function parseCEL(cel, options = {}) {
2434
- const { fields, independentCombinators, listsAsArrays } = options;
2136
+ const { fields, independentCombinators, listsAsArrays, customExpressionHandler } = options;
2435
2137
  const ic = !!independentCombinators;
2436
2138
  const fieldsFlat = require_prepareQueryObjects.getFieldsArray(fields);
2437
2139
  const fieldIsValid = (fieldName, operator, subordinateFieldName) => require_prepareQueryObjects.fieldIsValidUtil({
@@ -2449,12 +2151,12 @@ function parseCEL(cel, options = {}) {
2449
2151
  const { forwardNegation: forwardedNegation, groupOnlyIfNecessary } = processOpts;
2450
2152
  /* istanbul ignore if */
2451
2153
  if (isCELNegation(expr) || isCELNegatedLikeExpression(expr)) {
2452
- const negate = isCELNegation(expr) ? expr.negations % 2 === 1 : (getIdentifierFromNegatedChain(expr.left).match(/^!+/)?.[0].length ?? 0) % 2 === 1;
2154
+ const negate = isCELNegation(expr) ? expr.negations % 2 === 1 : (getCELIdentifierFromNegatedChain(expr.left).match(/^!+/)?.[0].length ?? 0) % 2 === 1;
2453
2155
  const negatedExpr = isCELNegation(expr) && isCELExpressionGroup(expr.value) && isCELLikeExpression(expr.value.value) ? processCELExpression(expr.value.value, { forwardNegation: negate }) : isCELNegatedLikeExpression(expr) ? processCELExpression({
2454
2156
  ...expr,
2455
2157
  left: {
2456
2158
  type: "Identifier",
2457
- value: getIdentifierFromNegatedChain(expr.left).replace(/^!+/, "")
2159
+ value: getCELIdentifierFromNegatedChain(expr.left).replace(/^!+/, "")
2458
2160
  }
2459
2161
  }, { forwardNegation: negate }) : isCELNegation(expr) && isCELExpressionGroup(expr.value) && isCELRelation(expr.value.value) ? processCELExpression(expr.value.value, { forwardNegation: negate }) : processCELExpression(expr.value, {
2460
2162
  groupOnlyIfNecessary: true,
@@ -2486,14 +2188,14 @@ function parseCEL(cel, options = {}) {
2486
2188
  }
2487
2189
  } else if (isCELConditionalAnd(expr) || isCELConditionalOr(expr)) {
2488
2190
  if (ic) {
2489
- const rules$1 = generateFlatAndOrList(expr).map((v) => {
2191
+ const rules$1 = celGenerateFlatAndOrList(expr).map((v) => {
2490
2192
  if (typeof v === "string") return v;
2491
2193
  return processCELExpression(v);
2492
2194
  });
2493
2195
  if (!rules$1.every(Boolean)) return null;
2494
2196
  return { rules: rules$1 };
2495
2197
  }
2496
- const andOrList = generateMixedAndOrList(expr);
2198
+ const andOrList = celGenerateMixedAndOrList(expr);
2497
2199
  const combinator = andOrList[1];
2498
2200
  const rules = andOrList.filter((v) => Array.isArray(v) || !!v && typeof v !== "string" && "type" in v).map((v) => Array.isArray(v) ? v.filter((vf) => !!v && typeof vf !== "string" && "type" in vf) : v).map((exp) => {
2499
2201
  if (Array.isArray(exp)) return {
@@ -2508,7 +2210,7 @@ function parseCEL(cel, options = {}) {
2508
2210
  rules
2509
2211
  };
2510
2212
  } else if (isCELLikeExpression(expr)) {
2511
- const field = getIdentifierFromChain(expr.left);
2213
+ const field = getCELIdentifierFromChain(expr.left);
2512
2214
  const func = expr.right.value;
2513
2215
  const operatorPre = func === "startsWith" ? "beginsWith" : func;
2514
2216
  const operator = forwardedNegation ? `doesNot${operatorPre[0].toUpperCase()}${operatorPre.slice(1).replace("s", "")}` : operatorPre;
@@ -2532,29 +2234,29 @@ function parseCEL(cel, options = {}) {
2532
2234
  let flip = false;
2533
2235
  const { left, right } = expr;
2534
2236
  if (isCELIdentifierOrChain(left)) {
2535
- field = getIdentifierFromChain(left);
2237
+ field = getCELIdentifierFromChain(left);
2536
2238
  if (isCELIdentifierOrChain(right)) {
2537
- value = getIdentifierFromChain(right);
2239
+ value = getCELIdentifierFromChain(right);
2538
2240
  valueSource = "field";
2539
2241
  } else if (isCELLiteral(right)) value = evalCELLiteralValue(right);
2540
2242
  } else if (isCELIdentifierOrChain(right) && isCELLiteral(left) && expr.operator !== "in") {
2541
2243
  flip = true;
2542
- field = getIdentifierFromChain(right);
2244
+ field = getCELIdentifierFromChain(right);
2543
2245
  value = evalCELLiteralValue(left);
2544
2246
  }
2545
- let operator = normalizeOperator(expr.operator, flip);
2546
- if (forwardedNegation) operator = require_arrayUtils.defaultOperatorNegationMap[operator];
2247
+ let operator = celNormalizeOperator(expr.operator, flip);
2248
+ if (forwardedNegation) operator = require_optGroupUtils.defaultOperatorNegationMap[operator];
2547
2249
  if (value === null && (operator === "=" || operator === "!=")) operator = operator === "=" ? "null" : "notNull";
2548
2250
  else if ((operator === "in" || operator === "notIn") && isCELList(right)) {
2549
2251
  if (right.value.value.every((v) => isCELLiteral(v))) value = right.value.value.map((v) => evalCELLiteralValue(v));
2550
2252
  else if (right.value.value.every((v) => isCELIdentifierOrChain(v))) {
2551
2253
  valueSource = "field";
2552
- value = right.value.value.map((id) => getIdentifierFromChain(id));
2254
+ value = right.value.value.map((id) => getCELIdentifierFromChain(id));
2553
2255
  }
2554
2256
  if (value && !listsAsArrays) value = require_arrayUtils.joinWith(value.map((v) => `${v}`), ",");
2555
2257
  } else if ((operator === "in" || operator === "notIn") && isCELMap(right)) {
2556
2258
  const keys = right.value.value.map((v) => v.left);
2557
- if (keys.every((k) => isCELLiteral(k) || isCELIdentifierOrChain(k))) value = keys.map((k) => isCELLiteral(k) ? evalCELLiteralValue(k) : getIdentifierFromChain(k));
2259
+ if (keys.every((k) => isCELLiteral(k) || isCELIdentifierOrChain(k))) value = keys.map((k) => isCELLiteral(k) ? evalCELLiteralValue(k) : getCELIdentifierFromChain(k));
2558
2260
  if (value && !listsAsArrays) value = require_arrayUtils.joinWith(value.map((v) => `${v}`), ",");
2559
2261
  }
2560
2262
  if (field && fieldIsValid(field, operator, valueSource === "field" ? value : void 0) && value !== void 0) return valueSource ? {
@@ -2567,10 +2269,11 @@ function parseCEL(cel, options = {}) {
2567
2269
  operator,
2568
2270
  value
2569
2271
  };
2570
- }
2272
+ } else if (customExpressionHandler) return customExpressionHandler(expr);
2571
2273
  return null;
2572
2274
  };
2573
2275
  const prepare = options.generateIDs ? require_prepareQueryObjects.prepareRuleGroup : (g) => g;
2276
+ const celParser = new CELParser();
2574
2277
  let processedCEL;
2575
2278
  try {
2576
2279
  processedCEL = celParser.parse(cel).value;
@@ -2589,5 +2292,51 @@ function parseCEL(cel, options = {}) {
2589
2292
  }
2590
2293
 
2591
2294
  //#endregion
2295
+ exports.celGenerateFlatAndOrList = celGenerateFlatAndOrList;
2296
+ exports.celGenerateMixedAndOrList = celGenerateMixedAndOrList;
2297
+ exports.celNormalizeCombinator = celNormalizeCombinator;
2298
+ exports.celNormalizeOperator = celNormalizeOperator;
2299
+ exports.evalCELLiteralValue = evalCELLiteralValue;
2300
+ exports.getCELIdentifierFromChain = getCELIdentifierFromChain;
2301
+ exports.getCELIdentifierFromNegatedChain = getCELIdentifierFromNegatedChain;
2302
+ exports.isCELAddition = isCELAddition;
2303
+ exports.isCELBooleanLiteral = isCELBooleanLiteral;
2304
+ exports.isCELBytesLiteral = isCELBytesLiteral;
2305
+ exports.isCELConditionalAnd = isCELConditionalAnd;
2306
+ exports.isCELConditionalExpr = isCELConditionalExpr;
2307
+ exports.isCELConditionalOr = isCELConditionalOr;
2308
+ exports.isCELDivision = isCELDivision;
2309
+ exports.isCELDynamicPropertyAccessor = isCELDynamicPropertyAccessor;
2310
+ exports.isCELExpressionGroup = isCELExpressionGroup;
2311
+ exports.isCELExpressionList = isCELExpressionList;
2312
+ exports.isCELFieldInit = isCELFieldInit;
2313
+ exports.isCELFieldInits = isCELFieldInits;
2314
+ exports.isCELFieldsObject = isCELFieldsObject;
2315
+ exports.isCELFloatLiteral = isCELFloatLiteral;
2316
+ exports.isCELFunctionCall = isCELFunctionCall;
2317
+ exports.isCELIdentifier = isCELIdentifier;
2318
+ exports.isCELIdentifierOrChain = isCELIdentifierOrChain;
2319
+ exports.isCELIntegerLiteral = isCELIntegerLiteral;
2320
+ exports.isCELLikeExpression = isCELLikeExpression;
2321
+ exports.isCELList = isCELList;
2322
+ exports.isCELLiteral = isCELLiteral;
2323
+ exports.isCELMap = isCELMap;
2324
+ exports.isCELMapInit = isCELMapInit;
2325
+ exports.isCELMapInits = isCELMapInits;
2326
+ exports.isCELMember = isCELMember;
2327
+ exports.isCELModulo = isCELModulo;
2328
+ exports.isCELMultiplication = isCELMultiplication;
2329
+ exports.isCELNegatedIdentifier = isCELNegatedIdentifier;
2330
+ exports.isCELNegatedIdentifierOrChain = isCELNegatedIdentifierOrChain;
2331
+ exports.isCELNegatedLikeExpression = isCELNegatedLikeExpression;
2332
+ exports.isCELNegation = isCELNegation;
2333
+ exports.isCELNegative = isCELNegative;
2334
+ exports.isCELNullLiteral = isCELNullLiteral;
2335
+ exports.isCELNumericLiteral = isCELNumericLiteral;
2336
+ exports.isCELProperty = isCELProperty;
2337
+ exports.isCELRelation = isCELRelation;
2338
+ exports.isCELStringLiteral = isCELStringLiteral;
2339
+ exports.isCELSubtraction = isCELSubtraction;
2340
+ exports.isCELUnsignedIntegerLiteral = isCELUnsignedIntegerLiteral;
2592
2341
  exports.parseCEL = parseCEL;
2593
2342
  //# sourceMappingURL=parseCEL.js.map