@malloydata/malloy-filter 0.0.237-dev250224215546 → 0.0.237-dev250225015031
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/SAMPLES.md +336 -114
- package/SERIALIZE_SAMPLES.md +268 -64
- package/dist/a_simple_parser.js +6 -0
- package/dist/a_simple_parser.js.map +1 -1
- package/dist/base_parser.js +6 -0
- package/dist/base_parser.js.map +1 -1
- package/dist/boolean_parser.js +28 -13
- package/dist/boolean_parser.js.map +1 -1
- package/dist/boolean_serializer.js +12 -6
- package/dist/boolean_serializer.js.map +1 -1
- package/dist/clause_types.d.ts +20 -15
- package/dist/clause_types.js +6 -0
- package/dist/clause_types.js.map +1 -1
- package/dist/date_parser.js +135 -116
- package/dist/date_parser.js.map +1 -1
- package/dist/date_serializer.js +26 -20
- package/dist/date_serializer.js.map +1 -1
- package/dist/date_types.d.ts +21 -21
- package/dist/date_types.js +6 -0
- package/dist/date_types.js.map +1 -1
- package/dist/generate_samples.js +32 -25
- package/dist/generate_samples.js.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/number_parser.js +43 -25
- package/dist/number_parser.js.map +1 -1
- package/dist/number_serializer.js +10 -4
- package/dist/number_serializer.js.map +1 -1
- package/dist/string_parser.d.ts +0 -1
- package/dist/string_parser.js +47 -79
- package/dist/string_parser.js.map +1 -1
- package/dist/string_serializer.d.ts +1 -0
- package/dist/string_serializer.js +49 -33
- package/dist/string_serializer.js.map +1 -1
- package/dist/token_types.js +6 -0
- package/dist/token_types.js.map +1 -1
- package/dist/tokenizer.js +9 -3
- package/dist/tokenizer.js.map +1 -1
- package/dist/tokenizer.spec.js +13 -7
- package/dist/tokenizer.spec.js.map +1 -1
- package/package.json +1 -1
- package/src/a_simple_parser.ts +7 -0
- package/src/base_parser.ts +7 -0
- package/src/boolean_parser.ts +30 -18
- package/src/boolean_serializer.ts +13 -6
- package/src/clause_types.ts +36 -31
- package/src/date_parser.ts +136 -118
- package/src/date_serializer.ts +27 -20
- package/src/date_types.ts +42 -34
- package/src/generate_samples.ts +33 -25
- package/src/index.ts +7 -0
- package/src/number_parser.ts +45 -26
- package/src/number_serializer.ts +11 -4
- package/src/string_parser.ts +51 -79
- package/src/string_serializer.ts +65 -39
- package/src/token_types.ts +7 -0
- package/src/tokenizer.spec.ts +14 -7
- package/src/tokenizer.ts +10 -3
package/SERIALIZE_SAMPLES.md
CHANGED
|
@@ -20,7 +20,16 @@ Input: !=5
|
|
|
20
20
|
Output: !=5
|
|
21
21
|
|
|
22
22
|
Input: 1, 3, 5, null
|
|
23
|
-
Output: 1, 3, 5,
|
|
23
|
+
Output: 1, 3, 5, null
|
|
24
|
+
|
|
25
|
+
Input: 1, 3, , 5,
|
|
26
|
+
Output: 1, 3, 5
|
|
27
|
+
Logs: {
|
|
28
|
+
severity: 'warn',
|
|
29
|
+
message: 'Empty clause',
|
|
30
|
+
startIndex: 6,
|
|
31
|
+
endIndex: 7
|
|
32
|
+
}
|
|
24
33
|
|
|
25
34
|
Input: <1, >=100
|
|
26
35
|
Output: <1, >=100
|
|
@@ -32,10 +41,10 @@ Input: <= 10
|
|
|
32
41
|
Output: <=10
|
|
33
42
|
|
|
34
43
|
Input: NULL
|
|
35
|
-
Output:
|
|
44
|
+
Output: null
|
|
36
45
|
|
|
37
46
|
Input: -NULL
|
|
38
|
-
Output: -
|
|
47
|
+
Output: -null
|
|
39
48
|
|
|
40
49
|
Input: (1, 7)
|
|
41
50
|
Output: (1, 7)
|
|
@@ -53,17 +62,82 @@ Input: [0,9],[20,29]
|
|
|
53
62
|
Output: [0, 9], [20, 29]
|
|
54
63
|
|
|
55
64
|
Input: [0,10], 20, NULL, ( 72, 82 ]
|
|
56
|
-
Output: [0, 10], 20,
|
|
65
|
+
Output: [0, 10], 20, null, (72, 82]
|
|
57
66
|
|
|
58
67
|
Input: , notanumber,, "null", apple pear orange, nulle, nnull, >=,
|
|
59
|
-
|
|
68
|
+
Logs: {
|
|
69
|
+
severity: 'error',
|
|
70
|
+
message: 'Invalid expression: notanumber',
|
|
71
|
+
startIndex: 2,
|
|
72
|
+
endIndex: 12
|
|
73
|
+
} {
|
|
74
|
+
severity: 'warn',
|
|
75
|
+
message: 'Empty clause',
|
|
76
|
+
startIndex: 13,
|
|
77
|
+
endIndex: 14
|
|
78
|
+
} {
|
|
79
|
+
severity: 'error',
|
|
80
|
+
message: 'Invalid expression: "null"',
|
|
81
|
+
startIndex: 15,
|
|
82
|
+
endIndex: 21
|
|
83
|
+
} {
|
|
84
|
+
severity: 'error',
|
|
85
|
+
message: 'Invalid expression: apple',
|
|
86
|
+
startIndex: 23,
|
|
87
|
+
endIndex: 28
|
|
88
|
+
} {
|
|
89
|
+
severity: 'error',
|
|
90
|
+
message: 'Invalid expression: pear',
|
|
91
|
+
startIndex: 29,
|
|
92
|
+
endIndex: 33
|
|
93
|
+
} {
|
|
94
|
+
severity: 'error',
|
|
95
|
+
message: 'Invalid expression: orange',
|
|
96
|
+
startIndex: 34,
|
|
97
|
+
endIndex: 40
|
|
98
|
+
} {
|
|
99
|
+
severity: 'error',
|
|
100
|
+
message: 'Invalid expression: nulle',
|
|
101
|
+
startIndex: 42,
|
|
102
|
+
endIndex: 47
|
|
103
|
+
} {
|
|
104
|
+
severity: 'error',
|
|
105
|
+
message: 'Invalid expression: nnull',
|
|
106
|
+
startIndex: 49,
|
|
107
|
+
endIndex: 54
|
|
108
|
+
} {
|
|
109
|
+
severity: 'error',
|
|
110
|
+
message: 'Invalid expression: >=',
|
|
111
|
+
startIndex: 56,
|
|
112
|
+
endIndex: 58
|
|
113
|
+
}
|
|
60
114
|
|
|
61
115
|
Input: [cat, 100], <cat
|
|
62
|
-
|
|
116
|
+
Logs: {
|
|
117
|
+
severity: 'error',
|
|
118
|
+
message: 'Invalid number',
|
|
119
|
+
startIndex: 1,
|
|
120
|
+
endIndex: 4
|
|
121
|
+
} {
|
|
122
|
+
severity: 'error',
|
|
123
|
+
message: 'Invalid expression: <',
|
|
124
|
+
startIndex: 12,
|
|
125
|
+
endIndex: 13
|
|
126
|
+
} {
|
|
127
|
+
severity: 'error',
|
|
128
|
+
message: 'Invalid expression: cat',
|
|
129
|
+
startIndex: 13,
|
|
130
|
+
endIndex: 16
|
|
131
|
+
}
|
|
63
132
|
|
|
64
133
|
Input: -5.5 to 10
|
|
65
134
|
Output: -5.5, 10
|
|
66
|
-
|
|
135
|
+
Logs: {
|
|
136
|
+
severity: 'error',
|
|
137
|
+
message: 'Invalid expression: to',
|
|
138
|
+
startIndex: 5,
|
|
139
|
+
endIndex: 7
|
|
140
|
+
}
|
|
67
141
|
```
|
|
68
142
|
|
|
69
143
|
-------------------------------------------------------------------------
|
|
@@ -83,11 +157,16 @@ Input: -CAT,-DOG,mouse, bird, zebra, -horse, -goat
|
|
|
83
157
|
Output: -CAT, -DOG, mouse, bird, zebra, -horse, -goat
|
|
84
158
|
|
|
85
159
|
Input: Missing ,NULL
|
|
86
|
-
Output: Missing,
|
|
160
|
+
Output: Missing, null
|
|
87
161
|
|
|
88
162
|
Input: CAT%, D%OG, %ous%, %ira_f%, %_oat,
|
|
89
163
|
Output: CAT%, D%OG, %ous%, %ira_f%, %_oat
|
|
90
|
-
|
|
164
|
+
Logs: {
|
|
165
|
+
severity: 'warn',
|
|
166
|
+
message: 'Empty clause',
|
|
167
|
+
startIndex: 34,
|
|
168
|
+
endIndex: 35
|
|
169
|
+
}
|
|
91
170
|
|
|
92
171
|
Input: -CAT%,-D%OG,-%mouse,-%zebra%
|
|
93
172
|
Output: -CAT%, -D%OG, -%mouse, -%zebra%
|
|
@@ -111,22 +190,40 @@ Input: \_CAT,D\%G,\mouse
|
|
|
111
190
|
Output: \_CAT, D\%G, mouse
|
|
112
191
|
|
|
113
192
|
Input: CAT,-NULL
|
|
114
|
-
Output: CAT, -
|
|
193
|
+
Output: CAT, -null
|
|
115
194
|
|
|
116
195
|
Input: CAT,-"NULL"
|
|
117
196
|
Output: CAT, -"NULL"
|
|
118
197
|
|
|
119
198
|
Input: CAT,NULL
|
|
120
|
-
Output: CAT,
|
|
199
|
+
Output: CAT, null
|
|
200
|
+
|
|
201
|
+
Input: CAT,,
|
|
202
|
+
Output: CAT
|
|
203
|
+
Logs: {
|
|
204
|
+
severity: 'warn',
|
|
205
|
+
message: 'Empty clause',
|
|
206
|
+
startIndex: 4,
|
|
207
|
+
endIndex: 5
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
Input: CAT, , DOG
|
|
211
|
+
Output: CAT, DOG
|
|
212
|
+
Logs: {
|
|
213
|
+
severity: 'warn',
|
|
214
|
+
message: 'Empty clause',
|
|
215
|
+
startIndex: 4,
|
|
216
|
+
endIndex: 5
|
|
217
|
+
}
|
|
121
218
|
|
|
122
219
|
Input: EMPTY
|
|
123
|
-
Output:
|
|
220
|
+
Output: empty
|
|
124
221
|
|
|
125
222
|
Input: -EMPTY
|
|
126
|
-
Output: -
|
|
223
|
+
Output: -empty
|
|
127
224
|
|
|
128
225
|
Input: CAT,-EMPTY
|
|
129
|
-
Output: CAT, -
|
|
226
|
+
Output: CAT, -empty
|
|
130
227
|
|
|
131
228
|
Input: "CAT,DOG',mo`use,zeb'''ra,g"""t,g\"ir\`af\'e
|
|
132
229
|
Output: "CAT, DOG', mo`use, zeb'''ra, g"""t, g"ir`af'e
|
|
@@ -139,7 +236,12 @@ Output: CAT, DOG, -, -
|
|
|
139
236
|
|
|
140
237
|
Input: --CAT,DOG,\
|
|
141
238
|
Output: --CAT, DOG
|
|
142
|
-
|
|
239
|
+
Logs: {
|
|
240
|
+
severity: 'warn',
|
|
241
|
+
message: 'Empty clause',
|
|
242
|
+
startIndex: 10,
|
|
243
|
+
endIndex: 11
|
|
244
|
+
}
|
|
143
245
|
|
|
144
246
|
Input: CAT\ DOG
|
|
145
247
|
Output: CAT DOG
|
|
@@ -148,13 +250,13 @@ Input: _\_CAT
|
|
|
148
250
|
Output: _\\_CAT
|
|
149
251
|
|
|
150
252
|
Input: \NULL
|
|
151
|
-
Output:
|
|
253
|
+
Output: NULL
|
|
152
254
|
|
|
153
255
|
Input: \-NULL
|
|
154
|
-
Output:
|
|
256
|
+
Output: -NULL
|
|
155
257
|
|
|
156
258
|
Input: -N\ULL
|
|
157
|
-
Output:
|
|
259
|
+
Output: -NULL
|
|
158
260
|
|
|
159
261
|
Input: CA--,D-G
|
|
160
262
|
Output: CA--, D-G
|
|
@@ -163,7 +265,7 @@ Input: hello world, foo="bar baz" , qux=quux
|
|
|
163
265
|
Output: hello world, foo="bar baz", qux=quux
|
|
164
266
|
|
|
165
267
|
Input: one ,Null , Empty,E M P T Y Y,EEmpty, emptIEs
|
|
166
|
-
Output: one,
|
|
268
|
+
Output: one, null, empty, E M P T Y Y, EEmpty, emptIEs
|
|
167
269
|
|
|
168
270
|
Input:
|
|
169
271
|
|
|
@@ -174,34 +276,63 @@ Input:
|
|
|
174
276
|
|
|
175
277
|
```code
|
|
176
278
|
Input: true
|
|
177
|
-
Output:
|
|
279
|
+
Output: true
|
|
178
280
|
|
|
179
281
|
Input: FALSE
|
|
180
|
-
Output:
|
|
282
|
+
Output: false
|
|
181
283
|
|
|
182
284
|
Input: =false
|
|
183
|
-
Output: =
|
|
285
|
+
Output: =false
|
|
184
286
|
|
|
185
287
|
Input: null
|
|
186
|
-
Output:
|
|
288
|
+
Output: null
|
|
187
289
|
|
|
188
290
|
Input: -NULL
|
|
189
|
-
Output: -
|
|
291
|
+
Output: -null
|
|
190
292
|
|
|
191
|
-
Input:
|
|
192
|
-
Output:
|
|
293
|
+
Input: null,
|
|
294
|
+
Output: null
|
|
295
|
+
|
|
296
|
+
Input: True , , faLSE,=false,NULl,-null
|
|
297
|
+
Output: true, false, =false, null, -null
|
|
298
|
+
Logs: {
|
|
299
|
+
severity: 'warn',
|
|
300
|
+
message: 'Empty clause',
|
|
301
|
+
startIndex: 8,
|
|
302
|
+
endIndex: 9
|
|
303
|
+
}
|
|
193
304
|
|
|
194
305
|
Input: -'null'
|
|
195
|
-
|
|
306
|
+
Logs: {
|
|
307
|
+
severity: 'error',
|
|
308
|
+
message: "Invalid token -'null'",
|
|
309
|
+
startIndex: 0,
|
|
310
|
+
endIndex: 7
|
|
311
|
+
}
|
|
196
312
|
|
|
197
313
|
Input: 10
|
|
198
|
-
|
|
314
|
+
Logs: {
|
|
315
|
+
severity: 'error',
|
|
316
|
+
message: 'Invalid token 10',
|
|
317
|
+
startIndex: 0,
|
|
318
|
+
endIndex: 2
|
|
319
|
+
}
|
|
199
320
|
|
|
200
321
|
Input: nnull
|
|
201
|
-
|
|
322
|
+
Logs: {
|
|
323
|
+
severity: 'error',
|
|
324
|
+
message: 'Invalid token nnull',
|
|
325
|
+
startIndex: 0,
|
|
326
|
+
endIndex: 5
|
|
327
|
+
}
|
|
202
328
|
|
|
203
329
|
Input: truee
|
|
204
|
-
|
|
330
|
+
Logs: {
|
|
331
|
+
severity: 'error',
|
|
332
|
+
message: 'Invalid token truee',
|
|
333
|
+
startIndex: 1,
|
|
334
|
+
endIndex: 6
|
|
335
|
+
}
|
|
205
336
|
|
|
206
337
|
```
|
|
207
338
|
|
|
@@ -210,103 +341,176 @@ Errors: { message: 'Invalid token truee', startIndex: 1, endIndex: 6 }
|
|
|
210
341
|
|
|
211
342
|
```code
|
|
212
343
|
Input: this month
|
|
213
|
-
Output:
|
|
344
|
+
Output: this month
|
|
214
345
|
|
|
215
346
|
Input: 3 days
|
|
216
|
-
Output: 3
|
|
347
|
+
Output: 3 days
|
|
217
348
|
|
|
218
349
|
Input: 3 days ago
|
|
219
|
-
Output: 3
|
|
350
|
+
Output: 3 days ago
|
|
220
351
|
|
|
221
352
|
Input: 3 months ago for 2 days
|
|
222
|
-
Output: 3
|
|
353
|
+
Output: 3 months ago for 2 days
|
|
223
354
|
|
|
224
355
|
Input: 2025 weeks ago
|
|
225
|
-
Output: 2025
|
|
356
|
+
Output: 2025 weeks ago
|
|
226
357
|
|
|
227
358
|
Input: before 3 days ago
|
|
228
|
-
Output:
|
|
359
|
+
Output: before 3 days ago
|
|
229
360
|
|
|
230
361
|
Input: before 2025-08-30 08:30:20
|
|
231
|
-
Output:
|
|
362
|
+
Output: before 2025-08-30 08:30:20
|
|
232
363
|
|
|
233
364
|
Input: after 2025-10-05
|
|
234
|
-
Output:
|
|
365
|
+
Output: after 2025-10-05
|
|
235
366
|
|
|
236
367
|
Input: 2025-08-30 12:00 to 2025-09-18 14:30
|
|
237
|
-
Output: 2025-08-30 12:00
|
|
368
|
+
Output: 2025-08-30 12:00 to 2025-09-18 14:30
|
|
238
369
|
|
|
239
370
|
Input: this year
|
|
240
|
-
Output:
|
|
371
|
+
Output: this year
|
|
241
372
|
|
|
242
373
|
Input: next tuesday
|
|
243
|
-
Output:
|
|
374
|
+
Output: next tuesday
|
|
244
375
|
|
|
245
376
|
Input: 7 years from now
|
|
246
|
-
Output: 7
|
|
377
|
+
Output: 7 years from now
|
|
247
378
|
|
|
248
379
|
Input: 2025-01-01 12:00:00 for 3 days
|
|
249
|
-
Output: 2025-01-01 12:00:00
|
|
380
|
+
Output: 2025-01-01 12:00:00 for 3 days
|
|
381
|
+
|
|
382
|
+
Input: 2020-08-12 03:12:56.57
|
|
383
|
+
Output: 2020-08-12 03:12:56.57
|
|
384
|
+
|
|
385
|
+
Input: 2020-08-12T03:12:56[PST]
|
|
386
|
+
Output: 2020-08-12T03:12:56[PST]
|
|
387
|
+
|
|
388
|
+
Input: 2020-08-12 03:12:56
|
|
389
|
+
Output: 2020-08-12 03:12:56
|
|
390
|
+
|
|
391
|
+
Input: 2020-08-12 03:22
|
|
392
|
+
Output: 2020-08-12 03:22
|
|
393
|
+
|
|
394
|
+
Input: 2020-08-12 03
|
|
395
|
+
Output: 2020-08-12 03
|
|
250
396
|
|
|
251
397
|
Input: 2020-08-12
|
|
252
398
|
Output: 2020-08-12
|
|
253
399
|
|
|
400
|
+
Input: 2020-Q3
|
|
401
|
+
Output: 2020-Q3
|
|
402
|
+
|
|
403
|
+
Input: 2020-08-07-wK
|
|
404
|
+
Logs: {
|
|
405
|
+
severity: 'error',
|
|
406
|
+
message: 'Invalid token 2020-08-07-wk',
|
|
407
|
+
startIndex: 0,
|
|
408
|
+
endIndex: 13
|
|
409
|
+
}
|
|
410
|
+
|
|
254
411
|
Input: 2020-08
|
|
255
412
|
Output: 2020-08
|
|
256
413
|
|
|
257
414
|
Input: today
|
|
258
|
-
Output:
|
|
415
|
+
Output: today
|
|
259
416
|
|
|
260
417
|
Input: yesterday
|
|
261
|
-
Output:
|
|
418
|
+
Output: yesterday
|
|
262
419
|
|
|
263
420
|
Input: tomorrow
|
|
264
|
-
Output:
|
|
421
|
+
Output: tomorrow
|
|
265
422
|
|
|
266
423
|
Input: TODay,Yesterday, TOMORROW , ,TODay ,,
|
|
267
|
-
Output:
|
|
424
|
+
Output: today, yesterday, tomorrow, today
|
|
425
|
+
Logs: {
|
|
426
|
+
severity: 'warn',
|
|
427
|
+
message: 'Empty clause',
|
|
428
|
+
startIndex: 28,
|
|
429
|
+
endIndex: 29
|
|
430
|
+
} {
|
|
431
|
+
severity: 'warn',
|
|
432
|
+
message: 'Empty clause',
|
|
433
|
+
startIndex: 36,
|
|
434
|
+
endIndex: 37
|
|
435
|
+
}
|
|
268
436
|
|
|
269
437
|
Input: 2010 to 2011, 2015 to 2016 , 2018, 2020
|
|
270
|
-
Output: 2010
|
|
438
|
+
Output: 2010 to 2011, 2015 to 2016, 2018, 2020
|
|
271
439
|
|
|
272
440
|
Input: next week
|
|
273
|
-
Output:
|
|
441
|
+
Output: next week
|
|
274
442
|
|
|
275
443
|
Input: now
|
|
276
|
-
Output:
|
|
444
|
+
Output: now
|
|
277
445
|
|
|
278
446
|
Input: now to next month
|
|
279
|
-
Output:
|
|
447
|
+
Output: now to next month
|
|
280
448
|
|
|
281
449
|
Input: null
|
|
282
|
-
Output:
|
|
283
|
-
Errors: { message: 'Invalid token NULL', startIndex: 0, endIndex: 4 }
|
|
450
|
+
Output: null
|
|
284
451
|
|
|
285
452
|
Input: -null,
|
|
286
|
-
Output: -
|
|
287
|
-
Errors: { message: 'Invalid token -NULL', startIndex: 0, endIndex: 5 }
|
|
453
|
+
Output: -null
|
|
288
454
|
|
|
289
455
|
Input: yyesterday
|
|
290
|
-
|
|
456
|
+
Logs: {
|
|
457
|
+
severity: 'error',
|
|
458
|
+
message: 'Invalid token yyesterday',
|
|
459
|
+
startIndex: 1,
|
|
460
|
+
endIndex: 11
|
|
461
|
+
}
|
|
291
462
|
|
|
292
463
|
Input: before
|
|
293
464
|
|
|
294
465
|
Input: for
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
466
|
+
Logs: {
|
|
467
|
+
severity: 'error',
|
|
468
|
+
message: 'Invalid token for',
|
|
469
|
+
startIndex: 0,
|
|
470
|
+
endIndex: 3
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
Input: 12
|
|
474
|
+
Logs: {
|
|
475
|
+
severity: 'error',
|
|
476
|
+
message: 'Invalid token 12',
|
|
477
|
+
startIndex: 0,
|
|
478
|
+
endIndex: 2
|
|
479
|
+
}
|
|
299
480
|
|
|
300
481
|
Input: from now
|
|
301
|
-
Output:
|
|
302
|
-
|
|
482
|
+
Output: now
|
|
483
|
+
Logs: {
|
|
484
|
+
severity: 'error',
|
|
485
|
+
message: 'Invalid token from',
|
|
486
|
+
startIndex: 0,
|
|
487
|
+
endIndex: 4
|
|
488
|
+
}
|
|
303
489
|
|
|
304
490
|
Input: 2025-12-25 12:32:
|
|
305
491
|
Output: 2025-12-25
|
|
306
|
-
|
|
492
|
+
Logs: {
|
|
493
|
+
severity: 'error',
|
|
494
|
+
message: 'Invalid token 12:32:',
|
|
495
|
+
startIndex: 11,
|
|
496
|
+
endIndex: 17
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
Input: 12:22
|
|
500
|
+
Logs: {
|
|
501
|
+
severity: 'error',
|
|
502
|
+
message: 'Invalid token 12:22',
|
|
503
|
+
startIndex: 0,
|
|
504
|
+
endIndex: 5
|
|
505
|
+
}
|
|
307
506
|
|
|
308
507
|
Input: after 2025 seconds
|
|
309
|
-
|
|
508
|
+
Logs: {
|
|
509
|
+
severity: 'error',
|
|
510
|
+
message: 'Invalid token ',
|
|
511
|
+
startIndex: 6,
|
|
512
|
+
endIndex: 18
|
|
513
|
+
}
|
|
310
514
|
|
|
311
515
|
Input:
|
|
312
516
|
|
package/dist/a_simple_parser.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
const boolean_parser_1 = require("./boolean_parser");
|
|
4
10
|
const string_parser_1 = require("./string_parser");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"a_simple_parser.js","sourceRoot":"","sources":["../src/a_simple_parser.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"a_simple_parser.js","sourceRoot":"","sources":["../src/a_simple_parser.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,qDAA+C;AAC/C,mDAA6C;AAC7C,mDAA6C;AAC7C,+CAAyC;AAEzC,+BAA+B;AAC/B,SAAS,aAAa;IACpB,IAAI,GAAG,GAAG,SAAS,CAAC;IACpB,MAAM,cAAc,GAAG,IAAI,4BAAY,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;IACrD,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAExD,GAAG,GAAG,iBAAiB,CAAC;IACxB,MAAM,cAAc,GAAG,IAAI,4BAAY,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;IACrD,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAExD,GAAG,GAAG,aAAa,CAAC;IACpB,MAAM,eAAe,GAAG,IAAI,8BAAa,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;IACvD,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAEzD,GAAG,GAAG,kBAAkB,CAAC;IACzB,MAAM,YAAY,GAAG,IAAI,wBAAU,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;IACjD,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACxD,CAAC;AAED,aAAa,EAAE,CAAC"}
|
package/dist/base_parser.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.BaseParser = void 0;
|
|
4
10
|
class BaseParser {
|
package/dist/base_parser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base_parser.js","sourceRoot":"","sources":["../src/base_parser.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"base_parser.js","sourceRoot":"","sources":["../src/base_parser.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAIH,MAAsB,UAAU;IAK9B,YAAY,WAAmB;QAC7B,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAEM,SAAS;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAES,KAAK,CAAC,KAAa;QAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAES,OAAO;QACf,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IAES,MAAM,CAAC,eAAe,CAC9B,UAAoB,EACpB,KAAa,EACb,MAAe;QAEf,MAAM,QAAQ,GAAG,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC;QAC3C,IAAI,KAAK,GAAG,CAAC,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE;YACzC,OAAO,KAAK,CAAC;SACd;QACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC1C,IAAI,UAAU,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,EAAE;gBAC5C,OAAO,KAAK,CAAC;aACd;SACF;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAvCD,gCAuCC"}
|
package/dist/boolean_parser.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.BooleanParser = void 0;
|
|
4
10
|
const tokenizer_1 = require("./tokenizer");
|
|
@@ -10,11 +16,11 @@ class BooleanParser extends base_parser_1.BaseParser {
|
|
|
10
16
|
tokenize() {
|
|
11
17
|
const specialSubstrings = [{ type: ',', value: ',' }];
|
|
12
18
|
const specialWords = [
|
|
13
|
-
{ type: '
|
|
14
|
-
{ type: '
|
|
15
|
-
{ type: '
|
|
16
|
-
{ type: '
|
|
17
|
-
{ type: '
|
|
19
|
+
{ type: 'null', value: 'null', ignoreCase: true },
|
|
20
|
+
{ type: 'not_null', value: '-null', ignoreCase: true },
|
|
21
|
+
{ type: 'true', value: 'true', ignoreCase: true },
|
|
22
|
+
{ type: 'false', value: '=false', ignoreCase: true },
|
|
23
|
+
{ type: 'false_or_null', value: 'false', ignoreCase: true },
|
|
18
24
|
];
|
|
19
25
|
const params = {
|
|
20
26
|
trimWordWhitespace: true,
|
|
@@ -30,23 +36,32 @@ class BooleanParser extends base_parser_1.BaseParser {
|
|
|
30
36
|
this.index = 0;
|
|
31
37
|
this.tokenize();
|
|
32
38
|
const clauses = [];
|
|
33
|
-
const
|
|
39
|
+
const logs = [];
|
|
34
40
|
while (this.index < this.tokens.length) {
|
|
35
41
|
const token = this.getNext();
|
|
36
42
|
if (token.type === ',') {
|
|
43
|
+
if (this.index > 0 && this.tokens[this.index - 1].type === ',') {
|
|
44
|
+
logs.push({
|
|
45
|
+
severity: 'warn',
|
|
46
|
+
message: 'Empty clause',
|
|
47
|
+
startIndex: token.startIndex,
|
|
48
|
+
endIndex: token.endIndex,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
37
51
|
this.index++;
|
|
38
52
|
}
|
|
39
|
-
else if (token.type === '
|
|
40
|
-
token.type === '
|
|
41
|
-
token.type === '
|
|
42
|
-
token.type === '
|
|
43
|
-
token.type === '
|
|
53
|
+
else if (token.type === 'null' ||
|
|
54
|
+
token.type === 'true' ||
|
|
55
|
+
token.type === 'false' ||
|
|
56
|
+
token.type === 'false_or_null' ||
|
|
57
|
+
token.type === 'not_null') {
|
|
44
58
|
const clause = { operator: token.type };
|
|
45
59
|
clauses.push(clause);
|
|
46
60
|
this.index++;
|
|
47
61
|
}
|
|
48
62
|
else {
|
|
49
|
-
|
|
63
|
+
logs.push({
|
|
64
|
+
severity: 'error',
|
|
50
65
|
message: 'Invalid token ' + token.value,
|
|
51
66
|
startIndex: token.startIndex,
|
|
52
67
|
endIndex: token.endIndex,
|
|
@@ -54,7 +69,7 @@ class BooleanParser extends base_parser_1.BaseParser {
|
|
|
54
69
|
this.index++;
|
|
55
70
|
}
|
|
56
71
|
}
|
|
57
|
-
return { clauses,
|
|
72
|
+
return { clauses, logs };
|
|
58
73
|
}
|
|
59
74
|
}
|
|
60
75
|
exports.BooleanParser = BooleanParser;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boolean_parser.js","sourceRoot":"","sources":["../src/boolean_parser.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"boolean_parser.js","sourceRoot":"","sources":["../src/boolean_parser.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.BooleanSerializer = void 0;
|
|
4
10
|
class BooleanSerializer {
|
|
@@ -12,12 +18,12 @@ class BooleanSerializer {
|
|
|
12
18
|
}
|
|
13
19
|
static booleanClauseToString(clause) {
|
|
14
20
|
switch (clause.operator) {
|
|
15
|
-
case '
|
|
16
|
-
return '-
|
|
17
|
-
case '
|
|
18
|
-
return '
|
|
19
|
-
case '
|
|
20
|
-
return '=
|
|
21
|
+
case 'not_null':
|
|
22
|
+
return '-null';
|
|
23
|
+
case 'false_or_null':
|
|
24
|
+
return 'false';
|
|
25
|
+
case 'false':
|
|
26
|
+
return '=false';
|
|
21
27
|
}
|
|
22
28
|
return clause.operator;
|
|
23
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boolean_serializer.js","sourceRoot":"","sources":["../src/boolean_serializer.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"boolean_serializer.js","sourceRoot":"","sources":["../src/boolean_serializer.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAIH,MAAa,iBAAiB;IAC5B,YAAoB,OAAwB;QAAxB,YAAO,GAAP,OAAO,CAAiB;QAC1C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEM,SAAS;QACd,MAAM,MAAM,GAAG,iBAAiB,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9D,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACzC,CAAC;IAEO,MAAM,CAAC,qBAAqB,CAAC,MAAqB;QACxD,QAAQ,MAAM,CAAC,QAAQ,EAAE;YACvB,KAAK,UAAU;gBACb,OAAO,OAAO,CAAC;YACjB,KAAK,eAAe;gBAClB,OAAO,OAAO,CAAC;YACjB,KAAK,OAAO;gBACV,OAAO,QAAQ,CAAC;SACnB;QACD,OAAO,MAAM,CAAC,QAAQ,CAAC;IACzB,CAAC;IAEO,MAAM,CAAC,cAAc,CAAC,OAAwB;QACpD,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;YAC5B,IAAI,UAAU,IAAI,MAAM,EAAE;gBACxB,MAAM,IAAI,iBAAiB,CAAC,qBAAqB,CAC/C,MAAuB,CACxB,CAAC;aACH;iBAAM;gBACL,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;aACrE;YACD,MAAM,IAAI,IAAI,CAAC;SAChB;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AApCD,8CAoCC"}
|