@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.
- package/dist/{arrayUtils-BF1P8iHS.mjs → arrayUtils-A_OXU9W1.mjs} +3 -75
- package/dist/arrayUtils-A_OXU9W1.mjs.map +1 -0
- package/dist/arrayUtils-QxZOZTf6.js +73 -0
- package/dist/arrayUtils-QxZOZTf6.js.map +1 -0
- package/dist/basic-DEc65Kng.d.mts +363 -0
- package/dist/basic-Dd_M2f3M.d.ts +363 -0
- package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +806 -1366
- package/dist/cjs/react-querybuilder_core.cjs.development.js +455 -116
- package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +806 -1366
- package/dist/cjs/react-querybuilder_core.cjs.production.js +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.js.map +1 -1
- package/dist/{convertQuery-H7RhQiIc.mjs → convertQuery-CqX3rPvj.mjs} +3 -3
- package/dist/{convertQuery-H7RhQiIc.mjs.map → convertQuery-CqX3rPvj.mjs.map} +1 -1
- package/dist/{export-DyrnTh6K.d.ts → export-Dy4FckB-.d.ts} +7 -6
- package/dist/{export-r-V7bU31.d.mts → export-t1V2N8pz.d.mts} +7 -6
- package/dist/formatQuery.d.mts +3 -2
- package/dist/formatQuery.d.ts +3 -2
- package/dist/formatQuery.js +217 -87
- package/dist/formatQuery.js.map +1 -1
- package/dist/formatQuery.mjs +217 -87
- package/dist/formatQuery.mjs.map +1 -1
- package/dist/{import-Cksobmln.d.ts → import-Cz8canKo.d.mts} +3 -3
- package/dist/{import-BwbbP4oU.d.mts → import-DtS9Ocx5.d.ts} +3 -3
- package/dist/{isRuleGroup-CnhYpLOM.mjs → isRuleGroup-CYcfPgbg.mjs} +2 -2
- package/dist/{isRuleGroup-CnhYpLOM.mjs.map → isRuleGroup-CYcfPgbg.mjs.map} +1 -1
- package/dist/lexer-C53tqS2p.js +406 -0
- package/dist/lexer-C53tqS2p.js.map +1 -0
- package/dist/{optGroupUtils-CXLgyg2i.js → optGroupUtils-B0hTpodo.js} +114 -1
- package/dist/optGroupUtils-B0hTpodo.js.map +1 -0
- package/dist/{optGroupUtils-Duv-M8rf.mjs → optGroupUtils-VeZ3k7-1.mjs} +86 -3
- package/dist/optGroupUtils-VeZ3k7-1.mjs.map +1 -0
- package/dist/parseCEL.d.mts +292 -11
- package/dist/parseCEL.d.ts +292 -11
- package/dist/parseCEL.js +874 -1125
- package/dist/parseCEL.js.map +1 -1
- package/dist/parseCEL.mjs +828 -1126
- package/dist/parseCEL.mjs.map +1 -1
- package/dist/parseJSONata.d.mts +3 -2
- package/dist/parseJSONata.d.ts +3 -2
- package/dist/parseJSONata.js +49 -77
- package/dist/parseJSONata.js.map +1 -1
- package/dist/parseJSONata.mjs +4 -5
- package/dist/parseJSONata.mjs.map +1 -1
- package/dist/parseJsonLogic.d.mts +4 -3
- package/dist/parseJsonLogic.d.ts +4 -3
- package/dist/parseJsonLogic.js +5 -6
- package/dist/parseJsonLogic.js.map +1 -1
- package/dist/parseJsonLogic.mjs +5 -6
- package/dist/parseJsonLogic.mjs.map +1 -1
- package/dist/parseMongoDB.d.mts +3 -2
- package/dist/parseMongoDB.d.ts +3 -2
- package/dist/parseMongoDB.js +15 -16
- package/dist/parseMongoDB.js.map +1 -1
- package/dist/parseMongoDB.mjs +5 -6
- package/dist/parseMongoDB.mjs.map +1 -1
- package/dist/{parseNumber-BtGKa58z.mjs → parseNumber-CXdMVNFx.mjs} +2 -2
- package/dist/{parseNumber-BtGKa58z.mjs.map → parseNumber-CXdMVNFx.mjs.map} +1 -1
- package/dist/{parseNumber-Bcys1kOH.js → parseNumber-D4iQDxK-.js} +1 -1
- package/dist/{parseNumber-Bcys1kOH.js.map → parseNumber-D4iQDxK-.js.map} +1 -1
- package/dist/parseSQL.d.mts +3 -2
- package/dist/parseSQL.d.ts +3 -2
- package/dist/parseSQL.js +2691 -3036
- package/dist/parseSQL.js.map +1 -1
- package/dist/parseSQL.mjs +2691 -3037
- package/dist/parseSQL.mjs.map +1 -1
- package/dist/parseSpEL.d.mts +3 -2
- package/dist/parseSpEL.d.ts +3 -2
- package/dist/parseSpEL.js +7 -9
- package/dist/parseSpEL.js.map +1 -1
- package/dist/parseSpEL.mjs +5 -6
- package/dist/parseSpEL.mjs.map +1 -1
- package/dist/{prepareQueryObjects-BqFEs4eV.js → prepareQueryObjects-BOUWfel5.js} +4 -5
- package/dist/prepareQueryObjects-BOUWfel5.js.map +1 -0
- package/dist/{prepareQueryObjects-CS6Wmhmf.mjs → prepareQueryObjects-DPCC-iHp.mjs} +6 -7
- package/dist/prepareQueryObjects-DPCC-iHp.mjs.map +1 -0
- package/dist/query-builder-layout.css +1 -1
- package/dist/query-builder-layout.css.map +1 -1
- package/dist/query-builder.css +1 -1
- package/dist/query-builder.css.map +1 -1
- package/dist/react-querybuilder_core.d.mts +806 -1366
- package/dist/react-querybuilder_core.legacy-esm.d.ts +806 -1366
- package/dist/react-querybuilder_core.legacy-esm.js +455 -114
- package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_core.mjs +448 -117
- package/dist/react-querybuilder_core.mjs.map +1 -1
- package/dist/react-querybuilder_core.production.d.mts +806 -1366
- package/dist/react-querybuilder_core.production.mjs +1 -1
- package/dist/react-querybuilder_core.production.mjs.map +1 -1
- package/dist/styles/_layout.scss +61 -17
- package/dist/styles/_main.scss +22 -4
- package/dist/{transformQuery-FL_nlpp5.js → transformQuery-CWDPogO5.js} +1 -1
- package/dist/{transformQuery-FL_nlpp5.js.map → transformQuery-CWDPogO5.js.map} +1 -1
- package/dist/{transformQuery-DdMvmrCh.mjs → transformQuery-DCCpjtyq.mjs} +3 -3
- package/dist/{transformQuery-DdMvmrCh.mjs.map → transformQuery-DCCpjtyq.mjs.map} +1 -1
- package/dist/transformQuery.d.mts +1 -1
- package/dist/transformQuery.d.ts +1 -1
- package/dist/transformQuery.js +1 -1
- package/dist/transformQuery.mjs +2 -2
- package/package.json +14 -12
- package/dist/arrayUtils-BF1P8iHS.mjs.map +0 -1
- package/dist/arrayUtils-D5EoIsKP.js +0 -164
- package/dist/arrayUtils-D5EoIsKP.js.map +0 -1
- package/dist/basic-BfD-7CN3.d.mts +0 -1235
- package/dist/basic-C8xXKHIA.d.ts +0 -1235
- package/dist/objectUtils-BBZSfZJz.js +0 -17
- package/dist/objectUtils-BBZSfZJz.js.map +0 -1
- package/dist/objectUtils-BtWdcZVG.mjs +0 -11
- package/dist/objectUtils-BtWdcZVG.mjs.map +0 -1
- package/dist/optGroupUtils-CXLgyg2i.js.map +0 -1
- package/dist/optGroupUtils-Duv-M8rf.mjs.map +0 -1
- package/dist/prepareQueryObjects-BqFEs4eV.js.map +0 -1
- package/dist/prepareQueryObjects-CS6Wmhmf.mjs.map +0 -1
package/dist/parseCEL.mjs
CHANGED
|
@@ -1,567 +1,282 @@
|
|
|
1
|
-
import { defaultOperatorNegationMap
|
|
2
|
-
import {
|
|
3
|
-
import "./
|
|
4
|
-
import { fieldIsValidUtil, getFieldsArray, prepareRuleGroup } from "./prepareQueryObjects-
|
|
1
|
+
import { l as defaultOperatorNegationMap } from "./optGroupUtils-VeZ3k7-1.mjs";
|
|
2
|
+
import { t as joinWith } from "./arrayUtils-A_OXU9W1.mjs";
|
|
3
|
+
import { t as isRuleGroup } from "./isRuleGroup-CYcfPgbg.mjs";
|
|
4
|
+
import { n as fieldIsValidUtil, r as getFieldsArray, t as prepareRuleGroup } from "./prepareQueryObjects-DPCC-iHp.mjs";
|
|
5
|
+
import { JisonParser } from "@ts-jison/parser";
|
|
6
|
+
import { JisonLexer } from "@ts-jison/lexer";
|
|
5
7
|
|
|
6
|
-
//#region src/utils/parseCEL/celParser.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
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: [
|
|
8
|
+
//#region src/utils/parseCEL/celParser.ts
|
|
9
|
+
/**
|
|
10
|
+
* parser generated by @ts-jison/parser-generator 0.4.1-alpha.2
|
|
11
|
+
* @returns Parser implementing JisonParserApi and a Lexer implementing JisonLexerApi.
|
|
12
|
+
*/
|
|
13
|
+
var CELParser = class extends JisonParser {
|
|
14
|
+
$;
|
|
15
|
+
symbols_ = {
|
|
16
|
+
"error": 2,
|
|
17
|
+
"main": 3,
|
|
18
|
+
"expr": 4,
|
|
19
|
+
"EOF": 5,
|
|
20
|
+
"string_literal": 6,
|
|
21
|
+
"STRING_LIT": 7,
|
|
22
|
+
"bytes_literal": 8,
|
|
23
|
+
"b": 9,
|
|
24
|
+
"B": 10,
|
|
25
|
+
"number_literal": 11,
|
|
26
|
+
"INT_LIT": 12,
|
|
27
|
+
"UINT_LIT": 13,
|
|
28
|
+
"FLOAT_LIT": 14,
|
|
29
|
+
"boolean_literal": 15,
|
|
30
|
+
"BOOL_LIT": 16,
|
|
31
|
+
"null_literal": 17,
|
|
32
|
+
"NULL_LIT": 18,
|
|
33
|
+
"literal": 19,
|
|
34
|
+
"ident": 20,
|
|
35
|
+
"IDENT": 21,
|
|
36
|
+
"relop": 22,
|
|
37
|
+
"==": 23,
|
|
38
|
+
">=": 24,
|
|
39
|
+
">": 25,
|
|
40
|
+
"<=": 26,
|
|
41
|
+
"<": 27,
|
|
42
|
+
"!=": 28,
|
|
43
|
+
"relation": 29,
|
|
44
|
+
"member": 30,
|
|
45
|
+
"in": 31,
|
|
46
|
+
"list": 32,
|
|
47
|
+
"map": 33,
|
|
48
|
+
"negation": 34,
|
|
49
|
+
"!": 35,
|
|
50
|
+
"negative": 36,
|
|
51
|
+
"-": 37,
|
|
52
|
+
"unary": 38,
|
|
53
|
+
"primary": 39,
|
|
54
|
+
"DOT": 40,
|
|
55
|
+
"(": 41,
|
|
56
|
+
"expr_list": 42,
|
|
57
|
+
")": 43,
|
|
58
|
+
"[": 44,
|
|
59
|
+
"]": 45,
|
|
60
|
+
"{": 46,
|
|
61
|
+
"field_inits": 47,
|
|
62
|
+
"trailing_comma": 48,
|
|
63
|
+
"}": 49,
|
|
64
|
+
",": 50,
|
|
65
|
+
"map_inits": 51,
|
|
66
|
+
"math_operation": 52,
|
|
67
|
+
"+": 53,
|
|
68
|
+
"*": 54,
|
|
69
|
+
"/": 55,
|
|
70
|
+
"%": 56,
|
|
71
|
+
"conditional_expr": 57,
|
|
72
|
+
"conditional_and": 58,
|
|
73
|
+
"conditional_or": 59,
|
|
74
|
+
"?": 60,
|
|
75
|
+
":": 61,
|
|
76
|
+
"&&": 62,
|
|
77
|
+
"||": 63,
|
|
78
|
+
"$accept": 0,
|
|
79
|
+
"$end": 1
|
|
80
|
+
};
|
|
81
|
+
terminals_ = {
|
|
82
|
+
2: "error",
|
|
83
|
+
5: "EOF",
|
|
84
|
+
7: "STRING_LIT",
|
|
85
|
+
9: "b",
|
|
86
|
+
10: "B",
|
|
87
|
+
12: "INT_LIT",
|
|
88
|
+
13: "UINT_LIT",
|
|
89
|
+
14: "FLOAT_LIT",
|
|
90
|
+
16: "BOOL_LIT",
|
|
91
|
+
18: "NULL_LIT",
|
|
92
|
+
21: "IDENT",
|
|
93
|
+
23: "==",
|
|
94
|
+
24: ">=",
|
|
95
|
+
25: ">",
|
|
96
|
+
26: "<=",
|
|
97
|
+
27: "<",
|
|
98
|
+
28: "!=",
|
|
99
|
+
31: "in",
|
|
100
|
+
35: "!",
|
|
101
|
+
37: "-",
|
|
102
|
+
40: "DOT",
|
|
103
|
+
41: "(",
|
|
104
|
+
43: ")",
|
|
105
|
+
44: "[",
|
|
106
|
+
45: "]",
|
|
107
|
+
46: "{",
|
|
108
|
+
49: "}",
|
|
109
|
+
50: ",",
|
|
110
|
+
53: "+",
|
|
111
|
+
54: "*",
|
|
112
|
+
55: "/",
|
|
113
|
+
56: "%",
|
|
114
|
+
60: "?",
|
|
115
|
+
61: ":",
|
|
116
|
+
62: "&&",
|
|
117
|
+
63: "||"
|
|
118
|
+
};
|
|
119
|
+
productions_ = [
|
|
120
|
+
0,
|
|
121
|
+
[3, 2],
|
|
122
|
+
[6, 1],
|
|
123
|
+
[8, 2],
|
|
124
|
+
[8, 2],
|
|
125
|
+
[11, 1],
|
|
126
|
+
[11, 1],
|
|
127
|
+
[11, 1],
|
|
128
|
+
[15, 1],
|
|
129
|
+
[17, 1],
|
|
130
|
+
[19, 1],
|
|
131
|
+
[19, 1],
|
|
132
|
+
[19, 1],
|
|
133
|
+
[19, 1],
|
|
134
|
+
[19, 1],
|
|
135
|
+
[20, 1],
|
|
136
|
+
[22, 1],
|
|
137
|
+
[22, 1],
|
|
138
|
+
[22, 1],
|
|
139
|
+
[22, 1],
|
|
140
|
+
[22, 1],
|
|
141
|
+
[22, 1],
|
|
142
|
+
[29, 3],
|
|
143
|
+
[29, 3],
|
|
144
|
+
[29, 3],
|
|
145
|
+
[34, 1],
|
|
146
|
+
[34, 2],
|
|
147
|
+
[36, 1],
|
|
148
|
+
[36, 2],
|
|
149
|
+
[38, 2],
|
|
150
|
+
[30, 1],
|
|
151
|
+
[30, 1],
|
|
152
|
+
[30, 3],
|
|
153
|
+
[30, 6],
|
|
154
|
+
[30, 4],
|
|
155
|
+
[30, 5],
|
|
156
|
+
[48, 0],
|
|
157
|
+
[48, 1],
|
|
158
|
+
[39, 1],
|
|
159
|
+
[39, 2],
|
|
160
|
+
[39, 5],
|
|
161
|
+
[39, 6],
|
|
162
|
+
[39, 3],
|
|
163
|
+
[39, 1],
|
|
164
|
+
[39, 1],
|
|
165
|
+
[39, 1],
|
|
166
|
+
[32, 4],
|
|
167
|
+
[33, 4],
|
|
168
|
+
[52, 3],
|
|
169
|
+
[52, 3],
|
|
170
|
+
[52, 3],
|
|
171
|
+
[52, 3],
|
|
172
|
+
[52, 3],
|
|
173
|
+
[4, 1],
|
|
174
|
+
[4, 1],
|
|
175
|
+
[4, 1],
|
|
176
|
+
[4, 1],
|
|
177
|
+
[4, 1],
|
|
178
|
+
[4, 1],
|
|
179
|
+
[57, 5],
|
|
180
|
+
[58, 3],
|
|
181
|
+
[59, 3],
|
|
182
|
+
[42, 1],
|
|
183
|
+
[42, 3],
|
|
184
|
+
[47, 3],
|
|
185
|
+
[47, 5],
|
|
186
|
+
[51, 3],
|
|
187
|
+
[51, 5]
|
|
188
|
+
];
|
|
189
|
+
table;
|
|
190
|
+
defaultActions = { 35: [2, 1] };
|
|
191
|
+
constructor(yy = {}, lexer = new CELLexer(yy)) {
|
|
192
|
+
super(yy, lexer);
|
|
193
|
+
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 = [
|
|
194
|
+
5,
|
|
195
|
+
37,
|
|
196
|
+
43,
|
|
197
|
+
45,
|
|
198
|
+
49,
|
|
199
|
+
50,
|
|
200
|
+
53,
|
|
201
|
+
54,
|
|
202
|
+
55,
|
|
203
|
+
56,
|
|
204
|
+
60,
|
|
205
|
+
61,
|
|
206
|
+
62,
|
|
207
|
+
63
|
|
208
|
+
], $Vn = [1, 44], $Vo = [1, 45], $Vp = [1, 46], $Vq = [
|
|
209
|
+
5,
|
|
210
|
+
23,
|
|
211
|
+
24,
|
|
212
|
+
25,
|
|
213
|
+
26,
|
|
214
|
+
27,
|
|
215
|
+
28,
|
|
216
|
+
31,
|
|
217
|
+
37,
|
|
218
|
+
40,
|
|
219
|
+
43,
|
|
220
|
+
44,
|
|
221
|
+
45,
|
|
222
|
+
46,
|
|
223
|
+
49,
|
|
224
|
+
50,
|
|
225
|
+
53,
|
|
226
|
+
54,
|
|
227
|
+
55,
|
|
228
|
+
56,
|
|
229
|
+
60,
|
|
230
|
+
61,
|
|
231
|
+
62,
|
|
232
|
+
63
|
|
233
|
+
], $Vr = [
|
|
234
|
+
7,
|
|
235
|
+
9,
|
|
236
|
+
10,
|
|
237
|
+
12,
|
|
238
|
+
13,
|
|
239
|
+
14,
|
|
240
|
+
16,
|
|
241
|
+
18,
|
|
242
|
+
21,
|
|
243
|
+
35,
|
|
244
|
+
40,
|
|
245
|
+
41,
|
|
246
|
+
44,
|
|
247
|
+
46
|
|
248
|
+
], $Vs = [2, 36], $Vt = [1, 85], $Vu = [
|
|
249
|
+
43,
|
|
250
|
+
45,
|
|
251
|
+
50
|
|
252
|
+
], $Vv = [
|
|
253
|
+
5,
|
|
254
|
+
37,
|
|
255
|
+
43,
|
|
256
|
+
45,
|
|
257
|
+
49,
|
|
258
|
+
50,
|
|
259
|
+
53,
|
|
260
|
+
61,
|
|
261
|
+
62,
|
|
262
|
+
63
|
|
263
|
+
], $Vw = [
|
|
264
|
+
5,
|
|
265
|
+
37,
|
|
266
|
+
43,
|
|
267
|
+
45,
|
|
268
|
+
49,
|
|
269
|
+
50,
|
|
270
|
+
53,
|
|
271
|
+
54,
|
|
272
|
+
55,
|
|
273
|
+
56,
|
|
274
|
+
61,
|
|
275
|
+
62,
|
|
276
|
+
63
|
|
277
|
+
], $Vx = [2, 37], $Vy = [49, 50];
|
|
278
|
+
const o = JisonParser.expandParseTable;
|
|
279
|
+
this.table = [
|
|
565
280
|
{
|
|
566
281
|
3: 1,
|
|
567
282
|
4: 2,
|
|
@@ -1800,548 +1515,496 @@ var celParser = (function() {
|
|
|
1800
1515
|
62: $Vk,
|
|
1801
1516
|
63: $Vl
|
|
1802
1517
|
})
|
|
1803
|
-
]
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
}
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
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
|
|
1518
|
+
];
|
|
1519
|
+
}
|
|
1520
|
+
performAction(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
|
|
1521
|
+
var $0 = $$.length - 1;
|
|
1522
|
+
switch (yystate) {
|
|
1523
|
+
case 1: return {
|
|
1524
|
+
nodeType: "Main",
|
|
1525
|
+
value: $$[$0 - 1]
|
|
1526
|
+
};
|
|
1527
|
+
case 2:
|
|
1528
|
+
this.$ = {
|
|
1529
|
+
type: "StringLiteral",
|
|
1530
|
+
value: $$[$0]
|
|
1962
1531
|
};
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
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
|
|
1532
|
+
break;
|
|
1533
|
+
case 3:
|
|
1534
|
+
case 4:
|
|
1535
|
+
this.$ = {
|
|
1536
|
+
type: "BytesLiteral",
|
|
1537
|
+
value: $$[$0]
|
|
1997
1538
|
};
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
1539
|
+
break;
|
|
1540
|
+
case 5:
|
|
1541
|
+
this.$ = {
|
|
1542
|
+
type: "IntegerLiteral",
|
|
1543
|
+
value: parseInt($$[$0], /x/.test($$[$0]) ? 16 : 10)
|
|
1544
|
+
};
|
|
1545
|
+
break;
|
|
1546
|
+
case 6:
|
|
1547
|
+
this.$ = {
|
|
1548
|
+
type: "UnsignedIntegerLiteral",
|
|
1549
|
+
value: parseInt($$[$0].replace(/u$/i, ""), /^0x/.test($$[$0]) ? 16 : 10)
|
|
1550
|
+
};
|
|
1551
|
+
break;
|
|
1552
|
+
case 7:
|
|
1553
|
+
this.$ = {
|
|
1554
|
+
type: "FloatLiteral",
|
|
1555
|
+
value: parseFloat($$[$0])
|
|
1556
|
+
};
|
|
1557
|
+
break;
|
|
1558
|
+
case 8:
|
|
1559
|
+
this.$ = {
|
|
1560
|
+
type: "BooleanLiteral",
|
|
1561
|
+
value: $$[$0] === "true"
|
|
1562
|
+
};
|
|
1563
|
+
break;
|
|
1564
|
+
case 9:
|
|
1565
|
+
this.$ = {
|
|
1566
|
+
type: "NullLiteral",
|
|
1567
|
+
value: null
|
|
1568
|
+
};
|
|
1569
|
+
break;
|
|
1570
|
+
case 10:
|
|
1571
|
+
case 11:
|
|
1572
|
+
case 12:
|
|
1573
|
+
case 13:
|
|
1574
|
+
case 14:
|
|
1575
|
+
case 16:
|
|
1576
|
+
case 17:
|
|
1577
|
+
case 18:
|
|
1578
|
+
case 19:
|
|
1579
|
+
case 20:
|
|
1580
|
+
case 21:
|
|
1581
|
+
case 38:
|
|
1582
|
+
case 43:
|
|
1583
|
+
case 44:
|
|
1584
|
+
case 45:
|
|
1585
|
+
case 53:
|
|
1586
|
+
case 54:
|
|
1587
|
+
case 55:
|
|
1588
|
+
case 56:
|
|
1589
|
+
case 57:
|
|
1590
|
+
case 58:
|
|
1591
|
+
this.$ = $$[$0];
|
|
1592
|
+
break;
|
|
1593
|
+
case 15:
|
|
1594
|
+
this.$ = {
|
|
1595
|
+
type: "Identifier",
|
|
1596
|
+
value: $$[$0]
|
|
1597
|
+
};
|
|
1598
|
+
break;
|
|
1599
|
+
case 22:
|
|
1600
|
+
case 23:
|
|
1601
|
+
case 24:
|
|
1602
|
+
this.$ = {
|
|
1603
|
+
type: "Relation",
|
|
1604
|
+
left: $$[$0 - 2],
|
|
1605
|
+
operator: $$[$0 - 1],
|
|
1606
|
+
right: $$[$0]
|
|
1607
|
+
};
|
|
1608
|
+
break;
|
|
1609
|
+
case 25:
|
|
1610
|
+
case 27:
|
|
1611
|
+
this.$ = 1;
|
|
1612
|
+
break;
|
|
1613
|
+
case 26:
|
|
1614
|
+
case 28:
|
|
1615
|
+
this.$ = this.$ += 1;
|
|
1616
|
+
break;
|
|
1617
|
+
case 29:
|
|
1618
|
+
this.$ = {
|
|
1619
|
+
type: "Negation",
|
|
1620
|
+
negations: $$[$0 - 1],
|
|
1621
|
+
value: $$[$0]
|
|
1622
|
+
};
|
|
1623
|
+
break;
|
|
1624
|
+
case 30:
|
|
1625
|
+
case 31:
|
|
1626
|
+
this.$ = $$[$0];
|
|
1627
|
+
break;
|
|
1628
|
+
case 32:
|
|
1629
|
+
this.$ = {
|
|
1630
|
+
type: "Member",
|
|
1631
|
+
left: $$[$0 - 2],
|
|
1632
|
+
right: $$[$0]
|
|
1633
|
+
};
|
|
1634
|
+
break;
|
|
1635
|
+
case 33:
|
|
1636
|
+
this.$ = {
|
|
1637
|
+
type: "Member",
|
|
1638
|
+
left: $$[$0 - 5],
|
|
1639
|
+
right: $$[$0 - 3],
|
|
1640
|
+
list: $$[$0 - 1]
|
|
1641
|
+
};
|
|
1642
|
+
break;
|
|
1643
|
+
case 34:
|
|
1644
|
+
this.$ = {
|
|
1645
|
+
type: "DynamicPropertyAccessor",
|
|
1646
|
+
left: $$[$0 - 3],
|
|
1647
|
+
right: $$[$0 - 1]
|
|
1648
|
+
};
|
|
1649
|
+
break;
|
|
1650
|
+
case 35:
|
|
1651
|
+
this.$ = {
|
|
1652
|
+
type: "FieldsObject",
|
|
1653
|
+
left: $$[$0 - 4],
|
|
1654
|
+
list: $$[$0 - 2],
|
|
1655
|
+
trailingComma: $$[$0 - 1]
|
|
1656
|
+
};
|
|
1657
|
+
break;
|
|
1658
|
+
case 36:
|
|
1659
|
+
this.$ = false;
|
|
1660
|
+
break;
|
|
1661
|
+
case 37:
|
|
1662
|
+
this.$ = true;
|
|
1663
|
+
break;
|
|
1664
|
+
case 39:
|
|
1665
|
+
this.$ = {
|
|
1666
|
+
type: "Property",
|
|
1667
|
+
value: $$[$0]
|
|
1668
|
+
};
|
|
1669
|
+
break;
|
|
1670
|
+
case 40:
|
|
1671
|
+
this.$ = {
|
|
1672
|
+
type: "FunctionCall",
|
|
1673
|
+
name: $$[$0 - 4],
|
|
1674
|
+
args: $$[$0 - 2],
|
|
1675
|
+
trailingComma: $$[$0 - 1]
|
|
1676
|
+
};
|
|
1677
|
+
break;
|
|
1678
|
+
case 41:
|
|
1679
|
+
this.$ = {
|
|
1680
|
+
type: "Property",
|
|
1681
|
+
value: $$[$0 - 4],
|
|
1682
|
+
args: $$[$0 - 2],
|
|
1683
|
+
trailingComma: $$[$0 - 1]
|
|
1684
|
+
};
|
|
1685
|
+
break;
|
|
1686
|
+
case 42:
|
|
1687
|
+
this.$ = {
|
|
1688
|
+
type: "ExpressionGroup",
|
|
1689
|
+
value: $$[$0 - 1]
|
|
1690
|
+
};
|
|
1691
|
+
break;
|
|
1692
|
+
case 46:
|
|
1693
|
+
this.$ = {
|
|
1694
|
+
type: "List",
|
|
1695
|
+
value: $$[$0 - 2],
|
|
1696
|
+
trailingComma: $$[$0 - 1]
|
|
1697
|
+
};
|
|
1698
|
+
break;
|
|
1699
|
+
case 47:
|
|
1700
|
+
this.$ = {
|
|
1701
|
+
type: "Map",
|
|
1702
|
+
value: $$[$0 - 2],
|
|
1703
|
+
trailingComma: $$[$0 - 1]
|
|
1704
|
+
};
|
|
1705
|
+
break;
|
|
1706
|
+
case 48:
|
|
1707
|
+
this.$ = {
|
|
1708
|
+
type: "Addition",
|
|
1709
|
+
left: $$[$0 - 2],
|
|
1710
|
+
right: $$[$0]
|
|
1711
|
+
};
|
|
1712
|
+
break;
|
|
1713
|
+
case 49:
|
|
1714
|
+
this.$ = {
|
|
1715
|
+
type: "Subtraction",
|
|
1716
|
+
left: $$[$0 - 2],
|
|
1717
|
+
right: $$[$0]
|
|
1718
|
+
};
|
|
1719
|
+
break;
|
|
1720
|
+
case 50:
|
|
1721
|
+
this.$ = {
|
|
1722
|
+
type: "Multiplication",
|
|
1723
|
+
left: $$[$0 - 2],
|
|
1724
|
+
right: $$[$0]
|
|
1725
|
+
};
|
|
1726
|
+
break;
|
|
1727
|
+
case 51:
|
|
1728
|
+
this.$ = {
|
|
1729
|
+
type: "Division",
|
|
1730
|
+
left: $$[$0 - 2],
|
|
1731
|
+
right: $$[$0]
|
|
1732
|
+
};
|
|
1733
|
+
break;
|
|
1734
|
+
case 52:
|
|
1735
|
+
this.$ = {
|
|
1736
|
+
type: "Modulo",
|
|
1737
|
+
left: $$[$0 - 2],
|
|
1738
|
+
right: $$[$0]
|
|
1739
|
+
};
|
|
1740
|
+
break;
|
|
1741
|
+
case 59:
|
|
1742
|
+
this.$ = {
|
|
1743
|
+
type: "ConditionalExpr",
|
|
1744
|
+
condition: $$[$0 - 4],
|
|
1745
|
+
valueIfTrue: $$[$0 - 2],
|
|
1746
|
+
valueIfFalse: $$[$0]
|
|
1747
|
+
};
|
|
1748
|
+
break;
|
|
1749
|
+
case 60:
|
|
1750
|
+
this.$ = {
|
|
1751
|
+
type: "ConditionalAnd",
|
|
1752
|
+
left: $$[$0 - 2],
|
|
1753
|
+
right: $$[$0]
|
|
1754
|
+
};
|
|
1755
|
+
break;
|
|
1756
|
+
case 61:
|
|
1757
|
+
this.$ = {
|
|
1758
|
+
type: "ConditionalOr",
|
|
1759
|
+
left: $$[$0 - 2],
|
|
1760
|
+
right: $$[$0]
|
|
1761
|
+
};
|
|
1762
|
+
break;
|
|
1763
|
+
case 62:
|
|
1764
|
+
this.$ = {
|
|
1765
|
+
type: "ExpressionList",
|
|
1766
|
+
value: [$$[$0]]
|
|
1767
|
+
};
|
|
1768
|
+
break;
|
|
1769
|
+
case 63:
|
|
1770
|
+
this.$ = $$[$0 - 2];
|
|
1771
|
+
this.$.value.push($$[$0]);
|
|
1772
|
+
break;
|
|
1773
|
+
case 64:
|
|
1774
|
+
this.$ = {
|
|
1775
|
+
type: "FieldInits",
|
|
1776
|
+
value: [{
|
|
1777
|
+
type: "FieldInit",
|
|
1778
|
+
left: $$[$0 - 2],
|
|
1779
|
+
right: $$[$0]
|
|
1780
|
+
}]
|
|
1781
|
+
};
|
|
1782
|
+
break;
|
|
1783
|
+
case 65:
|
|
1784
|
+
this.$ = $$[$0 - 4];
|
|
1785
|
+
this.$.value.push({
|
|
1786
|
+
type: "FieldInit",
|
|
1787
|
+
left: $$[$0 - 2],
|
|
1788
|
+
right: $$[$0]
|
|
2013
1789
|
});
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
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
|
|
1790
|
+
break;
|
|
1791
|
+
case 66:
|
|
1792
|
+
this.$ = {
|
|
1793
|
+
type: "MapInits",
|
|
1794
|
+
value: [{
|
|
1795
|
+
type: "MapInit",
|
|
1796
|
+
left: $$[$0 - 2],
|
|
1797
|
+
right: $$[$0]
|
|
1798
|
+
}]
|
|
2065
1799
|
};
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
this
|
|
2069
|
-
this.
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
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
|
|
1800
|
+
break;
|
|
1801
|
+
case 67:
|
|
1802
|
+
this.$ = $$[$0 - 4];
|
|
1803
|
+
this.$.value.push({
|
|
1804
|
+
type: "MapInit",
|
|
1805
|
+
left: $$[$0 - 2],
|
|
1806
|
+
right: $$[$0]
|
|
2119
1807
|
});
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
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 = {};
|
|
1808
|
+
break;
|
|
1809
|
+
}
|
|
1810
|
+
}
|
|
1811
|
+
};
|
|
1812
|
+
var CELLexer = class extends JisonLexer {
|
|
1813
|
+
options = {
|
|
1814
|
+
"flex": true,
|
|
1815
|
+
"moduleName": "CEL"
|
|
1816
|
+
};
|
|
1817
|
+
constructor(yy = {}) {
|
|
1818
|
+
super(yy);
|
|
2340
1819
|
}
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
1820
|
+
rules = [
|
|
1821
|
+
/^(?:[/][/]\s.*\n)/,
|
|
1822
|
+
/^(?:\s+)/,
|
|
1823
|
+
/^(?:in)/,
|
|
1824
|
+
/^(?:as)/,
|
|
1825
|
+
/^(?:break)/,
|
|
1826
|
+
/^(?:const)/,
|
|
1827
|
+
/^(?:continue)/,
|
|
1828
|
+
/^(?:else)/,
|
|
1829
|
+
/^(?:for)/,
|
|
1830
|
+
/^(?:function)/,
|
|
1831
|
+
/^(?:if)/,
|
|
1832
|
+
/^(?:import)/,
|
|
1833
|
+
/^(?:let)/,
|
|
1834
|
+
/^(?:loop)/,
|
|
1835
|
+
/^(?:package)/,
|
|
1836
|
+
/^(?:namespace)/,
|
|
1837
|
+
/^(?:return)/,
|
|
1838
|
+
/^(?:var)/,
|
|
1839
|
+
/^(?:void)/,
|
|
1840
|
+
/^(?:while)/,
|
|
1841
|
+
/^(?:null)/,
|
|
1842
|
+
/^(?:true)/,
|
|
1843
|
+
/^(?:false)/,
|
|
1844
|
+
/^(?:\.)/,
|
|
1845
|
+
/^(?:\?)/,
|
|
1846
|
+
/^(?::)/,
|
|
1847
|
+
/^(?:,)/,
|
|
1848
|
+
/^(?:\[)/,
|
|
1849
|
+
/^(?:\])/,
|
|
1850
|
+
/^(?:\()/,
|
|
1851
|
+
/^(?:\))/,
|
|
1852
|
+
/^(?:!=)/,
|
|
1853
|
+
/^(?:!)/,
|
|
1854
|
+
/^(?:\+)/,
|
|
1855
|
+
/^(?:-)/,
|
|
1856
|
+
/^(?:\*)/,
|
|
1857
|
+
/^(?:\/)/,
|
|
1858
|
+
/^(?:%)/,
|
|
1859
|
+
/^(?:==)/,
|
|
1860
|
+
/^(?:>=)/,
|
|
1861
|
+
/^(?:>)/,
|
|
1862
|
+
/^(?:<=)/,
|
|
1863
|
+
/^(?:<)/,
|
|
1864
|
+
/^(?:\{)/,
|
|
1865
|
+
/^(?:\})/,
|
|
1866
|
+
/^(?:&&)/,
|
|
1867
|
+
/^(?:\|\|)/,
|
|
1868
|
+
/^(?:[_a-zA-Z][_a-zA-Z0-9]*)/,
|
|
1869
|
+
/^(?:[rR]?['][']['](?:\.|[^'])*['][']['])/,
|
|
1870
|
+
/^(?:[rR]?["]["]["](?:\.|[^"])*["]["]["])/,
|
|
1871
|
+
/^(?:[rR]?['](?:\.|[^'\n\r])*['])/,
|
|
1872
|
+
/^(?:[rR]?["](?:\.|[^"\n\r])*["])/,
|
|
1873
|
+
/^(?:[-]?(?:[0-9]+|0x[0-9a-fA-F]+))/,
|
|
1874
|
+
/^(?:(?:[0-9]+|0x[0-9a-fA-F]+)[uU])/,
|
|
1875
|
+
/^(?:[-]?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+(?:\.[0-9]+)?)?)/,
|
|
1876
|
+
/^(?:$)/,
|
|
1877
|
+
/^(?:.)/,
|
|
1878
|
+
/^(?:.)/
|
|
1879
|
+
];
|
|
1880
|
+
conditions = { "INITIAL": {
|
|
1881
|
+
"rules": [
|
|
1882
|
+
0,
|
|
1883
|
+
1,
|
|
1884
|
+
2,
|
|
1885
|
+
3,
|
|
1886
|
+
4,
|
|
1887
|
+
5,
|
|
1888
|
+
6,
|
|
1889
|
+
7,
|
|
1890
|
+
8,
|
|
1891
|
+
9,
|
|
1892
|
+
10,
|
|
1893
|
+
11,
|
|
1894
|
+
12,
|
|
1895
|
+
13,
|
|
1896
|
+
14,
|
|
1897
|
+
15,
|
|
1898
|
+
16,
|
|
1899
|
+
17,
|
|
1900
|
+
18,
|
|
1901
|
+
19,
|
|
1902
|
+
20,
|
|
1903
|
+
21,
|
|
1904
|
+
22,
|
|
1905
|
+
23,
|
|
1906
|
+
24,
|
|
1907
|
+
25,
|
|
1908
|
+
26,
|
|
1909
|
+
27,
|
|
1910
|
+
28,
|
|
1911
|
+
29,
|
|
1912
|
+
30,
|
|
1913
|
+
31,
|
|
1914
|
+
32,
|
|
1915
|
+
33,
|
|
1916
|
+
34,
|
|
1917
|
+
35,
|
|
1918
|
+
36,
|
|
1919
|
+
37,
|
|
1920
|
+
38,
|
|
1921
|
+
39,
|
|
1922
|
+
40,
|
|
1923
|
+
41,
|
|
1924
|
+
42,
|
|
1925
|
+
43,
|
|
1926
|
+
44,
|
|
1927
|
+
45,
|
|
1928
|
+
46,
|
|
1929
|
+
47,
|
|
1930
|
+
48,
|
|
1931
|
+
49,
|
|
1932
|
+
50,
|
|
1933
|
+
51,
|
|
1934
|
+
52,
|
|
1935
|
+
53,
|
|
1936
|
+
54,
|
|
1937
|
+
55,
|
|
1938
|
+
56,
|
|
1939
|
+
57
|
|
1940
|
+
],
|
|
1941
|
+
"inclusive": true
|
|
1942
|
+
} };
|
|
1943
|
+
performAction(yy, yy_, $avoiding_name_collisions, YY_START) {
|
|
1944
|
+
switch ($avoiding_name_collisions) {
|
|
1945
|
+
case 0: break;
|
|
1946
|
+
case 1: break;
|
|
1947
|
+
case 2: return 31;
|
|
1948
|
+
case 3: return "as";
|
|
1949
|
+
case 4: return "break";
|
|
1950
|
+
case 5: return "const";
|
|
1951
|
+
case 6: return "continue";
|
|
1952
|
+
case 7: return "else";
|
|
1953
|
+
case 8: return "for";
|
|
1954
|
+
case 9: return "function";
|
|
1955
|
+
case 10: return "if";
|
|
1956
|
+
case 11: return "import";
|
|
1957
|
+
case 12: return "let";
|
|
1958
|
+
case 13: return "loop";
|
|
1959
|
+
case 14: return "package";
|
|
1960
|
+
case 15: return "namespace";
|
|
1961
|
+
case 16: return "return";
|
|
1962
|
+
case 17: return "var";
|
|
1963
|
+
case 18: return "void";
|
|
1964
|
+
case 19: return "while";
|
|
1965
|
+
case 20: return 18;
|
|
1966
|
+
case 21: return 16;
|
|
1967
|
+
case 22: return 16;
|
|
1968
|
+
case 23: return 40;
|
|
1969
|
+
case 24: return 60;
|
|
1970
|
+
case 25: return 61;
|
|
1971
|
+
case 26: return 50;
|
|
1972
|
+
case 27: return 44;
|
|
1973
|
+
case 28: return 45;
|
|
1974
|
+
case 29: return 41;
|
|
1975
|
+
case 30: return 43;
|
|
1976
|
+
case 31: return 28;
|
|
1977
|
+
case 32: return 35;
|
|
1978
|
+
case 33: return 53;
|
|
1979
|
+
case 34: return 37;
|
|
1980
|
+
case 35: return 54;
|
|
1981
|
+
case 36: return 55;
|
|
1982
|
+
case 37: return 56;
|
|
1983
|
+
case 38: return 23;
|
|
1984
|
+
case 39: return 24;
|
|
1985
|
+
case 40: return 25;
|
|
1986
|
+
case 41: return 26;
|
|
1987
|
+
case 42: return 27;
|
|
1988
|
+
case 43: return 46;
|
|
1989
|
+
case 44: return 49;
|
|
1990
|
+
case 45: return 62;
|
|
1991
|
+
case 46: return 63;
|
|
1992
|
+
case 47: return 21;
|
|
1993
|
+
case 48: return 7;
|
|
1994
|
+
case 49: return 7;
|
|
1995
|
+
case 50: return 7;
|
|
1996
|
+
case 51: return 7;
|
|
1997
|
+
case 52: return 12;
|
|
1998
|
+
case 53: return 13;
|
|
1999
|
+
case 54: return 14;
|
|
2000
|
+
case 55: return 5;
|
|
2001
|
+
case 56: return "INVALID";
|
|
2002
|
+
case 57:
|
|
2003
|
+
console.log(yy_.yytext);
|
|
2004
|
+
break;
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
};
|
|
2345
2008
|
|
|
2346
2009
|
//#endregion
|
|
2347
2010
|
//#region src/utils/parseCEL/utils.ts
|
|
@@ -2349,26 +2012,64 @@ const isCELExpressionGroup = (expr) => expr.type === "ExpressionGroup";
|
|
|
2349
2012
|
const isCELConditionalAnd = (expr) => expr.type === "ConditionalAnd";
|
|
2350
2013
|
const isCELConditionalOr = (expr) => expr.type === "ConditionalOr";
|
|
2351
2014
|
const isCELStringLiteral = (expr) => expr.type === "StringLiteral";
|
|
2352
|
-
const isCELLiteral = (expr) => isCELNumericLiteral(expr) || isCELStringLiteral(expr) || expr
|
|
2353
|
-
const isCELNumericLiteral = (expr) => expr
|
|
2015
|
+
const isCELLiteral = (expr) => isCELNumericLiteral(expr) || isCELStringLiteral(expr) || isCELBooleanLiteral(expr) || isCELNullLiteral(expr) || isCELBytesLiteral(expr);
|
|
2016
|
+
const isCELNumericLiteral = (expr) => isCELFloatLiteral(expr) || isCELIntegerLiteral(expr) || isCELUnsignedIntegerLiteral(expr);
|
|
2354
2017
|
const isCELRelation = (expr) => expr.type === "Relation";
|
|
2355
2018
|
const isCELList = (expr) => expr.type === "List";
|
|
2356
2019
|
const isCELMap = (expr) => expr.type === "Map";
|
|
2357
2020
|
const isCELIdentifier = (expr) => expr.type === "Identifier";
|
|
2358
2021
|
const isCELNegation = (expr) => expr.type === "Negation";
|
|
2359
2022
|
const isCELMember = (expr) => expr.type === "Member";
|
|
2023
|
+
// istanbul ignore next
|
|
2024
|
+
const isCELAddition = (expr) => expr.type === "Addition";
|
|
2025
|
+
const isCELBooleanLiteral = (expr) => expr.type === "BooleanLiteral";
|
|
2026
|
+
const isCELBytesLiteral = (expr) => expr.type === "BytesLiteral";
|
|
2027
|
+
// istanbul ignore next
|
|
2028
|
+
const isCELConditionalExpr = (expr) => expr.type === "ConditionalExpr";
|
|
2029
|
+
// istanbul ignore next
|
|
2030
|
+
const isCELDivision = (expr) => expr.type === "Division";
|
|
2031
|
+
// istanbul ignore next
|
|
2032
|
+
const isCELDynamicPropertyAccessor = (expr) => expr.type === "DynamicPropertyAccessor";
|
|
2033
|
+
// istanbul ignore next
|
|
2034
|
+
const isCELExpressionList = (expr) => expr.type === "ExpressionList";
|
|
2035
|
+
// istanbul ignore next
|
|
2036
|
+
const isCELFieldInit = (expr) => expr.type === "FieldInit";
|
|
2037
|
+
// istanbul ignore next
|
|
2038
|
+
const isCELFieldInits = (expr) => expr.type === "FieldInits";
|
|
2039
|
+
// istanbul ignore next
|
|
2040
|
+
const isCELFieldsObject = (expr) => expr.type === "FieldsObject";
|
|
2041
|
+
const isCELFloatLiteral = (expr) => expr.type === "FloatLiteral";
|
|
2042
|
+
// istanbul ignore next
|
|
2043
|
+
const isCELFunctionCall = (expr) => expr.type === "FunctionCall";
|
|
2044
|
+
const isCELIntegerLiteral = (expr) => expr.type === "IntegerLiteral";
|
|
2045
|
+
// istanbul ignore next
|
|
2046
|
+
const isCELMapInit = (expr) => expr.type === "MapInit";
|
|
2047
|
+
// istanbul ignore next
|
|
2048
|
+
const isCELMapInits = (expr) => expr.type === "MapInits";
|
|
2049
|
+
// istanbul ignore next
|
|
2050
|
+
const isCELModulo = (expr) => expr.type === "Modulo";
|
|
2051
|
+
// istanbul ignore next
|
|
2052
|
+
const isCELMultiplication = (expr) => expr.type === "Multiplication";
|
|
2053
|
+
// istanbul ignore next
|
|
2054
|
+
const isCELNegative = (expr) => expr.type === "Negative";
|
|
2055
|
+
const isCELNullLiteral = (expr) => expr.type === "NullLiteral";
|
|
2056
|
+
// istanbul ignore next
|
|
2057
|
+
const isCELProperty = (expr) => expr.type === "Property";
|
|
2058
|
+
// istanbul ignore next
|
|
2059
|
+
const isCELSubtraction = (expr) => expr.type === "Subtraction";
|
|
2060
|
+
const isCELUnsignedIntegerLiteral = (expr) => expr.type === "UnsignedIntegerLiteral";
|
|
2360
2061
|
const isCELIdentifierOrChain = (expr) => isCELIdentifier(expr) || isCELMember(expr) && !!expr.left && !!expr.right && !expr.list && !expr.value && isCELIdentifierOrChain(expr.left) && isCELIdentifier(expr.right);
|
|
2361
2062
|
const isCELNegatedIdentifier = (expr) => isCELNegation(expr) && isCELIdentifier(expr.value);
|
|
2362
2063
|
const isCELNegatedIdentifierOrChain = (expr) => isCELNegatedIdentifier(expr) || isCELMember(expr) && !!expr.left && !!expr.right && !expr.list && !expr.value && isCELIdentifierOrChain(expr.right) && isCELNegatedIdentifier(expr.left);
|
|
2363
2064
|
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
2065
|
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
|
|
2066
|
+
const getCELIdentifierFromChain = (expr) => {
|
|
2366
2067
|
if (isCELIdentifier(expr)) return expr.value;
|
|
2367
|
-
return `${
|
|
2068
|
+
return `${getCELIdentifierFromChain(expr.left)}.${expr.right.value}`;
|
|
2368
2069
|
};
|
|
2369
|
-
const
|
|
2070
|
+
const getCELIdentifierFromNegatedChain = (expr) => {
|
|
2370
2071
|
if (isCELNegatedIdentifier(expr)) return `${``.padStart(expr.negations, `!`)}${expr.value.value}`;
|
|
2371
|
-
return `${
|
|
2072
|
+
return `${getCELIdentifierFromNegatedChain(expr.left)}.${expr.right.value}`;
|
|
2372
2073
|
};
|
|
2373
2074
|
function evalCELLiteralValue(literal) {
|
|
2374
2075
|
switch (literal.type) {
|
|
@@ -2379,8 +2080,8 @@ function evalCELLiteralValue(literal) {
|
|
|
2379
2080
|
default: return literal.value;
|
|
2380
2081
|
}
|
|
2381
2082
|
}
|
|
2382
|
-
const
|
|
2383
|
-
const
|
|
2083
|
+
const celNormalizeCombinator = (c) => c === "||" ? "or" : "and";
|
|
2084
|
+
const celNormalizeOperator = (op, flip) => {
|
|
2384
2085
|
if (flip) {
|
|
2385
2086
|
if (op === "<") return ">";
|
|
2386
2087
|
if (op === "<=") return ">=";
|
|
@@ -2390,11 +2091,11 @@ const normalizeOperator = (op, flip) => {
|
|
|
2390
2091
|
if (op === "==") return "=";
|
|
2391
2092
|
return op;
|
|
2392
2093
|
};
|
|
2393
|
-
const
|
|
2394
|
-
const combinator =
|
|
2094
|
+
const celGenerateFlatAndOrList = (expr) => {
|
|
2095
|
+
const combinator = celNormalizeCombinator(expr.type === "ConditionalAnd" ? "&&" : "||");
|
|
2395
2096
|
const { left, right } = expr;
|
|
2396
2097
|
if (isCELConditionalAnd(left) || isCELConditionalOr(left)) return [
|
|
2397
|
-
...
|
|
2098
|
+
...celGenerateFlatAndOrList(left),
|
|
2398
2099
|
combinator,
|
|
2399
2100
|
right
|
|
2400
2101
|
];
|
|
@@ -2404,8 +2105,8 @@ const generateFlatAndOrList = (expr) => {
|
|
|
2404
2105
|
right
|
|
2405
2106
|
];
|
|
2406
2107
|
};
|
|
2407
|
-
const
|
|
2408
|
-
const arr =
|
|
2108
|
+
const celGenerateMixedAndOrList = (expr) => {
|
|
2109
|
+
const arr = celGenerateFlatAndOrList(expr);
|
|
2409
2110
|
const returnArray = [];
|
|
2410
2111
|
let startIndex = 0;
|
|
2411
2112
|
for (let i = 0; i < arr.length; i += 2) if (arr[i + 1] === "and") {
|
|
@@ -2431,7 +2132,7 @@ const generateMixedAndOrList = (expr) => {
|
|
|
2431
2132
|
//#endregion
|
|
2432
2133
|
//#region src/utils/parseCEL/parseCEL.ts
|
|
2433
2134
|
function parseCEL(cel, options = {}) {
|
|
2434
|
-
const { fields, independentCombinators, listsAsArrays } = options;
|
|
2135
|
+
const { fields, independentCombinators, listsAsArrays, customExpressionHandler } = options;
|
|
2435
2136
|
const ic = !!independentCombinators;
|
|
2436
2137
|
const fieldsFlat = getFieldsArray(fields);
|
|
2437
2138
|
const fieldIsValid = (fieldName, operator, subordinateFieldName) => fieldIsValidUtil({
|
|
@@ -2449,12 +2150,12 @@ function parseCEL(cel, options = {}) {
|
|
|
2449
2150
|
const { forwardNegation: forwardedNegation, groupOnlyIfNecessary } = processOpts;
|
|
2450
2151
|
/* istanbul ignore if */
|
|
2451
2152
|
if (isCELNegation(expr) || isCELNegatedLikeExpression(expr)) {
|
|
2452
|
-
const negate = isCELNegation(expr) ? expr.negations % 2 === 1 : (
|
|
2153
|
+
const negate = isCELNegation(expr) ? expr.negations % 2 === 1 : (getCELIdentifierFromNegatedChain(expr.left).match(/^!+/)?.[0].length ?? 0) % 2 === 1;
|
|
2453
2154
|
const negatedExpr = isCELNegation(expr) && isCELExpressionGroup(expr.value) && isCELLikeExpression(expr.value.value) ? processCELExpression(expr.value.value, { forwardNegation: negate }) : isCELNegatedLikeExpression(expr) ? processCELExpression({
|
|
2454
2155
|
...expr,
|
|
2455
2156
|
left: {
|
|
2456
2157
|
type: "Identifier",
|
|
2457
|
-
value:
|
|
2158
|
+
value: getCELIdentifierFromNegatedChain(expr.left).replace(/^!+/, "")
|
|
2458
2159
|
}
|
|
2459
2160
|
}, { forwardNegation: negate }) : isCELNegation(expr) && isCELExpressionGroup(expr.value) && isCELRelation(expr.value.value) ? processCELExpression(expr.value.value, { forwardNegation: negate }) : processCELExpression(expr.value, {
|
|
2460
2161
|
groupOnlyIfNecessary: true,
|
|
@@ -2486,14 +2187,14 @@ function parseCEL(cel, options = {}) {
|
|
|
2486
2187
|
}
|
|
2487
2188
|
} else if (isCELConditionalAnd(expr) || isCELConditionalOr(expr)) {
|
|
2488
2189
|
if (ic) {
|
|
2489
|
-
const rules$1 =
|
|
2190
|
+
const rules$1 = celGenerateFlatAndOrList(expr).map((v) => {
|
|
2490
2191
|
if (typeof v === "string") return v;
|
|
2491
2192
|
return processCELExpression(v);
|
|
2492
2193
|
});
|
|
2493
2194
|
if (!rules$1.every(Boolean)) return null;
|
|
2494
2195
|
return { rules: rules$1 };
|
|
2495
2196
|
}
|
|
2496
|
-
const andOrList =
|
|
2197
|
+
const andOrList = celGenerateMixedAndOrList(expr);
|
|
2497
2198
|
const combinator = andOrList[1];
|
|
2498
2199
|
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
2200
|
if (Array.isArray(exp)) return {
|
|
@@ -2508,7 +2209,7 @@ function parseCEL(cel, options = {}) {
|
|
|
2508
2209
|
rules
|
|
2509
2210
|
};
|
|
2510
2211
|
} else if (isCELLikeExpression(expr)) {
|
|
2511
|
-
const field =
|
|
2212
|
+
const field = getCELIdentifierFromChain(expr.left);
|
|
2512
2213
|
const func = expr.right.value;
|
|
2513
2214
|
const operatorPre = func === "startsWith" ? "beginsWith" : func;
|
|
2514
2215
|
const operator = forwardedNegation ? `doesNot${operatorPre[0].toUpperCase()}${operatorPre.slice(1).replace("s", "")}` : operatorPre;
|
|
@@ -2532,29 +2233,29 @@ function parseCEL(cel, options = {}) {
|
|
|
2532
2233
|
let flip = false;
|
|
2533
2234
|
const { left, right } = expr;
|
|
2534
2235
|
if (isCELIdentifierOrChain(left)) {
|
|
2535
|
-
field =
|
|
2236
|
+
field = getCELIdentifierFromChain(left);
|
|
2536
2237
|
if (isCELIdentifierOrChain(right)) {
|
|
2537
|
-
value =
|
|
2238
|
+
value = getCELIdentifierFromChain(right);
|
|
2538
2239
|
valueSource = "field";
|
|
2539
2240
|
} else if (isCELLiteral(right)) value = evalCELLiteralValue(right);
|
|
2540
2241
|
} else if (isCELIdentifierOrChain(right) && isCELLiteral(left) && expr.operator !== "in") {
|
|
2541
2242
|
flip = true;
|
|
2542
|
-
field =
|
|
2243
|
+
field = getCELIdentifierFromChain(right);
|
|
2543
2244
|
value = evalCELLiteralValue(left);
|
|
2544
2245
|
}
|
|
2545
|
-
let operator =
|
|
2246
|
+
let operator = celNormalizeOperator(expr.operator, flip);
|
|
2546
2247
|
if (forwardedNegation) operator = defaultOperatorNegationMap[operator];
|
|
2547
2248
|
if (value === null && (operator === "=" || operator === "!=")) operator = operator === "=" ? "null" : "notNull";
|
|
2548
2249
|
else if ((operator === "in" || operator === "notIn") && isCELList(right)) {
|
|
2549
2250
|
if (right.value.value.every((v) => isCELLiteral(v))) value = right.value.value.map((v) => evalCELLiteralValue(v));
|
|
2550
2251
|
else if (right.value.value.every((v) => isCELIdentifierOrChain(v))) {
|
|
2551
2252
|
valueSource = "field";
|
|
2552
|
-
value = right.value.value.map((id) =>
|
|
2253
|
+
value = right.value.value.map((id) => getCELIdentifierFromChain(id));
|
|
2553
2254
|
}
|
|
2554
2255
|
if (value && !listsAsArrays) value = joinWith(value.map((v) => `${v}`), ",");
|
|
2555
2256
|
} else if ((operator === "in" || operator === "notIn") && isCELMap(right)) {
|
|
2556
2257
|
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) :
|
|
2258
|
+
if (keys.every((k) => isCELLiteral(k) || isCELIdentifierOrChain(k))) value = keys.map((k) => isCELLiteral(k) ? evalCELLiteralValue(k) : getCELIdentifierFromChain(k));
|
|
2558
2259
|
if (value && !listsAsArrays) value = joinWith(value.map((v) => `${v}`), ",");
|
|
2559
2260
|
}
|
|
2560
2261
|
if (field && fieldIsValid(field, operator, valueSource === "field" ? value : void 0) && value !== void 0) return valueSource ? {
|
|
@@ -2567,10 +2268,11 @@ function parseCEL(cel, options = {}) {
|
|
|
2567
2268
|
operator,
|
|
2568
2269
|
value
|
|
2569
2270
|
};
|
|
2570
|
-
}
|
|
2271
|
+
} else if (customExpressionHandler) return customExpressionHandler(expr);
|
|
2571
2272
|
return null;
|
|
2572
2273
|
};
|
|
2573
2274
|
const prepare = options.generateIDs ? prepareRuleGroup : (g) => g;
|
|
2275
|
+
const celParser = new CELParser();
|
|
2574
2276
|
let processedCEL;
|
|
2575
2277
|
try {
|
|
2576
2278
|
processedCEL = celParser.parse(cel).value;
|
|
@@ -2589,5 +2291,5 @@ function parseCEL(cel, options = {}) {
|
|
|
2589
2291
|
}
|
|
2590
2292
|
|
|
2591
2293
|
//#endregion
|
|
2592
|
-
export { parseCEL };
|
|
2294
|
+
export { celGenerateFlatAndOrList, celGenerateMixedAndOrList, celNormalizeCombinator, celNormalizeOperator, evalCELLiteralValue, getCELIdentifierFromChain, getCELIdentifierFromNegatedChain, isCELAddition, isCELBooleanLiteral, isCELBytesLiteral, isCELConditionalAnd, isCELConditionalExpr, isCELConditionalOr, isCELDivision, isCELDynamicPropertyAccessor, isCELExpressionGroup, isCELExpressionList, isCELFieldInit, isCELFieldInits, isCELFieldsObject, isCELFloatLiteral, isCELFunctionCall, isCELIdentifier, isCELIdentifierOrChain, isCELIntegerLiteral, isCELLikeExpression, isCELList, isCELLiteral, isCELMap, isCELMapInit, isCELMapInits, isCELMember, isCELModulo, isCELMultiplication, isCELNegatedIdentifier, isCELNegatedIdentifierOrChain, isCELNegatedLikeExpression, isCELNegation, isCELNegative, isCELNullLiteral, isCELNumericLiteral, isCELProperty, isCELRelation, isCELStringLiteral, isCELSubtraction, isCELUnsignedIntegerLiteral, parseCEL };
|
|
2593
2295
|
//# sourceMappingURL=parseCEL.mjs.map
|