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