@swaggerexpert/arazzo-criterion 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +20 -0
  3. package/README.md +406 -0
  4. package/SECURITY.md +15 -0
  5. package/cjs/apg-lite.cjs +1223 -0
  6. package/cjs/errors/ArazzoCriterionError.cjs +46 -0
  7. package/cjs/errors/ArazzoCriterionEvaluateError.cjs +10 -0
  8. package/cjs/errors/ArazzoCriterionParseError.cjs +10 -0
  9. package/cjs/evaluate/index.cjs +139 -0
  10. package/cjs/grammar.cjs +1111 -0
  11. package/cjs/index.cjs +83 -0
  12. package/cjs/parse/callbacks/cst.cjs +30 -0
  13. package/cjs/parse/index.cjs +42 -0
  14. package/cjs/parse/trace/Expectations.cjs +12 -0
  15. package/cjs/parse/trace/Trace.cjs +37 -0
  16. package/cjs/parse/translators/ASTTranslator/index.cjs +17 -0
  17. package/cjs/parse/translators/ASTTranslator/transformers.cjs +203 -0
  18. package/cjs/parse/translators/CSTTranslator.cjs +49 -0
  19. package/cjs/parse/translators/XMLTranslator.cjs +14 -0
  20. package/cjs/test/index.cjs +20 -0
  21. package/es/errors/ArazzoCriterionError.mjs +40 -0
  22. package/es/errors/ArazzoCriterionEvaluateError.mjs +3 -0
  23. package/es/errors/ArazzoCriterionParseError.mjs +3 -0
  24. package/es/evaluate/index.mjs +132 -0
  25. package/es/grammar.mjs +1105 -0
  26. package/es/index.mjs +11 -0
  27. package/es/parse/callbacks/cst.mjs +24 -0
  28. package/es/parse/index.mjs +35 -0
  29. package/es/parse/trace/Expectations.mjs +6 -0
  30. package/es/parse/trace/Trace.mjs +30 -0
  31. package/es/parse/translators/ASTTranslator/index.mjs +9 -0
  32. package/es/parse/translators/ASTTranslator/transformers.mjs +195 -0
  33. package/es/parse/translators/CSTTranslator.mjs +42 -0
  34. package/es/parse/translators/XMLTranslator.mjs +7 -0
  35. package/es/test/index.mjs +13 -0
  36. package/package.json +95 -0
  37. package/types/index.d.ts +283 -0
package/es/grammar.mjs ADDED
@@ -0,0 +1,1105 @@
1
+ // copyright: Copyright (c) 2024 Lowell D. Thomas, all rights reserved<br>
2
+ // license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)<br>
3
+ //
4
+ // Generated by apg-js, Version 4.4.0 [apg-js](https://github.com/ldthomas/apg-js)
5
+ export default function grammar() {
6
+ // ```
7
+ // SUMMARY
8
+ // rules = 34
9
+ // udts = 0
10
+ // opcodes = 155
11
+ // --- ABNF original opcodes
12
+ // ALT = 16
13
+ // CAT = 19
14
+ // REP = 17
15
+ // RNM = 56
16
+ // TLS = 28
17
+ // TBS = 7
18
+ // TRG = 12
19
+ // --- SABNF superset opcodes
20
+ // UDT = 0
21
+ // AND = 0
22
+ // NOT = 0
23
+ // characters = [9 - 1114111]
24
+ // ```
25
+ /* OBJECT IDENTIFIER (for internal parser use) */
26
+ this.grammarObject = 'grammarObject';
27
+
28
+ /* RULES */
29
+ this.rules = [];
30
+ this.rules[0] = {
31
+ name: 'condition',
32
+ lower: 'condition',
33
+ index: 0,
34
+ isBkr: false
35
+ };
36
+ this.rules[1] = {
37
+ name: 'logical-expr',
38
+ lower: 'logical-expr',
39
+ index: 1,
40
+ isBkr: false
41
+ };
42
+ this.rules[2] = {
43
+ name: 'logical-or-expr',
44
+ lower: 'logical-or-expr',
45
+ index: 2,
46
+ isBkr: false
47
+ };
48
+ this.rules[3] = {
49
+ name: 'logical-and-expr',
50
+ lower: 'logical-and-expr',
51
+ index: 3,
52
+ isBkr: false
53
+ };
54
+ this.rules[4] = {
55
+ name: 'basic-expr',
56
+ lower: 'basic-expr',
57
+ index: 4,
58
+ isBkr: false
59
+ };
60
+ this.rules[5] = {
61
+ name: 'paren-expr',
62
+ lower: 'paren-expr',
63
+ index: 5,
64
+ isBkr: false
65
+ };
66
+ this.rules[6] = {
67
+ name: 'test-expr',
68
+ lower: 'test-expr',
69
+ index: 6,
70
+ isBkr: false
71
+ };
72
+ this.rules[7] = {
73
+ name: 'comparison-expr',
74
+ lower: 'comparison-expr',
75
+ index: 7,
76
+ isBkr: false
77
+ };
78
+ this.rules[8] = {
79
+ name: 'logical-not-op',
80
+ lower: 'logical-not-op',
81
+ index: 8,
82
+ isBkr: false
83
+ };
84
+ this.rules[9] = {
85
+ name: 'comparison-op',
86
+ lower: 'comparison-op',
87
+ index: 9,
88
+ isBkr: false
89
+ };
90
+ this.rules[10] = {
91
+ name: 'comparable',
92
+ lower: 'comparable',
93
+ index: 10,
94
+ isBkr: false
95
+ };
96
+ this.rules[11] = {
97
+ name: 'runtime-expression-operand',
98
+ lower: 'runtime-expression-operand',
99
+ index: 11,
100
+ isBkr: false
101
+ };
102
+ this.rules[12] = {
103
+ name: 'operand-char',
104
+ lower: 'operand-char',
105
+ index: 12,
106
+ isBkr: false
107
+ };
108
+ this.rules[13] = {
109
+ name: 'runtime-expression-navigation',
110
+ lower: 'runtime-expression-navigation',
111
+ index: 13,
112
+ isBkr: false
113
+ };
114
+ this.rules[14] = {
115
+ name: 'member-access',
116
+ lower: 'member-access',
117
+ index: 14,
118
+ isBkr: false
119
+ };
120
+ this.rules[15] = {
121
+ name: 'index-access',
122
+ lower: 'index-access',
123
+ index: 15,
124
+ isBkr: false
125
+ };
126
+ this.rules[16] = {
127
+ name: 'member-name',
128
+ lower: 'member-name',
129
+ index: 16,
130
+ isBkr: false
131
+ };
132
+ this.rules[17] = {
133
+ name: 'index',
134
+ lower: 'index',
135
+ index: 17,
136
+ isBkr: false
137
+ };
138
+ this.rules[18] = {
139
+ name: 'literal',
140
+ lower: 'literal',
141
+ index: 18,
142
+ isBkr: false
143
+ };
144
+ this.rules[19] = {
145
+ name: 'boolean',
146
+ lower: 'boolean',
147
+ index: 19,
148
+ isBkr: false
149
+ };
150
+ this.rules[20] = {
151
+ name: 'null',
152
+ lower: 'null',
153
+ index: 20,
154
+ isBkr: false
155
+ };
156
+ this.rules[21] = {
157
+ name: 'number',
158
+ lower: 'number',
159
+ index: 21,
160
+ isBkr: false
161
+ };
162
+ this.rules[22] = {
163
+ name: 'int',
164
+ lower: 'int',
165
+ index: 22,
166
+ isBkr: false
167
+ };
168
+ this.rules[23] = {
169
+ name: 'frac',
170
+ lower: 'frac',
171
+ index: 23,
172
+ isBkr: false
173
+ };
174
+ this.rules[24] = {
175
+ name: 'exp',
176
+ lower: 'exp',
177
+ index: 24,
178
+ isBkr: false
179
+ };
180
+ this.rules[25] = {
181
+ name: 'DIGIT1',
182
+ lower: 'digit1',
183
+ index: 25,
184
+ isBkr: false
185
+ };
186
+ this.rules[26] = {
187
+ name: 'string',
188
+ lower: 'string',
189
+ index: 26,
190
+ isBkr: false
191
+ };
192
+ this.rules[27] = {
193
+ name: 'escaped-quote',
194
+ lower: 'escaped-quote',
195
+ index: 27,
196
+ isBkr: false
197
+ };
198
+ this.rules[28] = {
199
+ name: 'string-char',
200
+ lower: 'string-char',
201
+ index: 28,
202
+ isBkr: false
203
+ };
204
+ this.rules[29] = {
205
+ name: 'squote',
206
+ lower: 'squote',
207
+ index: 29,
208
+ isBkr: false
209
+ };
210
+ this.rules[30] = {
211
+ name: 'S',
212
+ lower: 's',
213
+ index: 30,
214
+ isBkr: false
215
+ };
216
+ this.rules[31] = {
217
+ name: 'B',
218
+ lower: 'b',
219
+ index: 31,
220
+ isBkr: false
221
+ };
222
+ this.rules[32] = {
223
+ name: 'ALPHA',
224
+ lower: 'alpha',
225
+ index: 32,
226
+ isBkr: false
227
+ };
228
+ this.rules[33] = {
229
+ name: 'DIGIT',
230
+ lower: 'digit',
231
+ index: 33,
232
+ isBkr: false
233
+ };
234
+
235
+ /* UDTS */
236
+ this.udts = [];
237
+
238
+ /* OPCODES */
239
+ /* condition */
240
+ this.rules[0].opcodes = [];
241
+ this.rules[0].opcodes[0] = {
242
+ type: 2,
243
+ children: [1, 2, 3]
244
+ }; // CAT
245
+ this.rules[0].opcodes[1] = {
246
+ type: 4,
247
+ index: 30
248
+ }; // RNM(S)
249
+ this.rules[0].opcodes[2] = {
250
+ type: 4,
251
+ index: 1
252
+ }; // RNM(logical-expr)
253
+ this.rules[0].opcodes[3] = {
254
+ type: 4,
255
+ index: 30
256
+ }; // RNM(S)
257
+
258
+ /* logical-expr */
259
+ this.rules[1].opcodes = [];
260
+ this.rules[1].opcodes[0] = {
261
+ type: 4,
262
+ index: 2
263
+ }; // RNM(logical-or-expr)
264
+
265
+ /* logical-or-expr */
266
+ this.rules[2].opcodes = [];
267
+ this.rules[2].opcodes[0] = {
268
+ type: 2,
269
+ children: [1, 2]
270
+ }; // CAT
271
+ this.rules[2].opcodes[1] = {
272
+ type: 4,
273
+ index: 3
274
+ }; // RNM(logical-and-expr)
275
+ this.rules[2].opcodes[2] = {
276
+ type: 3,
277
+ min: 0,
278
+ max: Infinity
279
+ }; // REP
280
+ this.rules[2].opcodes[3] = {
281
+ type: 2,
282
+ children: [4, 5, 6, 7]
283
+ }; // CAT
284
+ this.rules[2].opcodes[4] = {
285
+ type: 4,
286
+ index: 30
287
+ }; // RNM(S)
288
+ this.rules[2].opcodes[5] = {
289
+ type: 7,
290
+ string: [124, 124]
291
+ }; // TLS
292
+ this.rules[2].opcodes[6] = {
293
+ type: 4,
294
+ index: 30
295
+ }; // RNM(S)
296
+ this.rules[2].opcodes[7] = {
297
+ type: 4,
298
+ index: 3
299
+ }; // RNM(logical-and-expr)
300
+
301
+ /* logical-and-expr */
302
+ this.rules[3].opcodes = [];
303
+ this.rules[3].opcodes[0] = {
304
+ type: 2,
305
+ children: [1, 2]
306
+ }; // CAT
307
+ this.rules[3].opcodes[1] = {
308
+ type: 4,
309
+ index: 4
310
+ }; // RNM(basic-expr)
311
+ this.rules[3].opcodes[2] = {
312
+ type: 3,
313
+ min: 0,
314
+ max: Infinity
315
+ }; // REP
316
+ this.rules[3].opcodes[3] = {
317
+ type: 2,
318
+ children: [4, 5, 6, 7]
319
+ }; // CAT
320
+ this.rules[3].opcodes[4] = {
321
+ type: 4,
322
+ index: 30
323
+ }; // RNM(S)
324
+ this.rules[3].opcodes[5] = {
325
+ type: 7,
326
+ string: [38, 38]
327
+ }; // TLS
328
+ this.rules[3].opcodes[6] = {
329
+ type: 4,
330
+ index: 30
331
+ }; // RNM(S)
332
+ this.rules[3].opcodes[7] = {
333
+ type: 4,
334
+ index: 4
335
+ }; // RNM(basic-expr)
336
+
337
+ /* basic-expr */
338
+ this.rules[4].opcodes = [];
339
+ this.rules[4].opcodes[0] = {
340
+ type: 1,
341
+ children: [1, 2, 3]
342
+ }; // ALT
343
+ this.rules[4].opcodes[1] = {
344
+ type: 4,
345
+ index: 5
346
+ }; // RNM(paren-expr)
347
+ this.rules[4].opcodes[2] = {
348
+ type: 4,
349
+ index: 7
350
+ }; // RNM(comparison-expr)
351
+ this.rules[4].opcodes[3] = {
352
+ type: 4,
353
+ index: 6
354
+ }; // RNM(test-expr)
355
+
356
+ /* paren-expr */
357
+ this.rules[5].opcodes = [];
358
+ this.rules[5].opcodes[0] = {
359
+ type: 2,
360
+ children: [1, 5, 6, 7, 8, 9]
361
+ }; // CAT
362
+ this.rules[5].opcodes[1] = {
363
+ type: 3,
364
+ min: 0,
365
+ max: 1
366
+ }; // REP
367
+ this.rules[5].opcodes[2] = {
368
+ type: 2,
369
+ children: [3, 4]
370
+ }; // CAT
371
+ this.rules[5].opcodes[3] = {
372
+ type: 4,
373
+ index: 8
374
+ }; // RNM(logical-not-op)
375
+ this.rules[5].opcodes[4] = {
376
+ type: 4,
377
+ index: 30
378
+ }; // RNM(S)
379
+ this.rules[5].opcodes[5] = {
380
+ type: 7,
381
+ string: [40]
382
+ }; // TLS
383
+ this.rules[5].opcodes[6] = {
384
+ type: 4,
385
+ index: 30
386
+ }; // RNM(S)
387
+ this.rules[5].opcodes[7] = {
388
+ type: 4,
389
+ index: 1
390
+ }; // RNM(logical-expr)
391
+ this.rules[5].opcodes[8] = {
392
+ type: 4,
393
+ index: 30
394
+ }; // RNM(S)
395
+ this.rules[5].opcodes[9] = {
396
+ type: 7,
397
+ string: [41]
398
+ }; // TLS
399
+
400
+ /* test-expr */
401
+ this.rules[6].opcodes = [];
402
+ this.rules[6].opcodes[0] = {
403
+ type: 2,
404
+ children: [1, 5]
405
+ }; // CAT
406
+ this.rules[6].opcodes[1] = {
407
+ type: 3,
408
+ min: 0,
409
+ max: 1
410
+ }; // REP
411
+ this.rules[6].opcodes[2] = {
412
+ type: 2,
413
+ children: [3, 4]
414
+ }; // CAT
415
+ this.rules[6].opcodes[3] = {
416
+ type: 4,
417
+ index: 8
418
+ }; // RNM(logical-not-op)
419
+ this.rules[6].opcodes[4] = {
420
+ type: 4,
421
+ index: 30
422
+ }; // RNM(S)
423
+ this.rules[6].opcodes[5] = {
424
+ type: 4,
425
+ index: 10
426
+ }; // RNM(comparable)
427
+
428
+ /* comparison-expr */
429
+ this.rules[7].opcodes = [];
430
+ this.rules[7].opcodes[0] = {
431
+ type: 2,
432
+ children: [1, 2, 3, 4, 5]
433
+ }; // CAT
434
+ this.rules[7].opcodes[1] = {
435
+ type: 4,
436
+ index: 10
437
+ }; // RNM(comparable)
438
+ this.rules[7].opcodes[2] = {
439
+ type: 4,
440
+ index: 30
441
+ }; // RNM(S)
442
+ this.rules[7].opcodes[3] = {
443
+ type: 4,
444
+ index: 9
445
+ }; // RNM(comparison-op)
446
+ this.rules[7].opcodes[4] = {
447
+ type: 4,
448
+ index: 30
449
+ }; // RNM(S)
450
+ this.rules[7].opcodes[5] = {
451
+ type: 4,
452
+ index: 10
453
+ }; // RNM(comparable)
454
+
455
+ /* logical-not-op */
456
+ this.rules[8].opcodes = [];
457
+ this.rules[8].opcodes[0] = {
458
+ type: 7,
459
+ string: [33]
460
+ }; // TLS
461
+
462
+ /* comparison-op */
463
+ this.rules[9].opcodes = [];
464
+ this.rules[9].opcodes[0] = {
465
+ type: 1,
466
+ children: [1, 2, 3, 4, 5, 6]
467
+ }; // ALT
468
+ this.rules[9].opcodes[1] = {
469
+ type: 7,
470
+ string: [61, 61]
471
+ }; // TLS
472
+ this.rules[9].opcodes[2] = {
473
+ type: 7,
474
+ string: [33, 61]
475
+ }; // TLS
476
+ this.rules[9].opcodes[3] = {
477
+ type: 7,
478
+ string: [60, 61]
479
+ }; // TLS
480
+ this.rules[9].opcodes[4] = {
481
+ type: 7,
482
+ string: [62, 61]
483
+ }; // TLS
484
+ this.rules[9].opcodes[5] = {
485
+ type: 7,
486
+ string: [60]
487
+ }; // TLS
488
+ this.rules[9].opcodes[6] = {
489
+ type: 7,
490
+ string: [62]
491
+ }; // TLS
492
+
493
+ /* comparable */
494
+ this.rules[10].opcodes = [];
495
+ this.rules[10].opcodes[0] = {
496
+ type: 1,
497
+ children: [1, 2]
498
+ }; // ALT
499
+ this.rules[10].opcodes[1] = {
500
+ type: 4,
501
+ index: 18
502
+ }; // RNM(literal)
503
+ this.rules[10].opcodes[2] = {
504
+ type: 4,
505
+ index: 11
506
+ }; // RNM(runtime-expression-operand)
507
+
508
+ /* runtime-expression-operand */
509
+ this.rules[11].opcodes = [];
510
+ this.rules[11].opcodes[0] = {
511
+ type: 2,
512
+ children: [1, 2]
513
+ }; // CAT
514
+ this.rules[11].opcodes[1] = {
515
+ type: 7,
516
+ string: [36]
517
+ }; // TLS
518
+ this.rules[11].opcodes[2] = {
519
+ type: 3,
520
+ min: 1,
521
+ max: Infinity
522
+ }; // REP
523
+ this.rules[11].opcodes[3] = {
524
+ type: 4,
525
+ index: 12
526
+ }; // RNM(operand-char)
527
+
528
+ /* operand-char */
529
+ this.rules[12].opcodes = [];
530
+ this.rules[12].opcodes[0] = {
531
+ type: 1,
532
+ children: [1, 2, 3, 4, 5, 6, 7, 8]
533
+ }; // ALT
534
+ this.rules[12].opcodes[1] = {
535
+ type: 5,
536
+ min: 34,
537
+ max: 37
538
+ }; // TRG
539
+ this.rules[12].opcodes[2] = {
540
+ type: 6,
541
+ string: [39]
542
+ }; // TBS
543
+ this.rules[12].opcodes[3] = {
544
+ type: 5,
545
+ min: 42,
546
+ max: 59
547
+ }; // TRG
548
+ this.rules[12].opcodes[4] = {
549
+ type: 5,
550
+ min: 63,
551
+ max: 90
552
+ }; // TRG
553
+ this.rules[12].opcodes[5] = {
554
+ type: 5,
555
+ min: 91,
556
+ max: 93
557
+ }; // TRG
558
+ this.rules[12].opcodes[6] = {
559
+ type: 5,
560
+ min: 94,
561
+ max: 122
562
+ }; // TRG
563
+ this.rules[12].opcodes[7] = {
564
+ type: 6,
565
+ string: [126]
566
+ }; // TBS
567
+ this.rules[12].opcodes[8] = {
568
+ type: 5,
569
+ min: 128,
570
+ max: 1114111
571
+ }; // TRG
572
+
573
+ /* runtime-expression-navigation */
574
+ this.rules[13].opcodes = [];
575
+ this.rules[13].opcodes[0] = {
576
+ type: 3,
577
+ min: 1,
578
+ max: Infinity
579
+ }; // REP
580
+ this.rules[13].opcodes[1] = {
581
+ type: 1,
582
+ children: [2, 3]
583
+ }; // ALT
584
+ this.rules[13].opcodes[2] = {
585
+ type: 4,
586
+ index: 14
587
+ }; // RNM(member-access)
588
+ this.rules[13].opcodes[3] = {
589
+ type: 4,
590
+ index: 15
591
+ }; // RNM(index-access)
592
+
593
+ /* member-access */
594
+ this.rules[14].opcodes = [];
595
+ this.rules[14].opcodes[0] = {
596
+ type: 2,
597
+ children: [1, 2]
598
+ }; // CAT
599
+ this.rules[14].opcodes[1] = {
600
+ type: 7,
601
+ string: [46]
602
+ }; // TLS
603
+ this.rules[14].opcodes[2] = {
604
+ type: 4,
605
+ index: 16
606
+ }; // RNM(member-name)
607
+
608
+ /* index-access */
609
+ this.rules[15].opcodes = [];
610
+ this.rules[15].opcodes[0] = {
611
+ type: 2,
612
+ children: [1, 2, 3]
613
+ }; // CAT
614
+ this.rules[15].opcodes[1] = {
615
+ type: 7,
616
+ string: [91]
617
+ }; // TLS
618
+ this.rules[15].opcodes[2] = {
619
+ type: 4,
620
+ index: 17
621
+ }; // RNM(index)
622
+ this.rules[15].opcodes[3] = {
623
+ type: 7,
624
+ string: [93]
625
+ }; // TLS
626
+
627
+ /* member-name */
628
+ this.rules[16].opcodes = [];
629
+ this.rules[16].opcodes[0] = {
630
+ type: 3,
631
+ min: 1,
632
+ max: Infinity
633
+ }; // REP
634
+ this.rules[16].opcodes[1] = {
635
+ type: 1,
636
+ children: [2, 3, 4, 5]
637
+ }; // ALT
638
+ this.rules[16].opcodes[2] = {
639
+ type: 4,
640
+ index: 32
641
+ }; // RNM(ALPHA)
642
+ this.rules[16].opcodes[3] = {
643
+ type: 4,
644
+ index: 33
645
+ }; // RNM(DIGIT)
646
+ this.rules[16].opcodes[4] = {
647
+ type: 7,
648
+ string: [95]
649
+ }; // TLS
650
+ this.rules[16].opcodes[5] = {
651
+ type: 7,
652
+ string: [45]
653
+ }; // TLS
654
+
655
+ /* index */
656
+ this.rules[17].opcodes = [];
657
+ this.rules[17].opcodes[0] = {
658
+ type: 3,
659
+ min: 1,
660
+ max: Infinity
661
+ }; // REP
662
+ this.rules[17].opcodes[1] = {
663
+ type: 4,
664
+ index: 33
665
+ }; // RNM(DIGIT)
666
+
667
+ /* literal */
668
+ this.rules[18].opcodes = [];
669
+ this.rules[18].opcodes[0] = {
670
+ type: 1,
671
+ children: [1, 2, 3, 4]
672
+ }; // ALT
673
+ this.rules[18].opcodes[1] = {
674
+ type: 4,
675
+ index: 21
676
+ }; // RNM(number)
677
+ this.rules[18].opcodes[2] = {
678
+ type: 4,
679
+ index: 26
680
+ }; // RNM(string)
681
+ this.rules[18].opcodes[3] = {
682
+ type: 4,
683
+ index: 19
684
+ }; // RNM(boolean)
685
+ this.rules[18].opcodes[4] = {
686
+ type: 4,
687
+ index: 20
688
+ }; // RNM(null)
689
+
690
+ /* boolean */
691
+ this.rules[19].opcodes = [];
692
+ this.rules[19].opcodes[0] = {
693
+ type: 1,
694
+ children: [1, 2]
695
+ }; // ALT
696
+ this.rules[19].opcodes[1] = {
697
+ type: 7,
698
+ string: [116, 114, 117, 101]
699
+ }; // TLS
700
+ this.rules[19].opcodes[2] = {
701
+ type: 7,
702
+ string: [102, 97, 108, 115, 101]
703
+ }; // TLS
704
+
705
+ /* null */
706
+ this.rules[20].opcodes = [];
707
+ this.rules[20].opcodes[0] = {
708
+ type: 7,
709
+ string: [110, 117, 108, 108]
710
+ }; // TLS
711
+
712
+ /* number */
713
+ this.rules[21].opcodes = [];
714
+ this.rules[21].opcodes[0] = {
715
+ type: 2,
716
+ children: [1, 4, 6]
717
+ }; // CAT
718
+ this.rules[21].opcodes[1] = {
719
+ type: 1,
720
+ children: [2, 3]
721
+ }; // ALT
722
+ this.rules[21].opcodes[2] = {
723
+ type: 4,
724
+ index: 22
725
+ }; // RNM(int)
726
+ this.rules[21].opcodes[3] = {
727
+ type: 7,
728
+ string: [45, 48]
729
+ }; // TLS
730
+ this.rules[21].opcodes[4] = {
731
+ type: 3,
732
+ min: 0,
733
+ max: 1
734
+ }; // REP
735
+ this.rules[21].opcodes[5] = {
736
+ type: 4,
737
+ index: 23
738
+ }; // RNM(frac)
739
+ this.rules[21].opcodes[6] = {
740
+ type: 3,
741
+ min: 0,
742
+ max: 1
743
+ }; // REP
744
+ this.rules[21].opcodes[7] = {
745
+ type: 4,
746
+ index: 24
747
+ }; // RNM(exp)
748
+
749
+ /* int */
750
+ this.rules[22].opcodes = [];
751
+ this.rules[22].opcodes[0] = {
752
+ type: 1,
753
+ children: [1, 2]
754
+ }; // ALT
755
+ this.rules[22].opcodes[1] = {
756
+ type: 7,
757
+ string: [48]
758
+ }; // TLS
759
+ this.rules[22].opcodes[2] = {
760
+ type: 2,
761
+ children: [3, 5, 6]
762
+ }; // CAT
763
+ this.rules[22].opcodes[3] = {
764
+ type: 3,
765
+ min: 0,
766
+ max: 1
767
+ }; // REP
768
+ this.rules[22].opcodes[4] = {
769
+ type: 7,
770
+ string: [45]
771
+ }; // TLS
772
+ this.rules[22].opcodes[5] = {
773
+ type: 4,
774
+ index: 25
775
+ }; // RNM(DIGIT1)
776
+ this.rules[22].opcodes[6] = {
777
+ type: 3,
778
+ min: 0,
779
+ max: Infinity
780
+ }; // REP
781
+ this.rules[22].opcodes[7] = {
782
+ type: 4,
783
+ index: 33
784
+ }; // RNM(DIGIT)
785
+
786
+ /* frac */
787
+ this.rules[23].opcodes = [];
788
+ this.rules[23].opcodes[0] = {
789
+ type: 2,
790
+ children: [1, 2]
791
+ }; // CAT
792
+ this.rules[23].opcodes[1] = {
793
+ type: 7,
794
+ string: [46]
795
+ }; // TLS
796
+ this.rules[23].opcodes[2] = {
797
+ type: 3,
798
+ min: 1,
799
+ max: Infinity
800
+ }; // REP
801
+ this.rules[23].opcodes[3] = {
802
+ type: 4,
803
+ index: 33
804
+ }; // RNM(DIGIT)
805
+
806
+ /* exp */
807
+ this.rules[24].opcodes = [];
808
+ this.rules[24].opcodes[0] = {
809
+ type: 2,
810
+ children: [1, 4, 8]
811
+ }; // CAT
812
+ this.rules[24].opcodes[1] = {
813
+ type: 1,
814
+ children: [2, 3]
815
+ }; // ALT
816
+ this.rules[24].opcodes[2] = {
817
+ type: 7,
818
+ string: [101]
819
+ }; // TLS
820
+ this.rules[24].opcodes[3] = {
821
+ type: 7,
822
+ string: [101]
823
+ }; // TLS
824
+ this.rules[24].opcodes[4] = {
825
+ type: 3,
826
+ min: 0,
827
+ max: 1
828
+ }; // REP
829
+ this.rules[24].opcodes[5] = {
830
+ type: 1,
831
+ children: [6, 7]
832
+ }; // ALT
833
+ this.rules[24].opcodes[6] = {
834
+ type: 7,
835
+ string: [45]
836
+ }; // TLS
837
+ this.rules[24].opcodes[7] = {
838
+ type: 7,
839
+ string: [43]
840
+ }; // TLS
841
+ this.rules[24].opcodes[8] = {
842
+ type: 3,
843
+ min: 1,
844
+ max: Infinity
845
+ }; // REP
846
+ this.rules[24].opcodes[9] = {
847
+ type: 4,
848
+ index: 33
849
+ }; // RNM(DIGIT)
850
+
851
+ /* DIGIT1 */
852
+ this.rules[25].opcodes = [];
853
+ this.rules[25].opcodes[0] = {
854
+ type: 5,
855
+ min: 49,
856
+ max: 57
857
+ }; // TRG
858
+
859
+ /* string */
860
+ this.rules[26].opcodes = [];
861
+ this.rules[26].opcodes[0] = {
862
+ type: 2,
863
+ children: [1, 2, 6]
864
+ }; // CAT
865
+ this.rules[26].opcodes[1] = {
866
+ type: 4,
867
+ index: 29
868
+ }; // RNM(squote)
869
+ this.rules[26].opcodes[2] = {
870
+ type: 3,
871
+ min: 0,
872
+ max: Infinity
873
+ }; // REP
874
+ this.rules[26].opcodes[3] = {
875
+ type: 1,
876
+ children: [4, 5]
877
+ }; // ALT
878
+ this.rules[26].opcodes[4] = {
879
+ type: 4,
880
+ index: 27
881
+ }; // RNM(escaped-quote)
882
+ this.rules[26].opcodes[5] = {
883
+ type: 4,
884
+ index: 28
885
+ }; // RNM(string-char)
886
+ this.rules[26].opcodes[6] = {
887
+ type: 4,
888
+ index: 29
889
+ }; // RNM(squote)
890
+
891
+ /* escaped-quote */
892
+ this.rules[27].opcodes = [];
893
+ this.rules[27].opcodes[0] = {
894
+ type: 2,
895
+ children: [1, 2]
896
+ }; // CAT
897
+ this.rules[27].opcodes[1] = {
898
+ type: 4,
899
+ index: 29
900
+ }; // RNM(squote)
901
+ this.rules[27].opcodes[2] = {
902
+ type: 4,
903
+ index: 29
904
+ }; // RNM(squote)
905
+
906
+ /* string-char */
907
+ this.rules[28].opcodes = [];
908
+ this.rules[28].opcodes[0] = {
909
+ type: 1,
910
+ children: [1, 2]
911
+ }; // ALT
912
+ this.rules[28].opcodes[1] = {
913
+ type: 5,
914
+ min: 32,
915
+ max: 38
916
+ }; // TRG
917
+ this.rules[28].opcodes[2] = {
918
+ type: 5,
919
+ min: 40,
920
+ max: 1114111
921
+ }; // TRG
922
+
923
+ /* squote */
924
+ this.rules[29].opcodes = [];
925
+ this.rules[29].opcodes[0] = {
926
+ type: 6,
927
+ string: [39]
928
+ }; // TBS
929
+
930
+ /* S */
931
+ this.rules[30].opcodes = [];
932
+ this.rules[30].opcodes[0] = {
933
+ type: 3,
934
+ min: 0,
935
+ max: Infinity
936
+ }; // REP
937
+ this.rules[30].opcodes[1] = {
938
+ type: 4,
939
+ index: 31
940
+ }; // RNM(B)
941
+
942
+ /* B */
943
+ this.rules[31].opcodes = [];
944
+ this.rules[31].opcodes[0] = {
945
+ type: 1,
946
+ children: [1, 2, 3, 4]
947
+ }; // ALT
948
+ this.rules[31].opcodes[1] = {
949
+ type: 6,
950
+ string: [32]
951
+ }; // TBS
952
+ this.rules[31].opcodes[2] = {
953
+ type: 6,
954
+ string: [9]
955
+ }; // TBS
956
+ this.rules[31].opcodes[3] = {
957
+ type: 6,
958
+ string: [10]
959
+ }; // TBS
960
+ this.rules[31].opcodes[4] = {
961
+ type: 6,
962
+ string: [13]
963
+ }; // TBS
964
+
965
+ /* ALPHA */
966
+ this.rules[32].opcodes = [];
967
+ this.rules[32].opcodes[0] = {
968
+ type: 1,
969
+ children: [1, 2]
970
+ }; // ALT
971
+ this.rules[32].opcodes[1] = {
972
+ type: 5,
973
+ min: 65,
974
+ max: 90
975
+ }; // TRG
976
+ this.rules[32].opcodes[2] = {
977
+ type: 5,
978
+ min: 97,
979
+ max: 122
980
+ }; // TRG
981
+
982
+ /* DIGIT */
983
+ this.rules[33].opcodes = [];
984
+ this.rules[33].opcodes[0] = {
985
+ type: 5,
986
+ min: 48,
987
+ max: 57
988
+ }; // TRG
989
+
990
+ // The `toString()` function will display the original grammar file(s) that produced these opcodes.
991
+ this.toString = function toString() {
992
+ let str = "";
993
+ str += "; Arazzo Criterion Object - \"simple\" condition ABNF syntax\n";
994
+ str += "; https://spec.openapis.org/arazzo/v1.1.0.html#criterion-object\n";
995
+ str += ";\n";
996
+ str += "; This grammar is self-contained and uses only standard ABNF (RFC 5234) - no\n";
997
+ str += "; parser-specific extensions. It describes the criterion language and does NOT\n";
998
+ str += "; embed the Arazzo Runtime Expressions grammar: an operand is captured as a single\n";
999
+ str += "; bounded token, and the fact that this token is a runtime expression is resolved\n";
1000
+ str += "; separately by @swaggerexpert/arazzo-runtime-expression during AST construction.\n";
1001
+ str += ";\n";
1002
+ str += "; The logical / comparison spine (logical-or-expr, logical-and-expr, basic-expr,\n";
1003
+ str += "; paren-expr, test-expr, comparison-expr, logical-not-op, comparison-op, number,\n";
1004
+ str += "; frac, exp, S, B) is derived from RFC 9535 (JSONPath) section 2.3.5.1. It cleanly\n";
1005
+ str += "; separates a logical layer (||, &&, !, grouping) that composes only booleans from a\n";
1006
+ str += "; flat, non-recursive comparison layer (comparable OP comparable), which rejects\n";
1007
+ str += "; nonsense such as chained comparisons (a < b < c) at the grammar level.\n";
1008
+ str += ";\n";
1009
+ str += "; SPDX-FileCopyrightText: Copyright (c) 2024 IETF Trust and the persons identified\n";
1010
+ str += "; as the document authors. All rights reserved. https://www.rfc-editor.org/rfc/rfc9535\n";
1011
+ str += "; SPDX-License-Identifier: BSD-3-Clause (for the RFC 9535-derived rules above)\n";
1012
+ str += ";\n";
1013
+ str += "; About the operand: a runtime expression and the criterion accessors (\".member\",\n";
1014
+ str += "; \"[n]\") both use \".\" as a separator, so the boundary between them cannot be\n";
1015
+ str += "; expressed in a context-free grammar. The operand is therefore matched here as one\n";
1016
+ str += "; maximal token - a run of characters that excludes whitespace and the criterion-\n";
1017
+ str += "; significant characters\n";
1018
+ str += "; \"!\" %x21 \"&\" %x26 \"(\" %x28 \")\" %x29 \"<\" %x3C \"=\" %x3D \">\" %x3E\n";
1019
+ str += "; \"{\" %x7B \"|\" %x7C \"}\" %x7D\n";
1020
+ str += "; The AST builder then splits it into the runtime-expression base and the trailing\n";
1021
+ str += "; accessors by delegating the base to @swaggerexpert/arazzo-runtime-expression.\n";
1022
+ str += ";\n";
1023
+ str += "; The equivalent normative structure, as it would appear in a specification that\n";
1024
+ str += "; references the Runtime Expressions grammar by name, is:\n";
1025
+ str += ";\n";
1026
+ str += "; comparable = literal / runtime-expression-operand\n";
1027
+ str += "; runtime-expression-operand = runtime-expression *( \".\" member-name / \"[\" index \"]\" )\n";
1028
+ str += "; ; runtime-expression is defined in the Runtime Expressions section\n";
1029
+ str += "\n";
1030
+ str += "; ---------------------------------------------------------------------------\n";
1031
+ str += "; Criterion condition (simple type)\n";
1032
+ str += "; ---------------------------------------------------------------------------\n";
1033
+ str += "\n";
1034
+ str += "condition = S logical-expr S\n";
1035
+ str += "\n";
1036
+ str += "logical-expr = logical-or-expr\n";
1037
+ str += "logical-or-expr = logical-and-expr *( S \"||\" S logical-and-expr )\n";
1038
+ str += "logical-and-expr = basic-expr *( S \"&&\" S basic-expr )\n";
1039
+ str += "\n";
1040
+ str += "basic-expr = paren-expr / comparison-expr / test-expr\n";
1041
+ str += "paren-expr = [ logical-not-op S ] \"(\" S logical-expr S \")\"\n";
1042
+ str += "test-expr = [ logical-not-op S ] comparable\n";
1043
+ str += "comparison-expr = comparable S comparison-op S comparable\n";
1044
+ str += "\n";
1045
+ str += "logical-not-op = \"!\"\n";
1046
+ str += "comparison-op = \"==\" / \"!=\" / \"<=\" / \">=\" / \"<\" / \">\"\n";
1047
+ str += "\n";
1048
+ str += "; ---------------------------------------------------------------------------\n";
1049
+ str += "; Comparables: literals or operands (runtime expression + navigation, matched as\n";
1050
+ str += "; one bounded token; see the header note)\n";
1051
+ str += "; ---------------------------------------------------------------------------\n";
1052
+ str += "\n";
1053
+ str += "comparable = literal / runtime-expression-operand\n";
1054
+ str += "runtime-expression-operand = \"$\" 1*operand-char\n";
1055
+ str += "operand-char = %x22-25 / %x27 / %x2A-3B / %x3F-5A / %x5B-5D / %x5E-7A / %x7E / %x80-10FFFF\n";
1056
+ str += "\n";
1057
+ str += "; Navigation over the resolved runtime-expression value. This is NOT referenced\n";
1058
+ str += "; from `condition` - the operand is matched as a single token there (see the header\n";
1059
+ str += "; note). It is a secondary entry point: after the runtime-expression base is split\n";
1060
+ str += "; off an operand token, the remainder is parsed against `runtime-expression-navigation`\n";
1061
+ str += "; so that the \".member\" / \"[index]\" accessors are validated and structured by this\n";
1062
+ str += "; grammar rather than by ad-hoc code.\n";
1063
+ str += "runtime-expression-navigation = 1*( member-access / index-access )\n";
1064
+ str += "member-access = \".\" member-name\n";
1065
+ str += "index-access = \"[\" index \"]\"\n";
1066
+ str += "member-name = 1*( ALPHA / DIGIT / \"_\" / \"-\" )\n";
1067
+ str += "index = 1*DIGIT\n";
1068
+ str += "\n";
1069
+ str += "; ---------------------------------------------------------------------------\n";
1070
+ str += "; Literals\n";
1071
+ str += "; ---------------------------------------------------------------------------\n";
1072
+ str += "\n";
1073
+ str += "literal = number / string / boolean / null\n";
1074
+ str += "boolean = \"true\" / \"false\"\n";
1075
+ str += "null = \"null\"\n";
1076
+ str += "\n";
1077
+ str += "; number - decimal, mirrors RFC 9535\n";
1078
+ str += "number = ( int / \"-0\" ) [ frac ] [ exp ]\n";
1079
+ str += "int = \"0\" / ( [ \"-\" ] DIGIT1 *DIGIT )\n";
1080
+ str += "frac = \".\" 1*DIGIT\n";
1081
+ str += "exp = ( \"e\" / \"E\" ) [ \"-\" / \"+\" ] 1*DIGIT\n";
1082
+ str += "DIGIT1 = %x31-39 ; 1-9 non-zero digit\n";
1083
+ str += "\n";
1084
+ str += "; string - single-quoted; a literal quote is escaped by doubling it ('')\n";
1085
+ str += "string = squote *( escaped-quote / string-char ) squote\n";
1086
+ str += "escaped-quote = squote squote ; '' represents a single '\n";
1087
+ str += "string-char = %x20-26 / %x28-10FFFF ; any char except squote (%x27)\n";
1088
+ str += "squote = %x27 ; '\n";
1089
+ str += "\n";
1090
+ str += "; ---------------------------------------------------------------------------\n";
1091
+ str += "; Whitespace (optional blank space), per RFC 9535\n";
1092
+ str += "; ---------------------------------------------------------------------------\n";
1093
+ str += "\n";
1094
+ str += "S = *B\n";
1095
+ str += "B = %x20 / %x09 / %x0A / %x0D ; space, tab, LF, CR\n";
1096
+ str += "\n";
1097
+ str += "; ---------------------------------------------------------------------------\n";
1098
+ str += "; Core rules (RFC 5234 B.1)\n";
1099
+ str += "; ---------------------------------------------------------------------------\n";
1100
+ str += "\n";
1101
+ str += "ALPHA = %x41-5A / %x61-7A ; A-Z / a-z\n";
1102
+ str += "DIGIT = %x30-39 ; 0-9\n";
1103
+ return str;
1104
+ };
1105
+ }