valkyrie-parser 0.2.5

The hand write parser of valkyrie language
Documentation
1
2
3
4
5
6
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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
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
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
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
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
use super::*;

pub(super) fn parse_cst(input: &str, rule: ValkyrieRule) -> OutputResult<ValkyrieRule> {
    state(input, |state| match rule {
        ValkyrieRule::Program => parse_program(state),
        ValkyrieRule::Statement => parse_statement(state),
        ValkyrieRule::EOS => parse_eos(state),
        ValkyrieRule::EOS_FREE => parse_eos_free(state),
        ValkyrieRule::DefineNamespace => parse_define_namespace(state),
        ValkyrieRule::OP_NAMESPACE => parse_op_namespace(state),
        ValkyrieRule::DefineImport => parse_define_import(state),
        ValkyrieRule::ImportBlock => parse_import_block(state),
        ValkyrieRule::ImportTerm => parse_import_term(state),
        ValkyrieRule::ImportAll => parse_import_all(state),
        ValkyrieRule::ImportSpace => parse_import_space(state),
        ValkyrieRule::ImportName => parse_import_name(state),
        ValkyrieRule::ImportAs => parse_import_as(state),
        ValkyrieRule::ImportNameItem => parse_import_name_item(state),
        ValkyrieRule::DefineConstraint => parse_define_constraint(state),
        ValkyrieRule::ConstraintParameters => parse_constraint_parameters(state),
        ValkyrieRule::ConstraintBlock => parse_constraint_block(state),
        ValkyrieRule::ConstraintStatement => parse_constraint_statement(state),
        ValkyrieRule::ConstraintImplements => parse_constraint_implements(state),
        ValkyrieRule::WhereBlock => parse_where_block(state),
        ValkyrieRule::WhereBound => parse_where_bound(state),
        ValkyrieRule::DefineClass => parse_define_class(state),
        ValkyrieRule::ClassBlock => parse_class_block(state),
        ValkyrieRule::ClassTerm => parse_class_term(state),
        ValkyrieRule::KW_CLASS => parse_kw_class(state),
        ValkyrieRule::DefineField => parse_define_field(state),
        ValkyrieRule::ParameterDefault => parse_parameter_default(state),
        ValkyrieRule::DefineMethod => parse_define_method(state),
        ValkyrieRule::DefineDomain => parse_define_domain(state),
        ValkyrieRule::DomainTerm => parse_domain_term(state),
        ValkyrieRule::DefineInherit => parse_define_inherit(state),
        ValkyrieRule::InheritTerm => parse_inherit_term(state),
        ValkyrieRule::ObjectStatement => parse_object_statement(state),
        ValkyrieRule::DefineEnumerate => parse_define_enumerate(state),
        ValkyrieRule::FlagTerm => parse_flag_term(state),
        ValkyrieRule::FlagField => parse_flag_field(state),
        ValkyrieRule::KW_FLAGS => parse_kw_flags(state),
        ValkyrieRule::DefineUnion => parse_define_union(state),
        ValkyrieRule::UnionTerm => parse_union_term(state),
        ValkyrieRule::DefineVariant => parse_define_variant(state),
        ValkyrieRule::KW_UNION => parse_kw_union(state),
        ValkyrieRule::DefineTrait => parse_define_trait(state),
        ValkyrieRule::DefineExtends => parse_define_extends(state),
        ValkyrieRule::TraitBlock => parse_trait_block(state),
        ValkyrieRule::TraitTerm => parse_trait_term(state),
        ValkyrieRule::KW_TRAIT => parse_kw_trait(state),
        ValkyrieRule::DefineFunction => parse_define_function(state),
        ValkyrieRule::DefineLambda => parse_define_lambda(state),
        ValkyrieRule::FunctionMiddle => parse_function_middle(state),
        ValkyrieRule::TypeHint => parse_type_hint(state),
        ValkyrieRule::TypeReturn => parse_type_return(state),
        ValkyrieRule::TypeEffect => parse_type_effect(state),
        ValkyrieRule::FunctionParameters => parse_function_parameters(state),
        ValkyrieRule::ParameterItem => parse_parameter_item(state),
        ValkyrieRule::ParameterPair => parse_parameter_pair(state),
        ValkyrieRule::ParameterHint => parse_parameter_hint(state),
        ValkyrieRule::Continuation => parse_continuation(state),
        ValkyrieRule::KW_FUNCTION => parse_kw_function(state),
        ValkyrieRule::DefineVariable => parse_define_variable(state),
        ValkyrieRule::LetPattern => parse_let_pattern(state),
        ValkyrieRule::StandardPattern => parse_standard_pattern(state),
        ValkyrieRule::BarePattern => parse_bare_pattern(state),
        ValkyrieRule::BarePatternItem => parse_bare_pattern_item(state),
        ValkyrieRule::TuplePattern => parse_tuple_pattern(state),
        ValkyrieRule::PatternItem => parse_pattern_item(state),
        ValkyrieRule::TuplePatternItem => parse_tuple_pattern_item(state),
        ValkyrieRule::WhileStatement => parse_while_statement(state),
        ValkyrieRule::KW_WHILE => parse_kw_while(state),
        ValkyrieRule::ForStatement => parse_for_statement(state),
        ValkyrieRule::IfGuard => parse_if_guard(state),
        ValkyrieRule::ControlFlow => parse_control_flow(state),
        ValkyrieRule::JumpLabel => parse_jump_label(state),
        ValkyrieRule::ExpressionRoot => parse_expression_root(state),
        ValkyrieRule::MatchExpression => parse_match_expression(state),
        ValkyrieRule::SwitchStatement => parse_switch_statement(state),
        ValkyrieRule::MatchBlock => parse_match_block(state),
        ValkyrieRule::MatchTerms => parse_match_terms(state),
        ValkyrieRule::MatchType => parse_match_type(state),
        ValkyrieRule::MatchCase => parse_match_case(state),
        ValkyrieRule::CasePattern => parse_case_pattern(state),
        ValkyrieRule::MatchWhen => parse_match_when(state),
        ValkyrieRule::MatchElse => parse_match_else(state),
        ValkyrieRule::MatchStatement => parse_match_statement(state),
        ValkyrieRule::KW_MATCH => parse_kw_match(state),
        ValkyrieRule::BIND_L => parse_bind_l(state),
        ValkyrieRule::BIND_R => parse_bind_r(state),
        ValkyrieRule::DotMatchCall => parse_dot_match_call(state),
        ValkyrieRule::MainExpression => parse_main_expression(state),
        ValkyrieRule::MainTerm => parse_main_term(state),
        ValkyrieRule::MainFactor => parse_main_factor(state),
        ValkyrieRule::GroupFactor => parse_group_factor(state),
        ValkyrieRule::Leading => parse_leading(state),
        ValkyrieRule::MainSuffixTerm => parse_main_suffix_term(state),
        ValkyrieRule::MainPrefix => parse_main_prefix(state),
        ValkyrieRule::TypePrefix => parse_type_prefix(state),
        ValkyrieRule::MainInfix => parse_main_infix(state),
        ValkyrieRule::TypeInfix => parse_type_infix(state),
        ValkyrieRule::MainSuffix => parse_main_suffix(state),
        ValkyrieRule::TypeSuffix => parse_type_suffix(state),
        ValkyrieRule::InlineExpression => parse_inline_expression(state),
        ValkyrieRule::InlineTerm => parse_inline_term(state),
        ValkyrieRule::InlineSuffixTerm => parse_inline_suffix_term(state),
        ValkyrieRule::TypeExpression => parse_type_expression(state),
        ValkyrieRule::TypeTerm => parse_type_term(state),
        ValkyrieRule::TypeFactor => parse_type_factor(state),
        ValkyrieRule::TypeSuffixTerm => parse_type_suffix_term(state),
        ValkyrieRule::TryStatement => parse_try_statement(state),
        ValkyrieRule::NewStatement => parse_new_statement(state),
        ValkyrieRule::NewBlock => parse_new_block(state),
        ValkyrieRule::NewPair => parse_new_pair(state),
        ValkyrieRule::NewPairKey => parse_new_pair_key(state),
        ValkyrieRule::DotCall => parse_dot_call(state),
        ValkyrieRule::DotCallItem => parse_dot_call_item(state),
        ValkyrieRule::DotClosureCall => parse_dot_closure_call(state),
        ValkyrieRule::InlineTupleCall => parse_inline_tuple_call(state),
        ValkyrieRule::TupleCall => parse_tuple_call(state),
        ValkyrieRule::TupleLiteral => parse_tuple_literal(state),
        ValkyrieRule::TupleLiteralStrict => parse_tuple_literal_strict(state),
        ValkyrieRule::TupleTerms => parse_tuple_terms(state),
        ValkyrieRule::TuplePair => parse_tuple_pair(state),
        ValkyrieRule::TupleKey => parse_tuple_key(state),
        ValkyrieRule::RangeCall => parse_range_call(state),
        ValkyrieRule::RangeLiteral => parse_range_literal(state),
        ValkyrieRule::RangeLiteralIndex0 => parse_range_literal_index_0(state),
        ValkyrieRule::RangeLiteralIndex1 => parse_range_literal_index_1(state),
        ValkyrieRule::SubscriptAxis => parse_subscript_axis(state),
        ValkyrieRule::SubscriptOnly => parse_subscript_only(state),
        ValkyrieRule::SubscriptRange => parse_subscript_range(state),
        ValkyrieRule::RangeOmit => parse_range_omit(state),
        ValkyrieRule::DefineGeneric => parse_define_generic(state),
        ValkyrieRule::GenericParameter => parse_generic_parameter(state),
        ValkyrieRule::GenericParameterPair => parse_generic_parameter_pair(state),
        ValkyrieRule::GenericCall => parse_generic_call(state),
        ValkyrieRule::GenericHide => parse_generic_hide(state),
        ValkyrieRule::GenericTerms => parse_generic_terms(state),
        ValkyrieRule::GenericPair => parse_generic_pair(state),
        ValkyrieRule::AnnotationHead => parse_annotation_head(state),
        ValkyrieRule::AnnotationMix => parse_annotation_mix(state),
        ValkyrieRule::AnnotationTerm => parse_annotation_term(state),
        ValkyrieRule::AnnotationTermMix => parse_annotation_term_mix(state),
        ValkyrieRule::AttributeList => parse_attribute_list(state),
        ValkyrieRule::AttributeCall => parse_attribute_call(state),
        ValkyrieRule::AttributeItem => parse_attribute_item(state),
        ValkyrieRule::AttributeName => parse_attribute_name(state),
        ValkyrieRule::ProceduralCall => parse_procedural_call(state),
        ValkyrieRule::ProceduralName => parse_procedural_name(state),
        ValkyrieRule::TextLiteral => parse_text_literal(state),
        ValkyrieRule::TextRaw => parse_text_raw(state),
        ValkyrieRule::Text_L => parse_text_l(state),
        ValkyrieRule::Text_R => parse_text_r(state),
        ValkyrieRule::Text_X => parse_text_x(state),
        ValkyrieRule::TEXT_CONTENT1 => parse_text_content_1(state),
        ValkyrieRule::TEXT_CONTENT2 => parse_text_content_2(state),
        ValkyrieRule::TEXT_CONTENT3 => parse_text_content_3(state),
        ValkyrieRule::TEXT_CONTENT4 => parse_text_content_4(state),
        ValkyrieRule::TEXT_CONTENT5 => parse_text_content_5(state),
        ValkyrieRule::TEXT_CONTENT6 => parse_text_content_6(state),
        ValkyrieRule::ModifierCall => parse_modifier_call(state),
        ValkyrieRule::ModifierAhead => parse_modifier_ahead(state),
        ValkyrieRule::KEYWORDS_STOP => parse_keywords_stop(state),
        ValkyrieRule::IDENTIFIER_STOP => parse_identifier_stop(state),
        ValkyrieRule::Slot => parse_slot(state),
        ValkyrieRule::SlotItem => parse_slot_item(state),
        ValkyrieRule::NamepathFree => parse_namepath_free(state),
        ValkyrieRule::Namepath => parse_namepath(state),
        ValkyrieRule::Identifier => parse_identifier(state),
        ValkyrieRule::IdentifierBare => parse_identifier_bare(state),
        ValkyrieRule::IdentifierRaw => parse_identifier_raw(state),
        ValkyrieRule::IdentifierRawText => parse_identifier_raw_text(state),
        ValkyrieRule::Special => parse_special(state),
        ValkyrieRule::Number => parse_number(state),
        ValkyrieRule::Sign => parse_sign(state),
        ValkyrieRule::Integer => parse_integer(state),
        ValkyrieRule::DigitsX => parse_digits_x(state),
        ValkyrieRule::Decimal => parse_decimal(state),
        ValkyrieRule::DecimalX => parse_decimal_x(state),
        ValkyrieRule::PROPORTION => parse_proportion(state),
        ValkyrieRule::NS_CONCAT => parse_ns_concat(state),
        ValkyrieRule::COLON => parse_colon(state),
        ValkyrieRule::ARROW1 => parse_arrow_1(state),
        ValkyrieRule::COMMA => parse_comma(state),
        ValkyrieRule::DOT => parse_dot(state),
        ValkyrieRule::OP_SLOT => parse_op_slot(state),
        ValkyrieRule::OFFSET_L => parse_offset_l(state),
        ValkyrieRule::OFFSET_R => parse_offset_r(state),
        ValkyrieRule::PROPORTION2 => parse_proportion_2(state),
        ValkyrieRule::OP_IMPORT_ALL => parse_op_import_all(state),
        ValkyrieRule::OP_AND_THEN => parse_op_and_then(state),
        ValkyrieRule::OP_BIND => parse_op_bind(state),
        ValkyrieRule::KW_CONTROL => parse_kw_control(state),
        ValkyrieRule::KW_NAMESPACE => parse_kw_namespace(state),
        ValkyrieRule::KW_IMPORT => parse_kw_import(state),
        ValkyrieRule::KW_CONSTRAINT => parse_kw_constraint(state),
        ValkyrieRule::KW_WHERE => parse_kw_where(state),
        ValkyrieRule::KW_IMPLEMENTS => parse_kw_implements(state),
        ValkyrieRule::KW_EXTENDS => parse_kw_extends(state),
        ValkyrieRule::KW_INHERITS => parse_kw_inherits(state),
        ValkyrieRule::KW_FOR => parse_kw_for(state),
        ValkyrieRule::KW_END => parse_kw_end(state),
        ValkyrieRule::KW_LET => parse_kw_let(state),
        ValkyrieRule::KW_NEW => parse_kw_new(state),
        ValkyrieRule::KW_OBJECT => parse_kw_object(state),
        ValkyrieRule::KW_LAMBDA => parse_kw_lambda(state),
        ValkyrieRule::KW_IF => parse_kw_if(state),
        ValkyrieRule::KW_SWITCH => parse_kw_switch(state),
        ValkyrieRule::KW_TRY => parse_kw_try(state),
        ValkyrieRule::KW_TYPE => parse_kw_type(state),
        ValkyrieRule::KW_CASE => parse_kw_case(state),
        ValkyrieRule::KW_WHEN => parse_kw_when(state),
        ValkyrieRule::KW_ELSE => parse_kw_else(state),
        ValkyrieRule::KW_NOT => parse_kw_not(state),
        ValkyrieRule::KW_IN => parse_kw_in(state),
        ValkyrieRule::KW_IS => parse_kw_is(state),
        ValkyrieRule::KW_AS => parse_kw_as(state),
        ValkyrieRule::Shebang => parse_shebang(state),
        ValkyrieRule::WhiteSpace => parse_white_space(state),
        ValkyrieRule::SkipSpace => parse_skip_space(state),
        ValkyrieRule::Comment => parse_comment(state),
        ValkyrieRule::StringInterpolations => parse_string_interpolations(state),
        ValkyrieRule::StringInterpolationTerm => parse_string_interpolation_term(state),
        ValkyrieRule::EscapeCharacter => parse_escape_character(state),
        ValkyrieRule::EscapeUnicode => parse_escape_unicode(state),
        ValkyrieRule::EscapeUnicodeCode => parse_escape_unicode_code(state),
        ValkyrieRule::StringInterpolationSimple => parse_string_interpolation_simple(state),
        ValkyrieRule::StringInterpolationText => parse_string_interpolation_text(state),
        ValkyrieRule::StringFormatter => parse_string_formatter(state),
        ValkyrieRule::StringInterpolationComplex => parse_string_interpolation_complex(state),
        ValkyrieRule::StringTemplates => parse_string_templates(state),
        ValkyrieRule::StringTemplateTerm => parse_string_template_term(state),
        ValkyrieRule::ExpressionTemplate => parse_expression_template(state),
        ValkyrieRule::ForTemplate => parse_for_template(state),
        ValkyrieRule::ForTemplateBegin => parse_for_template_begin(state),
        ValkyrieRule::ForTemplateElse => parse_for_template_else(state),
        ValkyrieRule::ForTemplateEnd => parse_for_template_end(state),
        ValkyrieRule::TEMPLATE_S => parse_template_s(state),
        ValkyrieRule::TEMPLATE_E => parse_template_e(state),
        ValkyrieRule::TEMPLATE_L => parse_template_l(state),
        ValkyrieRule::TEMPLATE_R => parse_template_r(state),
        ValkyrieRule::TEMPLATE_M => parse_template_m(state),
        ValkyrieRule::HiddenText => unreachable!(),
    })
}
#[inline]
fn parse_program(state: Input) -> Output {
    state.rule(ValkyrieRule::Program, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| s.start_of_input())
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_shebang(s).and_then(|s| s.tag_node("shebang"))))
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_statement(s).and_then(|s| s.tag_node("statement")))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.end_of_input())
        })
    })
}
#[inline]
fn parse_statement(state: Input) -> Output {
    state.rule(ValkyrieRule::Statement, |s| {
        Err(s)
            .or_else(|s| parse_define_namespace(s).and_then(|s| s.tag_node("define_namespace")))
            .or_else(|s| parse_define_class(s).and_then(|s| s.tag_node("define_class")))
            .or_else(|s| parse_define_union(s).and_then(|s| s.tag_node("define_union")))
            .or_else(|s| parse_define_enumerate(s).and_then(|s| s.tag_node("define_enumerate")))
            .or_else(|s| parse_define_trait(s).and_then(|s| s.tag_node("define_trait")))
            .or_else(|s| parse_define_extends(s).and_then(|s| s.tag_node("define_extends")))
            .or_else(|s| parse_define_function(s).and_then(|s| s.tag_node("define_function")))
            .or_else(|s| parse_define_variable(s).and_then(|s| s.tag_node("define_variable")))
            .or_else(|s| parse_define_import(s).and_then(|s| s.tag_node("define_import")))
            .or_else(|s| parse_control_flow(s).and_then(|s| s.tag_node("control_flow")))
            .or_else(|s| parse_while_statement(s).and_then(|s| s.tag_node("while_statement")))
            .or_else(|s| parse_for_statement(s).and_then(|s| s.tag_node("for_statement")))
            .or_else(|s| parse_expression_root(s).and_then(|s| s.tag_node("expression_root")))
            .or_else(|s| parse_eos(s).and_then(|s| s.tag_node("eos")))
    })
}
#[inline]
fn parse_eos(state: Input) -> Output {
    state.rule(ValkyrieRule::EOS, |s| {
        Err(s)
            .or_else(|s| {
                builtin_regex(s, {
                    static REGEX: OnceLock<Regex> = OnceLock::new();
                    REGEX.get_or_init(|| Regex::new("^(?x)([;;])").unwrap())
                })
                .and_then(|s| s.tag_node("omit"))
            })
            .or_else(|s| {
                builtin_regex(s, {
                    static REGEX: OnceLock<Regex> = OnceLock::new();
                    REGEX.get_or_init(|| Regex::new("^(?x)(⁏|;;)").unwrap())
                })
                .and_then(|s| s.tag_node("show"))
            })
    })
}
#[inline]
fn parse_eos_free(state: Input) -> Output {
    state.rule(ValkyrieRule::EOS_FREE, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)([,,;;⁏])").unwrap())
        })
    })
}
#[inline]
fn parse_define_namespace(state: Input) -> Output {
    state.rule(ValkyrieRule::DefineNamespace, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_kw_namespace(s))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_op_namespace(s).and_then(|s| s.tag_node("op_namespace"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_namepath_free(s).and_then(|s| s.tag_node("namepath_free")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_eos(s)))
        })
    })
}
#[inline]
fn parse_op_namespace(state: Input) -> Output {
    state.rule(ValkyrieRule::OP_NAMESPACE, |s| {
        Err(s)
            .or_else(|s| builtin_text(s, "!", false).and_then(|s| s.tag_node("main")))
            .or_else(|s| builtin_text(s, "?", false).and_then(|s| s.tag_node("test")))
            .or_else(|s| builtin_text(s, "*", false).and_then(|s| s.tag_node("hide")))
    })
}
#[inline]
fn parse_define_import(state: Input) -> Output {
    state.rule(ValkyrieRule::DefineImport, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_annotation_term(s).and_then(|s| s.tag_node("annotation_term")))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_kw_import(s))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    Err(s)
                        .or_else(|s| parse_eos_free(s).and_then(|s| s.tag_node("eos_free")))
                        .or_else(|s| {
                            s.sequence(|s| {
                                Ok(s)
                                    .and_then(|s| parse_import_block(s).and_then(|s| s.tag_node("import_block")))
                                    .and_then(|s| builtin_ignore(s))
                                    .and_then(|s| s.optional(|s| parse_eos_free(s).and_then(|s| s.tag_node("eos_free"))))
                            })
                        })
                        .or_else(|s| {
                            s.sequence(|s| {
                                Ok(s)
                                    .and_then(|s| parse_import_term(s).and_then(|s| s.tag_node("import_term")))
                                    .and_then(|s| builtin_ignore(s))
                                    .and_then(|s| s.optional(|s| parse_eos_free(s).and_then(|s| s.tag_node("eos_free"))))
                            })
                        })
                })
        })
    })
}
#[inline]
fn parse_import_block(state: Input) -> Output {
    state.rule(ValkyrieRule::ImportBlock, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| builtin_text(s, "{", false))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_import_term(s).and_then(|s| s.tag_node("import_term")))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, "}", false))
        })
    })
}
#[inline]
fn parse_import_term(state: Input) -> Output {
    state.rule(ValkyrieRule::ImportTerm, |s| {
        Err(s)
            .or_else(|s| parse_import_all(s).and_then(|s| s.tag_node("import_all")))
            .or_else(|s| parse_import_space(s).and_then(|s| s.tag_node("import_space")))
            .or_else(|s| parse_import_name(s).and_then(|s| s.tag_node("import_name")))
            .or_else(|s| parse_eos_free(s).and_then(|s| s.tag_node("eos_free")))
    })
}
#[inline]
fn parse_import_all(state: Input) -> Output {
    state.rule(ValkyrieRule::ImportAll, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| {
                    s.repeat(1..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s).and_then(|s| builtin_ignore(s)).and_then(|s| {
                                s.sequence(|s| {
                                    Ok(s)
                                        .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("path")))
                                        .and_then(|s| builtin_ignore(s))
                                        .and_then(|s| parse_ns_concat(s))
                                })
                            })
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_op_import_all(s))
        })
    })
}
#[inline]
fn parse_import_space(state: Input) -> Output {
    state.rule(ValkyrieRule::ImportSpace, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| {
                    s.sequence(|s| {
                        Ok(s)
                            .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("path")))
                            .and_then(|s| builtin_ignore(s))
                            .and_then(|s| {
                                s.repeat(0..4294967295, |s| {
                                    s.sequence(|s| {
                                        Ok(s).and_then(|s| builtin_ignore(s)).and_then(|s| {
                                            s.sequence(|s| {
                                                Ok(s)
                                                    .and_then(|s| {
                                                        s.sequence(|s| {
                                                            Ok(s)
                                                                .and_then(|s| parse_ns_concat(s))
                                                                .and_then(|s| builtin_ignore(s))
                                                        })
                                                    })
                                                    .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("path")))
                                            })
                                        })
                                    })
                                })
                            })
                            .and_then(|s| builtin_ignore(s))
                            .and_then(|s| s.optional(|s| parse_ns_concat(s)))
                            .and_then(|s| builtin_ignore(s))
                    })
                })
                .and_then(|s| parse_import_block(s).and_then(|s| s.tag_node("body")))
        })
    })
}
#[inline]
fn parse_import_name(state: Input) -> Output {
    state.rule(ValkyrieRule::ImportName, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| {
                    s.sequence(|s| {
                        Ok(s)
                            .and_then(|s| {
                                s.sequence(|s| {
                                    Ok(s)
                                        .and_then(|s| {
                                            s.repeat(0..4294967295, |s| {
                                                s.sequence(|s| {
                                                    Ok(s).and_then(|s| builtin_ignore(s)).and_then(|s| {
                                                        s.sequence(|s| {
                                                            Ok(s)
                                                                .and_then(|s| {
                                                                    parse_identifier(s).and_then(|s| s.tag_node("path"))
                                                                })
                                                                .and_then(|s| builtin_ignore(s))
                                                                .and_then(|s| parse_ns_concat(s))
                                                        })
                                                    })
                                                })
                                            })
                                        })
                                        .and_then(|s| builtin_ignore(s))
                                })
                            })
                            .and_then(|s| parse_import_name_item(s).and_then(|s| s.tag_node("item")))
                            .and_then(|s| builtin_ignore(s))
                    })
                })
                .and_then(|s| parse_import_as(s).and_then(|s| s.tag_node("alias")))
        })
    })
}
#[inline]
fn parse_import_as(state: Input) -> Output {
    state.rule(ValkyrieRule::ImportAs, |s| {
        s.optional(|s| {
            s.sequence(|s| {
                Ok(s)
                    .and_then(|s| s.sequence(|s| Ok(s).and_then(|s| parse_kw_as(s)).and_then(|s| builtin_ignore(s))))
                    .and_then(|s| parse_import_name_item(s).and_then(|s| s.tag_node("alias")))
            })
        })
    })
}
#[inline]
fn parse_import_name_item(state: Input) -> Output {
    state.rule(ValkyrieRule::ImportNameItem, |s| {
        Err(s)
            .or_else(|s| parse_procedural_name(s).and_then(|s| s.tag_node("procedural_name")))
            .or_else(|s| parse_attribute_name(s).and_then(|s| s.tag_node("attribute_name")))
            .or_else(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
    })
}
#[inline]
fn parse_define_constraint(state: Input) -> Output {
    state.rule(ValkyrieRule::DefineConstraint, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_annotation_head(s).and_then(|s| s.tag_node("annotation_head")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_kw_constraint(s).and_then(|s| s.tag_node("kw_constraint")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_constraint_parameters(s).and_then(|s| s.tag_node("constraint_parameters"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_constraint_block(s).and_then(|s| s.tag_node("constraint_block")))
        })
    })
}
#[inline]
fn parse_constraint_parameters(state: Input) -> Output {
    state.rule(ValkyrieRule::ConstraintParameters, |s| {
        Err(s)
            .or_else(|s| {
                s.sequence(|s| {
                    Ok(s)
                        .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| {
                            s.repeat(0..4294967295, |s| {
                                s.sequence(|s| {
                                    Ok(s).and_then(|s| builtin_ignore(s)).and_then(|s| {
                                        s.sequence(|s| {
                                            Ok(s)
                                                .and_then(|s| parse_comma(s))
                                                .and_then(|s| builtin_ignore(s))
                                                .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
                                        })
                                    })
                                })
                            })
                        })
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| s.optional(|s| parse_comma(s)))
                })
            })
            .or_else(|s| {
                s.sequence(|s| {
                    Ok(s)
                        .and_then(|s| builtin_text(s, "<", false))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| {
                            s.repeat(0..4294967295, |s| {
                                s.sequence(|s| {
                                    Ok(s).and_then(|s| builtin_ignore(s)).and_then(|s| {
                                        s.sequence(|s| {
                                            Ok(s)
                                                .and_then(|s| parse_comma(s))
                                                .and_then(|s| builtin_ignore(s))
                                                .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
                                        })
                                    })
                                })
                            })
                        })
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| s.optional(|s| parse_comma(s)))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| builtin_text(s, ">", false))
                })
            })
            .or_else(|s| {
                s.sequence(|s| {
                    Ok(s)
                        .and_then(|s| builtin_text(s, "", false))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| {
                            s.repeat(0..4294967295, |s| {
                                s.sequence(|s| {
                                    Ok(s).and_then(|s| builtin_ignore(s)).and_then(|s| {
                                        s.sequence(|s| {
                                            Ok(s)
                                                .and_then(|s| parse_comma(s))
                                                .and_then(|s| builtin_ignore(s))
                                                .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
                                        })
                                    })
                                })
                            })
                        })
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| s.optional(|s| parse_comma(s)))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| builtin_text(s, "", false))
                })
            })
    })
}
#[inline]
fn parse_constraint_block(state: Input) -> Output {
    state.rule(ValkyrieRule::ConstraintBlock, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| builtin_text(s, "{", false))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s).and_then(|s| builtin_ignore(s)).and_then(|s| {
                                Err(s)
                                    .or_else(|s| parse_constraint_statement(s).and_then(|s| s.tag_node("constraint_statement")))
                                    .or_else(|s| {
                                        parse_constraint_implements(s).and_then(|s| s.tag_node("constraint_implements"))
                                    })
                                    .or_else(|s| parse_eos_free(s).and_then(|s| s.tag_node("eos_free")))
                            })
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, "}", false))
        })
    })
}
#[inline]
fn parse_constraint_statement(state: Input) -> Output {
    state.rule(ValkyrieRule::ConstraintStatement, |s| parse_where_block(s).and_then(|s| s.tag_node("where_block")))
}
#[inline]
fn parse_constraint_implements(state: Input) -> Output {
    state.rule(ValkyrieRule::ConstraintImplements, |s| parse_kw_implements(s).and_then(|s| s.tag_node("kw_implements")))
}
#[inline]
fn parse_where_block(state: Input) -> Output {
    state.rule(ValkyrieRule::WhereBlock, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_kw_where(s).and_then(|s| s.tag_node("kw_where")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, "{", false))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_where_bound(s).and_then(|s| s.tag_node("where_bound")))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, "}", false))
        })
    })
}
#[inline]
fn parse_where_bound(state: Input) -> Output {
    state.rule(ValkyrieRule::WhereBound, |s| parse_eos_free(s).and_then(|s| s.tag_node("eos_free")))
}
#[inline]
fn parse_define_class(state: Input) -> Output {
    state.rule(ValkyrieRule::DefineClass, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| s.optional(|s| parse_define_constraint(s).and_then(|s| s.tag_node("define_constraint"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_annotation_head(s).and_then(|s| s.tag_node("annotation_head")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_kw_class(s).and_then(|s| s.tag_node("kw_class")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_define_generic(s).and_then(|s| s.tag_node("define_generic"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_define_inherit(s).and_then(|s| s.tag_node("define_inherit"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_type_hint(s).and_then(|s| s.tag_node("type_hint")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_class_block(s).and_then(|s| s.tag_node("class_block")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_eos(s)))
        })
    })
}
#[inline]
fn parse_class_block(state: Input) -> Output {
    state.rule(ValkyrieRule::ClassBlock, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| builtin_text(s, "{", false))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_class_term(s).and_then(|s| s.tag_node("class_term")))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, "}", false))
        })
    })
}
#[inline]
fn parse_class_term(state: Input) -> Output {
    state.rule(ValkyrieRule::ClassTerm, |s| {
        Err(s)
            .or_else(|s| parse_procedural_call(s).and_then(|s| s.tag_node("procedural_call")))
            .or_else(|s| parse_define_method(s).and_then(|s| s.tag_node("define_method")))
            .or_else(|s| parse_define_domain(s).and_then(|s| s.tag_node("define_domain")))
            .or_else(|s| parse_define_field(s).and_then(|s| s.tag_node("define_field")))
            .or_else(|s| parse_eos_free(s).and_then(|s| s.tag_node("eos_free")))
    })
}
#[inline]
fn parse_kw_class(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_CLASS, |s| {
        Err(s)
            .or_else(|s| builtin_text(s, "class", false).and_then(|s| s.tag_node("class")))
            .or_else(|s| builtin_text(s, "structure", false).and_then(|s| s.tag_node("structure")))
    })
}
#[inline]
fn parse_define_field(state: Input) -> Output {
    state.rule(ValkyrieRule::DefineField, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_annotation_mix(s).and_then(|s| s.tag_node("annotation_mix")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_type_hint(s).and_then(|s| s.tag_node("type_hint")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_parameter_default(s).and_then(|s| s.tag_node("parameter_default")))
        })
    })
}
#[inline]
fn parse_parameter_default(state: Input) -> Output {
    state.rule(ValkyrieRule::ParameterDefault, |s| {
        s.optional(|s| {
            s.sequence(|s| {
                Ok(s)
                    .and_then(|s| builtin_text(s, "=", false))
                    .and_then(|s| builtin_ignore(s))
                    .and_then(|s| parse_main_expression(s).and_then(|s| s.tag_node("main_expression")))
            })
        })
    })
}
#[inline]
fn parse_define_method(state: Input) -> Output {
    state.rule(ValkyrieRule::DefineMethod, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_annotation_mix(s).and_then(|s| s.tag_node("annotation_mix")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_namepath(s).and_then(|s| s.tag_node("namepath")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_function_middle(s).and_then(|s| s.tag_node("function_middle")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_continuation(s).and_then(|s| s.tag_node("continuation"))))
        })
    })
}
#[inline]
fn parse_define_domain(state: Input) -> Output {
    state.rule(ValkyrieRule::DefineDomain, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_annotation_mix(s).and_then(|s| s.tag_node("annotation_mix")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_domain_term(s).and_then(|s| s.tag_node("domain_term")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, "{", false))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_statement(s).and_then(|s| s.tag_node("statement")))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, "}", false))
        })
    })
}
#[inline]
fn parse_domain_term(state: Input) -> Output {
    state.rule(ValkyrieRule::DomainTerm, |s| Err(s).or_else(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier"))))
}
#[inline]
fn parse_define_inherit(state: Input) -> Output {
    state.rule(ValkyrieRule::DefineInherit, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| builtin_text(s, "(", false))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.optional(|s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| parse_inherit_term(s).and_then(|s| s.tag_node("inherit_term")))
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| {
                                    s.repeat(0..4294967295, |s| {
                                        s.sequence(|s| {
                                            Ok(s).and_then(|s| builtin_ignore(s)).and_then(|s| {
                                                s.sequence(|s| {
                                                    Ok(s)
                                                        .and_then(|s| builtin_text(s, ",", false))
                                                        .and_then(|s| builtin_ignore(s))
                                                        .and_then(|s| {
                                                            parse_inherit_term(s).and_then(|s| s.tag_node("inherit_term"))
                                                        })
                                                })
                                            })
                                        })
                                    })
                                })
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| s.optional(|s| builtin_text(s, ",", false)))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, ")", false))
        })
    })
}
#[inline]
fn parse_inherit_term(state: Input) -> Output {
    state.rule(ValkyrieRule::InheritTerm, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_annotation_mix(s).and_then(|s| s.tag_node("annotation_mix")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_type_expression(s).and_then(|s| s.tag_node("type_expression")))
        })
    })
}
#[inline]
fn parse_object_statement(state: Input) -> Output {
    state.rule(ValkyrieRule::ObjectStatement, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_kw_object(s).and_then(|s| s.tag_node("kw_object")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_define_inherit(s).and_then(|s| s.tag_node("define_inherit"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_type_hint(s).and_then(|s| s.tag_node("type_hint")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_class_block(s).and_then(|s| s.tag_node("class_block")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_eos(s)))
        })
    })
}
#[inline]
fn parse_define_enumerate(state: Input) -> Output {
    state.rule(ValkyrieRule::DefineEnumerate, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_annotation_head(s).and_then(|s| s.tag_node("annotation_head")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_kw_flags(s).and_then(|s| s.tag_node("kw_flags")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_define_inherit(s).and_then(|s| s.tag_node("define_inherit"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_type_hint(s).and_then(|s| s.tag_node("type_hint")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, "{", false))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_flag_term(s).and_then(|s| s.tag_node("flag_term")))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, "}", false))
        })
    })
}
#[inline]
fn parse_flag_term(state: Input) -> Output {
    state.rule(ValkyrieRule::FlagTerm, |s| {
        Err(s)
            .or_else(|s| parse_procedural_call(s).and_then(|s| s.tag_node("procedural_call")))
            .or_else(|s| parse_define_method(s).and_then(|s| s.tag_node("define_method")))
            .or_else(|s| parse_flag_field(s).and_then(|s| s.tag_node("flag_field")))
            .or_else(|s| parse_eos_free(s).and_then(|s| s.tag_node("eos_free")))
    })
}
#[inline]
fn parse_flag_field(state: Input) -> Output {
    state.rule(ValkyrieRule::FlagField, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_parameter_default(s).and_then(|s| s.tag_node("parameter_default")))
        })
    })
}
#[inline]
fn parse_kw_flags(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_FLAGS, |s| {
        Err(s)
            .or_else(|s| builtin_text(s, "enumerate", false).and_then(|s| s.tag_node("enum")))
            .or_else(|s| builtin_text(s, "flags", false).and_then(|s| s.tag_node("flags")))
    })
}
#[inline]
fn parse_define_union(state: Input) -> Output {
    state.rule(ValkyrieRule::DefineUnion, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| s.optional(|s| parse_define_constraint(s).and_then(|s| s.tag_node("define_constraint"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_annotation_head(s).and_then(|s| s.tag_node("annotation_head")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_kw_union(s).and_then(|s| s.tag_node("kw_union")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_define_generic(s).and_then(|s| s.tag_node("define_generic"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_define_inherit(s).and_then(|s| s.tag_node("define_inherit"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_type_hint(s).and_then(|s| s.tag_node("type_hint")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, "{", false))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_union_term(s).and_then(|s| s.tag_node("union_term")))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, "}", false))
        })
    })
}
#[inline]
fn parse_union_term(state: Input) -> Output {
    state.rule(ValkyrieRule::UnionTerm, |s| {
        Err(s)
            .or_else(|s| parse_procedural_call(s).and_then(|s| s.tag_node("procedural_call")))
            .or_else(|s| parse_define_method(s).and_then(|s| s.tag_node("define_method")))
            .or_else(|s| parse_define_variant(s).and_then(|s| s.tag_node("define_variant")))
            .or_else(|s| parse_eos_free(s).and_then(|s| s.tag_node("eos_free")))
    })
}
#[inline]
fn parse_define_variant(state: Input) -> Output {
    state.rule(ValkyrieRule::DefineVariant, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_annotation_term(s).and_then(|s| s.tag_node("annotation_term")))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_class_block(s).and_then(|s| s.tag_node("class_block"))))
        })
    })
}
#[inline]
fn parse_kw_union(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_UNION, |s| s.match_string("union", false))
}
#[inline]
fn parse_define_trait(state: Input) -> Output {
    state.rule(ValkyrieRule::DefineTrait, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| s.optional(|s| parse_define_constraint(s).and_then(|s| s.tag_node("define_constraint"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_annotation_head(s).and_then(|s| s.tag_node("annotation_head")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_kw_trait(s).and_then(|s| s.tag_node("kw_trait")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_define_generic(s).and_then(|s| s.tag_node("define_generic"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_define_inherit(s).and_then(|s| s.tag_node("define_inherit"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_type_hint(s).and_then(|s| s.tag_node("type_hint")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_trait_block(s).and_then(|s| s.tag_node("trait_block")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_eos(s)))
        })
    })
}
#[inline]
fn parse_define_extends(state: Input) -> Output {
    state.rule(ValkyrieRule::DefineExtends, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| s.optional(|s| parse_define_constraint(s).and_then(|s| s.tag_node("define_constraint"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_annotation_head(s).and_then(|s| s.tag_node("annotation_head")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_kw_extends(s).and_then(|s| s.tag_node("kw_extends")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_type_expression(s).and_then(|s| s.tag_node("type_expression")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_type_hint(s).and_then(|s| s.tag_node("type_hint")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_trait_block(s).and_then(|s| s.tag_node("trait_block")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_eos(s)))
        })
    })
}
#[inline]
fn parse_trait_block(state: Input) -> Output {
    state.rule(ValkyrieRule::TraitBlock, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| builtin_text(s, "{", false))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_trait_term(s).and_then(|s| s.tag_node("trait_term")))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, "}", false))
        })
    })
}
#[inline]
fn parse_trait_term(state: Input) -> Output {
    state.rule(ValkyrieRule::TraitTerm, |s| {
        Err(s)
            .or_else(|s| parse_procedural_call(s).and_then(|s| s.tag_node("procedural_call")))
            .or_else(|s| parse_define_method(s).and_then(|s| s.tag_node("define_method")))
            .or_else(|s| parse_define_field(s).and_then(|s| s.tag_node("define_field")))
            .or_else(|s| parse_eos_free(s).and_then(|s| s.tag_node("eos_free")))
    })
}
#[inline]
fn parse_kw_trait(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_TRAIT, |s| {
        Err(s)
            .or_else(|s| builtin_text(s, "trait", false).and_then(|s| s.tag_node("trait")))
            .or_else(|s| builtin_text(s, "interface", false).and_then(|s| s.tag_node("interface")))
    })
}
#[inline]
fn parse_define_function(state: Input) -> Output {
    state.rule(ValkyrieRule::DefineFunction, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_annotation_head(s).and_then(|s| s.tag_node("annotation_head")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_kw_function(s).and_then(|s| s.tag_node("kw_function")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_namepath(s).and_then(|s| s.tag_node("namepath")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_function_middle(s).and_then(|s| s.tag_node("function_middle")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_continuation(s).and_then(|s| s.tag_node("continuation")))
        })
    })
}
#[inline]
fn parse_define_lambda(state: Input) -> Output {
    state.rule(ValkyrieRule::DefineLambda, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_annotation_term(s).and_then(|s| s.tag_node("annotation_term")))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_kw_lambda(s).and_then(|s| s.tag_node("kw_lambda")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_function_middle(s).and_then(|s| s.tag_node("function_middle")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_continuation(s).and_then(|s| s.tag_node("continuation")))
        })
    })
}
#[inline]
fn parse_function_middle(state: Input) -> Output {
    state.rule(ValkyrieRule::FunctionMiddle, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| s.optional(|s| parse_define_generic(s).and_then(|s| s.tag_node("define_generic"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, "(", false))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_function_parameters(s).and_then(|s| s.tag_node("function_parameters")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, ")", false))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_type_return(s).and_then(|s| s.tag_node("type_return"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_type_effect(s).and_then(|s| s.tag_node("type_effect"))))
        })
    })
}
#[inline]
fn parse_type_hint(state: Input) -> Output {
    state.rule(ValkyrieRule::TypeHint, |s| {
        s.optional(|s| {
            s.sequence(|s| {
                Ok(s)
                    .and_then(|s| s.sequence(|s| Ok(s).and_then(|s| parse_colon(s)).and_then(|s| builtin_ignore(s))))
                    .and_then(|s| parse_type_expression(s).and_then(|s| s.tag_node("hint")))
            })
        })
    })
}
#[inline]
fn parse_type_return(state: Input) -> Output {
    state.rule(ValkyrieRule::TypeReturn, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_arrow_1(s).and_then(|s| s.tag_node("arrow_1")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_type_expression(s).and_then(|s| s.tag_node("type_expression")))
        })
    })
}
#[inline]
fn parse_type_effect(state: Input) -> Output {
    state.rule(ValkyrieRule::TypeEffect, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| builtin_text(s, "/", false))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_type_expression(s).and_then(|s| s.tag_node("type_expression")))
        })
    })
}
#[inline]
fn parse_function_parameters(state: Input) -> Output {
    state.rule(ValkyrieRule::FunctionParameters, |s| {
        s.optional(|s| {
            s.sequence(|s| {
                Ok(s)
                    .and_then(|s| parse_parameter_item(s).and_then(|s| s.tag_node("parameter_item")))
                    .and_then(|s| {
                        s.repeat(0..4294967295, |s| {
                            s.sequence(|s| {
                                Ok(s)
                                    .and_then(|s| builtin_ignore(s))
                                    .and_then(|s| parse_comma(s))
                                    .and_then(|s| builtin_ignore(s))
                                    .and_then(|s| parse_parameter_item(s).and_then(|s| s.tag_node("parameter_item")))
                            })
                        })
                    })
                    .and_then(|s| {
                        s.optional(|s| s.sequence(|s| Ok(s).and_then(|s| builtin_ignore(s)).and_then(|s| parse_comma(s))))
                    })
            })
        })
    })
}
#[inline]
fn parse_parameter_item(state: Input) -> Output {
    state.rule(ValkyrieRule::ParameterItem, |s| {
        Err(s)
            .or_else(|s| builtin_text(s, "<", false).and_then(|s| s.tag_node("l_mark")))
            .or_else(|s| builtin_text(s, ">", false).and_then(|s| s.tag_node("r_mark")))
            .or_else(|s| parse_parameter_pair(s).and_then(|s| s.tag_node("parameter_pair")))
            .or_else(|s| builtin_text(s, "...", false).and_then(|s| s.tag_node("omit_dict")))
            .or_else(|s| builtin_text(s, "..", false).and_then(|s| s.tag_node("omit_list")))
    })
}
#[inline]
fn parse_parameter_pair(state: Input) -> Output {
    state.rule(ValkyrieRule::ParameterPair, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_modifier_ahead(s).and_then(|s| s.tag_node("modifier_ahead")))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_parameter_hint(s).and_then(|s| s.tag_node("parameter_hint"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_type_hint(s).and_then(|s| s.tag_node("type_hint")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_parameter_default(s).and_then(|s| s.tag_node("parameter_default")))
        })
    })
}
#[inline]
fn parse_parameter_hint(state: Input) -> Output {
    state.rule(ValkyrieRule::ParameterHint, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)([.]{2,3}|[~^])").unwrap())
        })
    })
}
#[inline]
fn parse_continuation(state: Input) -> Output {
    state.rule(ValkyrieRule::Continuation, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| builtin_text(s, "{", false))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_statement(s).and_then(|s| s.tag_node("statement")))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, "}", false))
        })
    })
}
#[inline]
fn parse_kw_function(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_FUNCTION, |s| {
        Err(s)
            .or_else(|s| {
                builtin_regex(s, {
                    static REGEX: OnceLock<Regex> = OnceLock::new();
                    REGEX.get_or_init(|| Regex::new("^(?x)(micro|function)").unwrap())
                })
                .and_then(|s| s.tag_node("micro"))
            })
            .or_else(|s| {
                builtin_regex(s, {
                    static REGEX: OnceLock<Regex> = OnceLock::new();
                    REGEX.get_or_init(|| Regex::new("^(?x)(macro)").unwrap())
                })
                .and_then(|s| s.tag_node("macro"))
            })
    })
}
#[inline]
fn parse_define_variable(state: Input) -> Output {
    state.rule(ValkyrieRule::DefineVariable, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_annotation_term(s).and_then(|s| s.tag_node("annotation_term")))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_kw_let(s).and_then(|s| s.tag_node("kw_let")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_let_pattern(s).and_then(|s| s.tag_node("let_pattern")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_type_hint(s).and_then(|s| s.tag_node("type_hint")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_parameter_default(s).and_then(|s| s.tag_node("parameter_default")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_eos(s)))
        })
    })
}
#[inline]
fn parse_let_pattern(state: Input) -> Output {
    state.rule(ValkyrieRule::LetPattern, |s| {
        Err(s)
            .or_else(|s| parse_standard_pattern(s).and_then(|s| s.tag_node("standard_pattern")))
            .or_else(|s| parse_bare_pattern(s).and_then(|s| s.tag_node("bare_pattern")))
    })
}
#[inline]
fn parse_standard_pattern(state: Input) -> Output {
    state.rule(ValkyrieRule::StandardPattern, |s| {
        Err(s).or_else(|s| parse_tuple_pattern(s).and_then(|s| s.tag_node("tuple_pattern")))
    })
}
#[inline]
fn parse_bare_pattern(state: Input) -> Output {
    state.rule(ValkyrieRule::BarePattern, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_bare_pattern_item(s).and_then(|s| s.tag_node("bare_pattern_item")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s).and_then(|s| builtin_ignore(s)).and_then(|s| {
                                s.sequence(|s| {
                                    Ok(s)
                                        .and_then(|s| parse_comma(s))
                                        .and_then(|s| builtin_ignore(s))
                                        .and_then(|s| parse_bare_pattern_item(s).and_then(|s| s.tag_node("bare_pattern_item")))
                                })
                            })
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_comma(s)))
        })
    })
}
#[inline]
fn parse_bare_pattern_item(state: Input) -> Output {
    state.rule(ValkyrieRule::BarePatternItem, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_modifier_ahead(s).and_then(|s| s.tag_node("modifier_ahead")))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
        })
    })
}
#[inline]
fn parse_tuple_pattern(state: Input) -> Output {
    state.rule(ValkyrieRule::TuplePattern, |s| {
        Err(s)
            .or_else(|s| {
                s.sequence(|s| {
                    Ok(s)
                        .and_then(|s| s.optional(|s| parse_namepath(s).and_then(|s| s.tag_node("namepath"))))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| builtin_text(s, "(", false))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| {
                            s.optional(|s| {
                                s.sequence(|s| {
                                    Ok(s)
                                        .and_then(|s| parse_pattern_item(s).and_then(|s| s.tag_node("pattern_item")))
                                        .and_then(|s| builtin_ignore(s))
                                        .and_then(|s| {
                                            s.repeat(0..4294967295, |s| {
                                                s.sequence(|s| {
                                                    Ok(s).and_then(|s| builtin_ignore(s)).and_then(|s| {
                                                        s.sequence(|s| {
                                                            Ok(s)
                                                                .and_then(|s| parse_comma(s))
                                                                .and_then(|s| builtin_ignore(s))
                                                                .and_then(|s| {
                                                                    parse_pattern_item(s)
                                                                        .and_then(|s| s.tag_node("pattern_item"))
                                                                })
                                                        })
                                                    })
                                                })
                                            })
                                        })
                                        .and_then(|s| builtin_ignore(s))
                                        .and_then(|s| s.optional(|s| parse_comma(s)))
                                })
                            })
                        })
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| builtin_text(s, ")", false))
                })
            })
            .or_else(|s| {
                s.sequence(|s| {
                    Ok(s)
                        .and_then(|s| s.optional(|s| parse_namepath(s).and_then(|s| s.tag_node("namepath"))))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| builtin_text(s, "{", false))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| {
                            s.optional(|s| {
                                s.sequence(|s| {
                                    Ok(s)
                                        .and_then(|s| parse_pattern_item(s).and_then(|s| s.tag_node("pattern_item")))
                                        .and_then(|s| builtin_ignore(s))
                                        .and_then(|s| {
                                            s.repeat(0..4294967295, |s| {
                                                s.sequence(|s| {
                                                    Ok(s).and_then(|s| builtin_ignore(s)).and_then(|s| {
                                                        s.sequence(|s| {
                                                            Ok(s)
                                                                .and_then(|s| parse_comma(s))
                                                                .and_then(|s| builtin_ignore(s))
                                                                .and_then(|s| {
                                                                    parse_pattern_item(s)
                                                                        .and_then(|s| s.tag_node("pattern_item"))
                                                                })
                                                        })
                                                    })
                                                })
                                            })
                                        })
                                        .and_then(|s| builtin_ignore(s))
                                        .and_then(|s| s.optional(|s| parse_comma(s)))
                                })
                            })
                        })
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| builtin_text(s, "}", false))
                })
            })
            .or_else(|s| {
                s.sequence(|s| {
                    Ok(s)
                        .and_then(|s| builtin_text(s, "[", false))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| {
                            s.optional(|s| {
                                s.sequence(|s| {
                                    Ok(s)
                                        .and_then(|s| parse_pattern_item(s).and_then(|s| s.tag_node("pattern_item")))
                                        .and_then(|s| builtin_ignore(s))
                                        .and_then(|s| {
                                            s.repeat(0..4294967295, |s| {
                                                s.sequence(|s| {
                                                    Ok(s).and_then(|s| builtin_ignore(s)).and_then(|s| {
                                                        s.sequence(|s| {
                                                            Ok(s)
                                                                .and_then(|s| parse_comma(s))
                                                                .and_then(|s| builtin_ignore(s))
                                                                .and_then(|s| {
                                                                    parse_pattern_item(s)
                                                                        .and_then(|s| s.tag_node("pattern_item"))
                                                                })
                                                        })
                                                    })
                                                })
                                            })
                                        })
                                        .and_then(|s| builtin_ignore(s))
                                        .and_then(|s| s.optional(|s| parse_comma(s)))
                                })
                            })
                        })
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| builtin_text(s, "]", false))
                })
            })
    })
}
#[inline]
fn parse_pattern_item(state: Input) -> Output {
    state.rule(ValkyrieRule::PatternItem, |s| {
        Err(s)
            .or_else(|s| parse_tuple_pattern_item(s).and_then(|s| s.tag_node("tuple_pattern_item")))
            .or_else(|s| builtin_text(s, "...", false).and_then(|s| s.tag_node("omit_dict")))
            .or_else(|s| builtin_text(s, "..", false).and_then(|s| s.tag_node("omit_list")))
    })
}
#[inline]
fn parse_tuple_pattern_item(state: Input) -> Output {
    state.rule(ValkyrieRule::TuplePatternItem, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_annotation_mix(s).and_then(|s| s.tag_node("annotation_mix")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_parameter_hint(s).and_then(|s| s.tag_node("parameter_hint"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.optional(|s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| parse_colon(s).and_then(|s| s.tag_node("colon")))
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_standard_pattern(s).and_then(|s| s.tag_node("standard_pattern")))
                        })
                    })
                })
        })
    })
}
#[inline]
fn parse_while_statement(state: Input) -> Output {
    state.rule(ValkyrieRule::WhileStatement, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_kw_while(s).and_then(|s| s.tag_node("kw_while")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_inline_expression(s).and_then(|s| s.tag_node("inline_expression"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_continuation(s).and_then(|s| s.tag_node("continuation")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_eos(s)))
        })
    })
}
#[inline]
fn parse_kw_while(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_WHILE, |s| {
        Err(s)
            .or_else(|s| builtin_text(s, "while", false).and_then(|s| s.tag_node("while")))
            .or_else(|s| builtin_text(s, "until", false).and_then(|s| s.tag_node("until")))
    })
}
#[inline]
fn parse_for_statement(state: Input) -> Output {
    state.rule(ValkyrieRule::ForStatement, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_kw_for(s).and_then(|s| s.tag_node("kw_for")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_let_pattern(s).and_then(|s| s.tag_node("let_pattern")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_kw_in(s).and_then(|s| s.tag_node("kw_in")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_inline_expression(s).and_then(|s| s.tag_node("inline_expression"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_if_guard(s).and_then(|s| s.tag_node("if_guard")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_continuation(s).and_then(|s| s.tag_node("continuation")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_eos(s)))
        })
    })
}
#[inline]
fn parse_if_guard(state: Input) -> Output {
    state.rule(ValkyrieRule::IfGuard, |s| {
        s.optional(|s| {
            s.sequence(|s| {
                Ok(s)
                    .and_then(|s| s.sequence(|s| Ok(s).and_then(|s| parse_kw_if(s)).and_then(|s| builtin_ignore(s))))
                    .and_then(|s| parse_inline_expression(s).and_then(|s| s.tag_node("condition")))
            })
        })
    })
}
#[inline]
fn parse_control_flow(state: Input) -> Output {
    state.rule(ValkyrieRule::ControlFlow, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_annotation_term(s).and_then(|s| s.tag_node("annotation_term")))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_kw_control(s).and_then(|s| s.tag_node("kw_control")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_jump_label(s).and_then(|s| s.tag_node("jump_label")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_main_expression(s).and_then(|s| s.tag_node("main_expression"))))
        })
    })
}
#[inline]
fn parse_jump_label(state: Input) -> Output {
    state.rule(ValkyrieRule::JumpLabel, |s| {
        s.optional(|s| {
            s.sequence(|s| {
                Ok(s)
                    .and_then(|s| builtin_text(s, "^", false))
                    .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
            })
        })
    })
}
#[inline]
fn parse_expression_root(state: Input) -> Output {
    state.rule(ValkyrieRule::ExpressionRoot, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_annotation_term(s).and_then(|s| s.tag_node("annotation_term")))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_main_expression(s).and_then(|s| s.tag_node("main_expression")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_op_and_then(s).and_then(|s| s.tag_node("op_and_then"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_eos(s).and_then(|s| s.tag_node("eos"))))
        })
    })
}
#[inline]
fn parse_match_expression(state: Input) -> Output {
    state.rule(ValkyrieRule::MatchExpression, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_kw_match(s).and_then(|s| s.tag_node("kw_match")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    Err(s)
                        .or_else(|s| {
                            s.sequence(|s| {
                                Ok(s)
                                    .and_then(|s| {
                                        s.optional(|s| {
                                            s.sequence(|s| {
                                                Ok(s)
                                                    .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
                                                    .and_then(|s| builtin_ignore(s))
                                                    .and_then(|s| parse_bind_l(s).and_then(|s| s.tag_node("bind_l")))
                                            })
                                        })
                                    })
                                    .and_then(|s| builtin_ignore(s))
                                    .and_then(|s| parse_inline_expression(s).and_then(|s| s.tag_node("inline_expression")))
                            })
                        })
                        .or_else(|s| {
                            s.sequence(|s| {
                                Ok(s)
                                    .and_then(|s| parse_inline_expression(s).and_then(|s| s.tag_node("inline_expression")))
                                    .and_then(|s| builtin_ignore(s))
                                    .and_then(|s| {
                                        s.optional(|s| {
                                            s.sequence(|s| {
                                                Ok(s)
                                                    .and_then(|s| parse_bind_r(s).and_then(|s| s.tag_node("bind_r")))
                                                    .and_then(|s| builtin_ignore(s))
                                                    .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
                                            })
                                        })
                                    })
                            })
                        })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_match_block(s).and_then(|s| s.tag_node("match_block")))
        })
    })
}
#[inline]
fn parse_switch_statement(state: Input) -> Output {
    state.rule(ValkyrieRule::SwitchStatement, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_kw_switch(s).and_then(|s| s.tag_node("kw_switch")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_match_block(s).and_then(|s| s.tag_node("match_block")))
        })
    })
}
#[inline]
fn parse_match_block(state: Input) -> Output {
    state.rule(ValkyrieRule::MatchBlock, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| builtin_text(s, "{", false))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_match_terms(s).and_then(|s| s.tag_node("match_terms")))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, "}", false))
        })
    })
}
#[inline]
fn parse_match_terms(state: Input) -> Output {
    state.rule(ValkyrieRule::MatchTerms, |s| {
        Err(s)
            .or_else(|s| parse_match_type(s).and_then(|s| s.tag_node("match_type")))
            .or_else(|s| parse_match_case(s).and_then(|s| s.tag_node("match_case")))
            .or_else(|s| parse_match_when(s).and_then(|s| s.tag_node("match_when")))
            .or_else(|s| parse_match_else(s).and_then(|s| s.tag_node("match_else")))
            .or_else(|s| parse_comma(s).and_then(|s| s.tag_node("comma")))
    })
}
#[inline]
fn parse_match_type(state: Input) -> Output {
    state.rule(ValkyrieRule::MatchType, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_kw_type(s).and_then(|s| s.tag_node("kw_type")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_type_expression(s).and_then(|s| s.tag_node("type_expression")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_if_guard(s).and_then(|s| s.tag_node("if_guard")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_colon(s))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_match_statement(s).and_then(|s| s.tag_node("match_statement")))
                        })
                    })
                })
        })
    })
}
#[inline]
fn parse_match_case(state: Input) -> Output {
    state.rule(ValkyrieRule::MatchCase, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_kw_case(s).and_then(|s| s.tag_node("kw_case")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_case_pattern(s).and_then(|s| s.tag_node("case_pattern")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_if_guard(s).and_then(|s| s.tag_node("if_guard")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_colon(s))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_match_statement(s).and_then(|s| s.tag_node("match_statement")))
                        })
                    })
                })
        })
    })
}
#[inline]
fn parse_case_pattern(state: Input) -> Output {
    state.rule(ValkyrieRule::CasePattern, |s| {
        Err(s)
            .or_else(|s| parse_standard_pattern(s).and_then(|s| s.tag_node("standard_pattern")))
            .or_else(|s| parse_namepath(s).and_then(|s| s.tag_node("namepath")))
    })
}
#[inline]
fn parse_match_when(state: Input) -> Output {
    state.rule(ValkyrieRule::MatchWhen, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_kw_when(s).and_then(|s| s.tag_node("kw_when")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_inline_expression(s).and_then(|s| s.tag_node("inline_expression")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_colon(s))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_match_statement(s).and_then(|s| s.tag_node("match_statement")))
                        })
                    })
                })
        })
    })
}
#[inline]
fn parse_match_else(state: Input) -> Output {
    state.rule(ValkyrieRule::MatchElse, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_kw_else(s).and_then(|s| s.tag_node("kw_else")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_colon(s))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_match_statement(s).and_then(|s| s.tag_node("match_statement")))
                        })
                    })
                })
        })
    })
}
#[inline]
fn parse_match_statement(state: Input) -> Output {
    state.rule(ValkyrieRule::MatchStatement, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| {
                    s.lookahead(false, |s| {
                        builtin_regex(s, {
                            static REGEX: OnceLock<Regex> = OnceLock::new();
                            REGEX.get_or_init(|| Regex::new("^(?x)(type|case|when|else|[,,])").unwrap())
                        })
                    })
                })
                .and_then(|s| parse_statement(s).and_then(|s| s.tag_node("statement")))
        })
    })
}
#[inline]
fn parse_kw_match(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_MATCH, |s| {
        Err(s)
            .or_else(|s| builtin_text(s, "match", false).and_then(|s| s.tag_node("match")))
            .or_else(|s| builtin_text(s, "catch", false).and_then(|s| s.tag_node("catch")))
    })
}
#[inline]
fn parse_bind_l(state: Input) -> Output {
    state.rule(ValkyrieRule::BIND_L, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)(≔|:=)").unwrap())
        })
    })
}
#[inline]
fn parse_bind_r(state: Input) -> Output {
    state.rule(ValkyrieRule::BIND_R, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)(≕|=:)").unwrap())
        })
    })
}
#[inline]
fn parse_dot_match_call(state: Input) -> Output {
    state.rule(ValkyrieRule::DotMatchCall, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| s.optional(|s| parse_op_and_then(s).and_then(|s| s.tag_node("op_and_then"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_dot(s))
                .and_then(|s| s.optional(|s| parse_white_space(s)))
                .and_then(|s| parse_kw_match(s).and_then(|s| s.tag_node("kw_match")))
                .and_then(|s| {
                    s.optional(|s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| s.optional(|s| parse_white_space(s)))
                                .and_then(|s| parse_bind_r(s).and_then(|s| s.tag_node("bind_r")))
                                .and_then(|s| s.optional(|s| parse_white_space(s)))
                                .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
                        })
                    })
                })
                .and_then(|s| s.optional(|s| parse_white_space(s)))
                .and_then(|s| parse_match_block(s).and_then(|s| s.tag_node("match_block")))
        })
    })
}
#[inline]
fn parse_main_expression(state: Input) -> Output {
    state.rule(ValkyrieRule::MainExpression, |s| {
        s.sequence(|s| {
            Ok(s).and_then(|s| parse_main_term(s).and_then(|s| s.tag_node("main_term"))).and_then(|s| {
                s.repeat(0..4294967295, |s| {
                    s.sequence(|s| {
                        Ok(s)
                            .and_then(|s| builtin_ignore(s))
                            .and_then(|s| parse_main_infix(s).and_then(|s| s.tag_node("main_infix")))
                            .and_then(|s| builtin_ignore(s))
                            .and_then(|s| parse_main_term(s).and_then(|s| s.tag_node("main_term")))
                    })
                })
            })
        })
    })
}
#[inline]
fn parse_main_term(state: Input) -> Output {
    state.rule(ValkyrieRule::MainTerm, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| parse_main_prefix(s).and_then(|s| s.tag_node("main_prefix")))
                                .and_then(|s| builtin_ignore(s))
                        })
                    })
                })
                .and_then(|s| parse_main_factor(s).and_then(|s| s.tag_node("main_factor")))
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| parse_main_suffix_term(s).and_then(|s| s.tag_node("main_suffix_term")))
                })
        })
    })
}
#[inline]
fn parse_main_factor(state: Input) -> Output {
    state.rule(ValkyrieRule::MainFactor, |s| {
        Err(s)
            .or_else(|s| parse_switch_statement(s).and_then(|s| s.tag_node("switch_statement")))
            .or_else(|s| parse_try_statement(s).and_then(|s| s.tag_node("try_statement")))
            .or_else(|s| parse_match_expression(s).and_then(|s| s.tag_node("match_expression")))
            .or_else(|s| parse_define_lambda(s).and_then(|s| s.tag_node("define_lambda")))
            .or_else(|s| parse_object_statement(s).and_then(|s| s.tag_node("object_statement")))
            .or_else(|s| parse_new_statement(s).and_then(|s| s.tag_node("new_statement")))
            .or_else(|s| parse_group_factor(s).and_then(|s| s.tag_node("group_factor")))
            .or_else(|s| parse_leading(s).and_then(|s| s.tag_node("leading")))
    })
}
#[inline]
fn parse_group_factor(state: Input) -> Output {
    state.rule(ValkyrieRule::GroupFactor, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| builtin_text(s, "(", false))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_main_expression(s).and_then(|s| s.tag_node("main_expression")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, ")", false))
        })
    })
}
#[inline]
fn parse_leading(state: Input) -> Output {
    state.rule(ValkyrieRule::Leading, |s| {
        Err(s)
            .or_else(|s| parse_procedural_call(s).and_then(|s| s.tag_node("procedural_call")))
            .or_else(|s| parse_tuple_literal_strict(s).and_then(|s| s.tag_node("tuple_literal_strict")))
            .or_else(|s| parse_range_literal(s).and_then(|s| s.tag_node("range_literal")))
            .or_else(|s| parse_text_literal(s).and_then(|s| s.tag_node("text_literal")))
            .or_else(|s| parse_slot(s).and_then(|s| s.tag_node("slot")))
            .or_else(|s| parse_number(s).and_then(|s| s.tag_node("number")))
            .or_else(|s| parse_special(s).and_then(|s| s.tag_node("special")))
            .or_else(|s| parse_namepath(s).and_then(|s| s.tag_node("namepath")))
    })
}
#[inline]
fn parse_main_suffix_term(state: Input) -> Output {
    state.rule(ValkyrieRule::MainSuffixTerm, |s| {
        Err(s)
            .or_else(|s| {
                s.sequence(|s| {
                    Ok(s)
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| parse_dot_match_call(s).and_then(|s| s.tag_node("dot_match_call")))
                })
                .and_then(|s| s.tag_node("dot_match_call"))
            })
            .or_else(|s| {
                s.sequence(|s| {
                    Ok(s)
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| parse_dot_closure_call(s).and_then(|s| s.tag_node("dot_closure_call")))
                })
                .and_then(|s| s.tag_node("dot_closure_call"))
            })
            .or_else(|s| parse_tuple_call(s).and_then(|s| s.tag_node("tuple_call")))
            .or_else(|s| parse_inline_suffix_term(s).and_then(|s| s.tag_node("inline_suffix_term")))
    })
}
#[inline]
fn parse_main_prefix(state: Input) -> Output {
    state.rule(ValkyrieRule::MainPrefix, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| {
                Regex::new(
                    "^(?x)([¬!+]
    | [-]
    | [.]{2,3}
    | [⅟]
    | [√∛∜]
    | [&*])",
                )
                .unwrap()
            })
        })
    })
}
#[inline]
fn parse_type_prefix(state: Input) -> Output {
    state.rule(ValkyrieRule::TypePrefix, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| {
                Regex::new(
                    "^(?x)([-+¬]
    | [~&])",
                )
                .unwrap()
            })
        })
    })
}
#[inline]
fn parse_main_infix(state: Input) -> Output {
    state.rule(ValkyrieRule::MainInfix, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| {
                Regex::new(
                    "^(?x)([+\\-*٪⁒÷/%]=?
    | /%=? | %%=?
    | [√^]
    # start with ?, !, =
    | [?]=
    | !==|=!=|===|==|!=|=|[!≢≠≡]
    # start with `<, >`
    | <<<|<<=|<<|<=|[⋘≪⩽≤<]
    | >>>|>>=|>>|>=|[⋙≫⩾≥>]
    # start with &, |
    | [&|]{1,3}
    | [∧⊼⩟∨⊽⊻]
    # start with .
    | [.]{1,2}[<=]
    | [.]=
    | [∈∊∉∋∍∌]
    | (not\\s+)?in
    | is(\\s+not)?
    # map, apply
    | /@ | [⇴⨵⊕⟴] | @{2,3})",
                )
                .unwrap()
            })
        })
    })
}
#[inline]
fn parse_type_infix(state: Input) -> Output {
    state.rule(ValkyrieRule::TypeInfix, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| {
                Regex::new(
                    "^(?x)([⟶]
    | ->
    | [-+&|∧∨])",
                )
                .unwrap()
            })
        })
    })
}
#[inline]
fn parse_main_suffix(state: Input) -> Output {
    state.rule(ValkyrieRule::MainSuffix, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| {
                Regex::new(
                    "^(?x)([!]
    | [٪⁒%‰‱]
    | [′″‴⁗]
    | [℃℉])",
                )
                .unwrap()
            })
        })
    })
}
#[inline]
fn parse_type_suffix(state: Input) -> Output {
    state.rule(ValkyrieRule::TypeSuffix, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)([!?])").unwrap())
        })
    })
}
#[inline]
fn parse_inline_expression(state: Input) -> Output {
    state.rule(ValkyrieRule::InlineExpression, |s| {
        s.sequence(|s| {
            Ok(s).and_then(|s| parse_inline_term(s).and_then(|s| s.tag_node("inline_term"))).and_then(|s| {
                s.repeat(0..4294967295, |s| {
                    s.sequence(|s| {
                        Ok(s)
                            .and_then(|s| builtin_ignore(s))
                            .and_then(|s| parse_main_infix(s).and_then(|s| s.tag_node("main_infix")))
                            .and_then(|s| builtin_ignore(s))
                            .and_then(|s| parse_inline_term(s).and_then(|s| s.tag_node("inline_term")))
                    })
                })
            })
        })
    })
}
#[inline]
fn parse_inline_term(state: Input) -> Output {
    state.rule(ValkyrieRule::InlineTerm, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| parse_main_prefix(s).and_then(|s| s.tag_node("main_prefix")))
                                .and_then(|s| builtin_ignore(s))
                        })
                    })
                })
                .and_then(|s| parse_main_factor(s).and_then(|s| s.tag_node("main_factor")))
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| parse_inline_suffix_term(s).and_then(|s| s.tag_node("inline_suffix_term")))
                })
        })
    })
}
#[inline]
fn parse_inline_suffix_term(state: Input) -> Output {
    state.rule(ValkyrieRule::InlineSuffixTerm, |s| {
        Err(s)
            .or_else(|s| {
                s.sequence(|s| {
                    Ok(s)
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| parse_main_suffix(s).and_then(|s| s.tag_node("main_suffix")))
                })
                .and_then(|s| s.tag_node("main_suffix"))
            })
            .or_else(|s| {
                s.sequence(|s| {
                    Ok(s)
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| parse_dot_call(s).and_then(|s| s.tag_node("dot_call")))
                })
                .and_then(|s| s.tag_node("dot_call"))
            })
            .or_else(|s| parse_inline_tuple_call(s).and_then(|s| s.tag_node("inline_tuple_call")))
            .or_else(|s| parse_range_call(s).and_then(|s| s.tag_node("range_call")))
            .or_else(|s| parse_generic_call(s).and_then(|s| s.tag_node("generic_call")))
    })
}
#[inline]
fn parse_type_expression(state: Input) -> Output {
    state.rule(ValkyrieRule::TypeExpression, |s| {
        s.sequence(|s| {
            Ok(s).and_then(|s| parse_type_term(s).and_then(|s| s.tag_node("type_term"))).and_then(|s| {
                s.repeat(0..4294967295, |s| {
                    s.sequence(|s| {
                        Ok(s)
                            .and_then(|s| builtin_ignore(s))
                            .and_then(|s| parse_type_infix(s).and_then(|s| s.tag_node("type_infix")))
                            .and_then(|s| builtin_ignore(s))
                            .and_then(|s| parse_type_term(s).and_then(|s| s.tag_node("type_term")))
                    })
                })
            })
        })
    })
}
#[inline]
fn parse_type_term(state: Input) -> Output {
    state.rule(ValkyrieRule::TypeTerm, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| parse_type_prefix(s).and_then(|s| s.tag_node("type_prefix")))
                                .and_then(|s| builtin_ignore(s))
                        })
                    })
                })
                .and_then(|s| parse_main_factor(s).and_then(|s| s.tag_node("main_factor")))
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| parse_type_suffix_term(s).and_then(|s| s.tag_node("type_suffix_term")))
                })
        })
    })
}
#[inline]
fn parse_type_factor(state: Input) -> Output {
    state.rule(ValkyrieRule::TypeFactor, |s| {
        Err(s)
            .or_else(|s| {
                s.sequence(|s| {
                    Ok(s)
                        .and_then(|s| builtin_text(s, "(", false))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| parse_type_expression(s).and_then(|s| s.tag_node("type_expression")))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| builtin_text(s, ")", false))
                })
                .and_then(|s| s.tag_node("type_expression"))
            })
            .or_else(|s| parse_leading(s).and_then(|s| s.tag_node("leading")))
    })
}
#[inline]
fn parse_type_suffix_term(state: Input) -> Output {
    state.rule(ValkyrieRule::TypeSuffixTerm, |s| {
        Err(s)
            .or_else(|s| parse_generic_hide(s).and_then(|s| s.tag_node("generic_hide")))
            .or_else(|s| parse_type_suffix(s).and_then(|s| s.tag_node("type_suffix")))
    })
}
#[inline]
fn parse_try_statement(state: Input) -> Output {
    state.rule(ValkyrieRule::TryStatement, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_kw_try(s).and_then(|s| s.tag_node("kw_try")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_type_expression(s).and_then(|s| s.tag_node("type_expression"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_continuation(s).and_then(|s| s.tag_node("continuation")))
        })
    })
}
#[inline]
fn parse_new_statement(state: Input) -> Output {
    state.rule(ValkyrieRule::NewStatement, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_kw_new(s).and_then(|s| s.tag_node("kw_new")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_modifier_ahead(s).and_then(|s| s.tag_node("modifier_ahead")))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_namepath(s).and_then(|s| s.tag_node("namepath")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_generic_hide(s).and_then(|s| s.tag_node("generic_hide"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_tuple_literal(s).and_then(|s| s.tag_node("tuple_literal"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_new_block(s).and_then(|s| s.tag_node("new_block"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_eos(s)))
        })
    })
}
#[inline]
fn parse_new_block(state: Input) -> Output {
    state.rule(ValkyrieRule::NewBlock, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| builtin_text(s, "{", false))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.optional(|s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| parse_new_pair(s).and_then(|s| s.tag_node("new_pair")))
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| {
                                    s.repeat(0..4294967295, |s| {
                                        s.sequence(|s| {
                                            Ok(s).and_then(|s| builtin_ignore(s)).and_then(|s| {
                                                s.sequence(|s| {
                                                    Ok(s)
                                                        .and_then(|s| parse_eos_free(s).and_then(|s| s.tag_node("eos_free")))
                                                        .and_then(|s| builtin_ignore(s))
                                                        .and_then(|s| parse_new_pair(s).and_then(|s| s.tag_node("new_pair")))
                                                })
                                            })
                                        })
                                    })
                                })
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| s.optional(|s| parse_eos_free(s).and_then(|s| s.tag_node("eos_free"))))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, "}", false))
        })
    })
}
#[inline]
fn parse_new_pair(state: Input) -> Output {
    state.rule(ValkyrieRule::NewPair, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| {
                    s.optional(|s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| parse_new_pair_key(s).and_then(|s| s.tag_node("new_pair_key")))
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_colon(s).and_then(|s| s.tag_node("colon")))
                                .and_then(|s| builtin_ignore(s))
                        })
                    })
                })
                .and_then(|s| parse_main_expression(s).and_then(|s| s.tag_node("main_expression")))
        })
    })
}
#[inline]
fn parse_new_pair_key(state: Input) -> Output {
    state.rule(ValkyrieRule::NewPairKey, |s| {
        Err(s)
            .or_else(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
            .or_else(|s| parse_text_raw(s).and_then(|s| s.tag_node("text_raw")))
            .or_else(|s| parse_range_literal(s).and_then(|s| s.tag_node("range_literal")))
    })
}
#[inline]
fn parse_dot_call(state: Input) -> Output {
    state.rule(ValkyrieRule::DotCall, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| s.optional(|s| parse_op_and_then(s).and_then(|s| s.tag_node("op_and_then"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_dot(s))
                .and_then(|s| s.optional(|s| parse_white_space(s)))
                .and_then(|s| parse_dot_call_item(s).and_then(|s| s.tag_node("dot_call_item")))
        })
    })
}
#[inline]
fn parse_dot_call_item(state: Input) -> Output {
    state.rule(ValkyrieRule::DotCallItem, |s| {
        Err(s)
            .or_else(|s| parse_namepath(s).and_then(|s| s.tag_node("namepath")))
            .or_else(|s| parse_integer(s).and_then(|s| s.tag_node("integer")))
    })
}
#[inline]
fn parse_dot_closure_call(state: Input) -> Output {
    state.rule(ValkyrieRule::DotClosureCall, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| s.optional(|s| parse_op_and_then(s).and_then(|s| s.tag_node("op_and_then"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_dot(s))
                .and_then(|s| s.optional(|s| parse_white_space(s)))
                .and_then(|s| parse_continuation(s).and_then(|s| s.tag_node("continuation")))
        })
    })
}
#[inline]
fn parse_inline_tuple_call(state: Input) -> Output {
    state.rule(ValkyrieRule::InlineTupleCall, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| s.optional(|s| parse_white_space(s)))
                .and_then(|s| s.optional(|s| parse_op_and_then(s).and_then(|s| s.tag_node("op_and_then"))))
                .and_then(|s| s.optional(|s| parse_white_space(s)))
                .and_then(|s| parse_tuple_literal(s).and_then(|s| s.tag_node("tuple_literal")))
        })
    })
}
#[inline]
fn parse_tuple_call(state: Input) -> Output {
    state.rule(ValkyrieRule::TupleCall, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| s.optional(|s| parse_white_space(s)))
                .and_then(|s| s.optional(|s| parse_op_and_then(s).and_then(|s| s.tag_node("op_and_then"))))
                .and_then(|s| s.optional(|s| parse_white_space(s)))
                .and_then(|s| {
                    Err(s)
                        .or_else(|s| {
                            s.sequence(|s| {
                                Ok(s).and_then(|s| parse_tuple_literal(s).and_then(|s| s.tag_node("tuple_literal"))).and_then(
                                    |s| {
                                        s.optional(|s| {
                                            s.sequence(|s| {
                                                Ok(s).and_then(|s| s.optional(|s| parse_white_space(s))).and_then(|s| {
                                                    parse_continuation(s).and_then(|s| s.tag_node("continuation"))
                                                })
                                            })
                                        })
                                    },
                                )
                            })
                        })
                        .or_else(|s| parse_continuation(s).and_then(|s| s.tag_node("continuation")))
                })
        })
    })
}
#[inline]
fn parse_tuple_literal(state: Input) -> Output {
    state.rule(ValkyrieRule::TupleLiteral, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| builtin_text(s, "(", false))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_tuple_terms(s).and_then(|s| s.tag_node("tuple_terms")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, ")", false))
        })
    })
}
#[inline]
fn parse_tuple_literal_strict(state: Input) -> Output {
    state.rule(ValkyrieRule::TupleLiteralStrict, |s| {
        Err(s)
            .or_else(|s| {
                s.sequence(|s| {
                    Ok(s)
                        .and_then(|s| builtin_text(s, "(", false))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| builtin_text(s, ")", false))
                })
            })
            .or_else(|s| {
                s.sequence(|s| {
                    Ok(s)
                        .and_then(|s| builtin_text(s, "(", false))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| parse_tuple_pair(s).and_then(|s| s.tag_node("tuple_pair")))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| parse_comma(s))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| builtin_text(s, ")", false))
                })
            })
            .or_else(|s| {
                s.sequence(|s| {
                    Ok(s)
                        .and_then(|s| builtin_text(s, "(", false))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| parse_tuple_pair(s).and_then(|s| s.tag_node("tuple_pair")))
                        .and_then(|s| {
                            s.repeat(0..4294967295, |s| {
                                s.sequence(|s| {
                                    Ok(s)
                                        .and_then(|s| builtin_ignore(s))
                                        .and_then(|s| parse_comma(s))
                                        .and_then(|s| builtin_ignore(s))
                                        .and_then(|s| parse_tuple_pair(s).and_then(|s| s.tag_node("tuple_pair")))
                                })
                            })
                        })
                        .and_then(|s| {
                            s.optional(|s| s.sequence(|s| Ok(s).and_then(|s| builtin_ignore(s)).and_then(|s| parse_comma(s))))
                        })
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| builtin_text(s, ")", false))
                })
            })
    })
}
#[inline]
fn parse_tuple_terms(state: Input) -> Output {
    state.rule(ValkyrieRule::TupleTerms, |s| {
        s.optional(|s| {
            s.sequence(|s| {
                Ok(s)
                    .and_then(|s| parse_tuple_pair(s).and_then(|s| s.tag_node("tuple_pair")))
                    .and_then(|s| {
                        s.repeat(0..4294967295, |s| {
                            s.sequence(|s| {
                                Ok(s)
                                    .and_then(|s| builtin_ignore(s))
                                    .and_then(|s| parse_comma(s))
                                    .and_then(|s| builtin_ignore(s))
                                    .and_then(|s| parse_tuple_pair(s).and_then(|s| s.tag_node("tuple_pair")))
                            })
                        })
                    })
                    .and_then(|s| {
                        s.optional(|s| s.sequence(|s| Ok(s).and_then(|s| builtin_ignore(s)).and_then(|s| parse_comma(s))))
                    })
            })
        })
    })
}
#[inline]
fn parse_tuple_pair(state: Input) -> Output {
    state.rule(ValkyrieRule::TuplePair, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| {
                    s.optional(|s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| parse_tuple_key(s).and_then(|s| s.tag_node("tuple_key")))
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_colon(s).and_then(|s| s.tag_node("colon")))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_main_expression(s).and_then(|s| s.tag_node("main_expression")))
        })
    })
}
#[inline]
fn parse_tuple_key(state: Input) -> Output {
    state.rule(ValkyrieRule::TupleKey, |s| {
        Err(s)
            .or_else(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
            .or_else(|s| parse_integer(s).and_then(|s| s.tag_node("integer")))
            .or_else(|s| parse_text_raw(s).and_then(|s| s.tag_node("text_raw")))
    })
}
#[inline]
fn parse_range_call(state: Input) -> Output {
    state.rule(ValkyrieRule::RangeCall, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| s.optional(|s| parse_white_space(s)))
                .and_then(|s| s.optional(|s| parse_op_and_then(s).and_then(|s| s.tag_node("op_and_then"))))
                .and_then(|s| s.optional(|s| parse_white_space(s)))
                .and_then(|s| parse_range_literal(s).and_then(|s| s.tag_node("range_literal")))
        })
    })
}
#[inline]
fn parse_range_literal(state: Input) -> Output {
    state.rule(ValkyrieRule::RangeLiteral, |s| {
        Err(s)
            .or_else(|s| parse_range_literal_index_0(s).and_then(|s| s.tag_node("range_literal_index_0")))
            .or_else(|s| parse_range_literal_index_1(s).and_then(|s| s.tag_node("range_literal_index_1")))
    })
}
#[inline]
fn parse_range_literal_index_0(state: Input) -> Output {
    state.rule(ValkyrieRule::RangeLiteralIndex0, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| builtin_text(s, "", false))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.optional(|s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| parse_subscript_axis(s).and_then(|s| s.tag_node("subscript_axis")))
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| {
                                    s.repeat(0..4294967295, |s| {
                                        s.sequence(|s| {
                                            Ok(s).and_then(|s| builtin_ignore(s)).and_then(|s| {
                                                s.sequence(|s| {
                                                    Ok(s).and_then(|s| parse_comma(s)).and_then(|s| builtin_ignore(s)).and_then(
                                                        |s| parse_subscript_axis(s).and_then(|s| s.tag_node("subscript_axis")),
                                                    )
                                                })
                                            })
                                        })
                                    })
                                })
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| s.optional(|s| parse_comma(s)))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, "", false))
        })
    })
}
#[inline]
fn parse_range_literal_index_1(state: Input) -> Output {
    state.rule(ValkyrieRule::RangeLiteralIndex1, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| builtin_text(s, "[", false))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.optional(|s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| parse_subscript_axis(s).and_then(|s| s.tag_node("subscript_axis")))
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| {
                                    s.repeat(0..4294967295, |s| {
                                        s.sequence(|s| {
                                            Ok(s).and_then(|s| builtin_ignore(s)).and_then(|s| {
                                                s.sequence(|s| {
                                                    Ok(s).and_then(|s| parse_comma(s)).and_then(|s| builtin_ignore(s)).and_then(
                                                        |s| parse_subscript_axis(s).and_then(|s| s.tag_node("subscript_axis")),
                                                    )
                                                })
                                            })
                                        })
                                    })
                                })
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| s.optional(|s| parse_comma(s)))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, "]", false))
        })
    })
}
#[inline]
fn parse_subscript_axis(state: Input) -> Output {
    state.rule(ValkyrieRule::SubscriptAxis, |s| {
        Err(s)
            .or_else(|s| parse_subscript_range(s).and_then(|s| s.tag_node("subscript_range")))
            .or_else(|s| parse_subscript_only(s).and_then(|s| s.tag_node("subscript_only")))
    })
}
#[inline]
fn parse_subscript_only(state: Input) -> Output {
    state.rule(ValkyrieRule::SubscriptOnly, |s| parse_main_expression(s).and_then(|s| s.tag_node("index")))
}
#[inline]
fn parse_subscript_range(state: Input) -> Output {
    state.rule(ValkyrieRule::SubscriptRange, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| {
                    s.optional(|s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| parse_main_expression(s).and_then(|s| s.tag_node("head")))
                                .and_then(|s| builtin_ignore(s))
                        })
                    })
                })
                .and_then(|s| {
                    Err(s)
                        .or_else(|s| {
                            s.sequence(|s| {
                                Ok(s).and_then(|s| parse_range_omit(s)).and_then(|s| {
                                    s.optional(|s| {
                                        s.sequence(|s| {
                                            Ok(s)
                                                .and_then(|s| builtin_ignore(s))
                                                .and_then(|s| parse_main_expression(s).and_then(|s| s.tag_node("step")))
                                        })
                                    })
                                })
                            })
                        })
                        .or_else(|s| {
                            s.sequence(|s| {
                                Ok(s).and_then(|s| parse_colon(s)).and_then(|s| {
                                    s.optional(|s| {
                                        s.sequence(|s| {
                                            Ok(s)
                                                .and_then(|s| builtin_ignore(s))
                                                .and_then(|s| parse_main_expression(s).and_then(|s| s.tag_node("tail")))
                                                .and_then(|s| {
                                                    s.optional(|s| {
                                                        s.sequence(|s| {
                                                            Ok(s)
                                                                .and_then(|s| builtin_ignore(s))
                                                                .and_then(|s| parse_colon(s))
                                                                .and_then(|s| {
                                                                    s.optional(|s| {
                                                                        s.sequence(|s| {
                                                                            Ok(s).and_then(|s| builtin_ignore(s)).and_then(
                                                                                |s| {
                                                                                    parse_main_expression(s)
                                                                                        .and_then(|s| s.tag_node("step"))
                                                                                },
                                                                            )
                                                                        })
                                                                    })
                                                                })
                                                        })
                                                    })
                                                })
                                        })
                                    })
                                })
                            })
                        })
                })
        })
    })
}
#[inline]
fn parse_range_omit(state: Input) -> Output {
    state.rule(ValkyrieRule::RangeOmit, |s| {
        Err(s).or_else(|s| parse_proportion(s).and_then(|s| s.tag_node("proportion"))).or_else(|s| {
            s.sequence(|s| {
                Ok(s)
                    .and_then(|s| parse_colon(s).and_then(|s| s.tag_node("colon")))
                    .and_then(|s| builtin_ignore(s))
                    .and_then(|s| parse_colon(s).and_then(|s| s.tag_node("colon")))
            })
        })
    })
}
#[inline]
fn parse_define_generic(state: Input) -> Output {
    state.rule(ValkyrieRule::DefineGeneric, |s| {
        Err(s)
            .or_else(|s| {
                s.sequence(|s| {
                    Ok(s)
                        .and_then(|s| s.optional(|s| parse_proportion(s).and_then(|s| s.tag_node("proportion"))))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| builtin_text(s, "<", false))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| parse_generic_parameter(s).and_then(|s| s.tag_node("generic_parameter")))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| builtin_text(s, ">", false))
                })
            })
            .or_else(|s| {
                s.sequence(|s| {
                    Ok(s)
                        .and_then(|s| builtin_text(s, "", false))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| parse_generic_parameter(s).and_then(|s| s.tag_node("generic_parameter")))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| builtin_text(s, "", false))
                })
            })
    })
}
#[inline]
fn parse_generic_parameter(state: Input) -> Output {
    state.rule(ValkyrieRule::GenericParameter, |s| {
        s.optional(|s| {
            s.sequence(|s| {
                Ok(s)
                    .and_then(|s| parse_generic_parameter_pair(s).and_then(|s| s.tag_node("generic_parameter_pair")))
                    .and_then(|s| {
                        s.repeat(0..4294967295, |s| {
                            s.sequence(|s| {
                                Ok(s)
                                    .and_then(|s| builtin_ignore(s))
                                    .and_then(|s| parse_comma(s))
                                    .and_then(|s| builtin_ignore(s))
                                    .and_then(|s| {
                                        parse_generic_parameter_pair(s).and_then(|s| s.tag_node("generic_parameter_pair"))
                                    })
                            })
                        })
                    })
                    .and_then(|s| {
                        s.optional(|s| s.sequence(|s| Ok(s).and_then(|s| builtin_ignore(s)).and_then(|s| parse_comma(s))))
                    })
            })
        })
    })
}
#[inline]
fn parse_generic_parameter_pair(state: Input) -> Output {
    state.rule(ValkyrieRule::GenericParameterPair, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.optional(|s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| {
                                    s.sequence(|s| Ok(s).and_then(|s| parse_colon(s)).and_then(|s| builtin_ignore(s)))
                                })
                                .and_then(|s| parse_type_expression(s).and_then(|s| s.tag_node("bound")))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.optional(|s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| {
                                    s.sequence(|s| {
                                        Ok(s).and_then(|s| builtin_text(s, "=", false)).and_then(|s| builtin_ignore(s))
                                    })
                                })
                                .and_then(|s| parse_type_expression(s).and_then(|s| s.tag_node("default")))
                        })
                    })
                })
        })
    })
}
#[inline]
fn parse_generic_call(state: Input) -> Output {
    state.rule(ValkyrieRule::GenericCall, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| s.optional(|s| parse_op_and_then(s).and_then(|s| s.tag_node("op_and_then"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    Err(s)
                        .or_else(|s| {
                            s.sequence(|s| {
                                Ok(s)
                                    .and_then(|s| parse_proportion(s).and_then(|s| s.tag_node("proportion")))
                                    .and_then(|s| builtin_ignore(s))
                                    .and_then(|s| builtin_text(s, "<", false))
                                    .and_then(|s| builtin_ignore(s))
                                    .and_then(|s| parse_generic_terms(s).and_then(|s| s.tag_node("generic_terms")))
                                    .and_then(|s| builtin_ignore(s))
                                    .and_then(|s| builtin_text(s, ">", false))
                            })
                        })
                        .or_else(|s| {
                            s.sequence(|s| {
                                Ok(s)
                                    .and_then(|s| builtin_text(s, "", false))
                                    .and_then(|s| builtin_ignore(s))
                                    .and_then(|s| parse_generic_terms(s).and_then(|s| s.tag_node("generic_terms")))
                                    .and_then(|s| builtin_ignore(s))
                                    .and_then(|s| builtin_text(s, "", false))
                            })
                        })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.optional(|s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| parse_proportion(s).and_then(|s| s.tag_node("proportion")))
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_namepath(s).and_then(|s| s.tag_node("namepath")))
                        })
                    })
                })
        })
    })
}
#[inline]
fn parse_generic_hide(state: Input) -> Output {
    state.rule(ValkyrieRule::GenericHide, |s| {
        Err(s)
            .or_else(|s| {
                s.sequence(|s| {
                    Ok(s)
                        .and_then(|s| s.optional(|s| parse_proportion(s).and_then(|s| s.tag_node("proportion"))))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| builtin_text(s, "<", false))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| parse_generic_terms(s).and_then(|s| s.tag_node("generic_terms")))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| builtin_text(s, ">", false))
                })
            })
            .or_else(|s| {
                s.sequence(|s| {
                    Ok(s)
                        .and_then(|s| builtin_text(s, "", false))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| parse_generic_terms(s).and_then(|s| s.tag_node("generic_terms")))
                        .and_then(|s| builtin_ignore(s))
                        .and_then(|s| builtin_text(s, "", false))
                })
            })
    })
}
#[inline]
fn parse_generic_terms(state: Input) -> Output {
    state.rule(ValkyrieRule::GenericTerms, |s| {
        s.optional(|s| {
            s.sequence(|s| {
                Ok(s)
                    .and_then(|s| parse_generic_pair(s).and_then(|s| s.tag_node("generic_pair")))
                    .and_then(|s| {
                        s.repeat(0..4294967295, |s| {
                            s.sequence(|s| {
                                Ok(s)
                                    .and_then(|s| builtin_ignore(s))
                                    .and_then(|s| parse_comma(s))
                                    .and_then(|s| builtin_ignore(s))
                                    .and_then(|s| parse_generic_pair(s).and_then(|s| s.tag_node("generic_pair")))
                            })
                        })
                    })
                    .and_then(|s| {
                        s.optional(|s| s.sequence(|s| Ok(s).and_then(|s| builtin_ignore(s)).and_then(|s| parse_comma(s))))
                    })
            })
        })
    })
}
#[inline]
fn parse_generic_pair(state: Input) -> Output {
    state.rule(ValkyrieRule::GenericPair, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| {
                    s.optional(|s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_colon(s).and_then(|s| s.tag_node("colon")))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_type_expression(s).and_then(|s| s.tag_node("type_expression")))
        })
    })
}
#[inline]
fn parse_annotation_head(state: Input) -> Output {
    state.rule(ValkyrieRule::AnnotationHead, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_annotation_term(s).and_then(|s| s.tag_node("annotation_term")))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_modifier_call(s).and_then(|s| s.tag_node("modifier_call")))
                        })
                    })
                })
        })
    })
}
#[inline]
fn parse_annotation_mix(state: Input) -> Output {
    state.rule(ValkyrieRule::AnnotationMix, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_annotation_term_mix(s).and_then(|s| s.tag_node("annotation_term_mix")))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_modifier_ahead(s).and_then(|s| s.tag_node("modifier_ahead")))
                        })
                    })
                })
        })
    })
}
#[inline]
fn parse_annotation_term(state: Input) -> Output {
    state.rule(ValkyrieRule::AnnotationTerm, |s| {
        Err(s)
            .or_else(|s| parse_attribute_list(s).and_then(|s| s.tag_node("attribute_list")))
            .or_else(|s| parse_attribute_call(s).and_then(|s| s.tag_node("attribute_call")))
    })
}
#[inline]
fn parse_annotation_term_mix(state: Input) -> Output {
    state.rule(ValkyrieRule::AnnotationTermMix, |s| {
        Err(s)
            .or_else(|s| parse_attribute_list(s).and_then(|s| s.tag_node("attribute_list")))
            .or_else(|s| parse_attribute_call(s).and_then(|s| s.tag_node("attribute_call")))
            .or_else(|s| parse_procedural_call(s).and_then(|s| s.tag_node("procedural_call")))
    })
}
#[inline]
fn parse_attribute_list(state: Input) -> Output {
    state.rule(ValkyrieRule::AttributeList, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| builtin_text(s, "#", false))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, "[", false))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.optional(|s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| parse_attribute_item(s).and_then(|s| s.tag_node("attribute_item")))
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| {
                                    s.repeat(0..4294967295, |s| {
                                        s.sequence(|s| {
                                            Ok(s).and_then(|s| builtin_ignore(s)).and_then(|s| {
                                                s.sequence(|s| {
                                                    Ok(s)
                                                        .and_then(|s| builtin_ignore(s))
                                                        .and_then(|s| builtin_ignore(s))
                                                        .and_then(|s| parse_eos_free(s))
                                                        .and_then(|s| builtin_ignore(s))
                                                        .and_then(|s| builtin_ignore(s))
                                                        .and_then(|s| builtin_ignore(s))
                                                        .and_then(|s| {
                                                            parse_attribute_item(s).and_then(|s| s.tag_node("attribute_item"))
                                                        })
                                                })
                                            })
                                        })
                                    })
                                })
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| {
                                    s.optional(|s| {
                                        s.sequence(|s| {
                                            Ok(s)
                                                .and_then(|s| builtin_ignore(s))
                                                .and_then(|s| builtin_ignore(s))
                                                .and_then(|s| parse_eos_free(s))
                                        })
                                    })
                                })
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, "]", false))
        })
    })
}
#[inline]
fn parse_attribute_call(state: Input) -> Output {
    state.rule(ValkyrieRule::AttributeCall, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| builtin_text(s, "#", false))
                .and_then(|s| parse_attribute_item(s).and_then(|s| s.tag_node("attribute_item")))
        })
    })
}
#[inline]
fn parse_attribute_item(state: Input) -> Output {
    state.rule(ValkyrieRule::AttributeItem, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_namepath(s).and_then(|s| s.tag_node("namepath")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s).and_then(|s| builtin_ignore(s)).and_then(|s| {
                                s.sequence(|s| {
                                    Ok(s)
                                        .and_then(|s| parse_dot(s))
                                        .and_then(|s| builtin_ignore(s))
                                        .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
                                })
                            })
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_tuple_literal(s).and_then(|s| s.tag_node("tuple_literal"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_continuation(s).and_then(|s| s.tag_node("continuation"))))
        })
    })
}
#[inline]
fn parse_attribute_name(state: Input) -> Output {
    state.rule(ValkyrieRule::AttributeName, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| builtin_text(s, "#", false))
                .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
        })
    })
}
#[inline]
fn parse_procedural_call(state: Input) -> Output {
    state.rule(ValkyrieRule::ProceduralCall, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| builtin_text(s, "@", false))
                .and_then(|s| parse_namepath(s).and_then(|s| s.tag_node("namepath")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_tuple_literal(s).and_then(|s| s.tag_node("tuple_literal"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_continuation(s).and_then(|s| s.tag_node("continuation"))))
        })
    })
}
#[inline]
fn parse_procedural_name(state: Input) -> Output {
    state.rule(ValkyrieRule::ProceduralName, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| builtin_text(s, "@", false))
                .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
        })
    })
}
#[inline]
fn parse_text_literal(state: Input) -> Output {
    state.rule(ValkyrieRule::TextLiteral, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| s.optional(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier"))))
                .and_then(|s| parse_text_raw(s).and_then(|s| s.tag_node("text_raw")))
        })
    })
}
#[inline]
fn parse_text_raw(state: Input) -> Output {
    state.rule(ValkyrieRule::TextRaw, |s| {
        Err(s)
            .or_else(|s| {
                s.sequence(|s| {
                    Ok(s)
                        .and_then(|s| builtin_text(s, "\"\"\"\"", false))
                        .and_then(|s| parse_text_content_5(s).and_then(|s| s.tag_node("text_content_5")))
                        .and_then(|s| builtin_text(s, "\"\"\"\"", false))
                })
            })
            .or_else(|s| {
                s.sequence(|s| {
                    Ok(s)
                        .and_then(|s| builtin_text(s, "''''", false))
                        .and_then(|s| parse_text_content_6(s).and_then(|s| s.tag_node("text_content_6")))
                        .and_then(|s| builtin_text(s, "''''", false))
                })
            })
            .or_else(|s| {
                s.sequence(|s| {
                    Ok(s)
                        .and_then(|s| builtin_text(s, "\"\"\"", false))
                        .and_then(|s| parse_text_content_3(s).and_then(|s| s.tag_node("text_content_3")))
                        .and_then(|s| builtin_text(s, "\"\"\"", false))
                })
            })
            .or_else(|s| {
                s.sequence(|s| {
                    Ok(s)
                        .and_then(|s| builtin_text(s, "'''", false))
                        .and_then(|s| parse_text_content_4(s).and_then(|s| s.tag_node("text_content_4")))
                        .and_then(|s| builtin_text(s, "'''", false))
                })
            })
            .or_else(|s| {
                s.sequence(|s| {
                    Ok(s)
                        .and_then(|s| builtin_text(s, "\"", false))
                        .and_then(|s| parse_text_content_1(s).and_then(|s| s.tag_node("text_content_1")))
                        .and_then(|s| builtin_text(s, "\"", false))
                })
            })
            .or_else(|s| {
                s.sequence(|s| {
                    Ok(s)
                        .and_then(|s| builtin_text(s, "'", false))
                        .and_then(|s| parse_text_content_2(s).and_then(|s| s.tag_node("text_content_2")))
                        .and_then(|s| builtin_text(s, "'", false))
                })
            })
    })
}
#[inline]
fn parse_text_l(state: Input) -> Output {
    state.rule(ValkyrieRule::Text_L, |s| builtin_ignore(s))
}
#[inline]
fn parse_text_r(state: Input) -> Output {
    state.rule(ValkyrieRule::Text_R, |s| builtin_ignore(s))
}
#[inline]
fn parse_text_x(state: Input) -> Output {
    state.rule(ValkyrieRule::Text_X, |s| builtin_ignore(s))
}
#[inline]
fn parse_text_content_1(state: Input) -> Output {
    state.rule(ValkyrieRule::TEXT_CONTENT1, |s| {
        s.repeat(0..4294967295, |s| {
            builtin_regex(s, {
                static REGEX: OnceLock<Regex> = OnceLock::new();
                REGEX.get_or_init(|| Regex::new("^(?x)([^\"])").unwrap())
            })
        })
    })
}
#[inline]
fn parse_text_content_2(state: Input) -> Output {
    state.rule(ValkyrieRule::TEXT_CONTENT2, |s| {
        s.repeat(0..4294967295, |s| {
            builtin_regex(s, {
                static REGEX: OnceLock<Regex> = OnceLock::new();
                REGEX.get_or_init(|| Regex::new("^(?x)([^'])").unwrap())
            })
        })
    })
}
#[inline]
fn parse_text_content_3(state: Input) -> Output {
    state.rule(ValkyrieRule::TEXT_CONTENT3, |s| {
        s.repeat(1..4294967295, |s| {
            s.sequence(|s| {
                Ok(s).and_then(|s| s.lookahead(false, |s| builtin_text(s, "\"\"\"", false))).and_then(|s| builtin_any(s))
            })
        })
    })
}
#[inline]
fn parse_text_content_4(state: Input) -> Output {
    state.rule(ValkyrieRule::TEXT_CONTENT4, |s| {
        s.repeat(1..4294967295, |s| {
            s.sequence(|s| {
                Ok(s).and_then(|s| s.lookahead(false, |s| builtin_text(s, "'''", false))).and_then(|s| builtin_any(s))
            })
        })
    })
}
#[inline]
fn parse_text_content_5(state: Input) -> Output {
    state.rule(ValkyrieRule::TEXT_CONTENT5, |s| {
        s.repeat(1..4294967295, |s| {
            s.sequence(|s| {
                Ok(s).and_then(|s| s.lookahead(false, |s| builtin_text(s, "\"\"\"\"", false))).and_then(|s| builtin_any(s))
            })
        })
    })
}
#[inline]
fn parse_text_content_6(state: Input) -> Output {
    state.rule(ValkyrieRule::TEXT_CONTENT6, |s| {
        s.repeat(1..4294967295, |s| {
            s.sequence(|s| {
                Ok(s).and_then(|s| s.lookahead(false, |s| builtin_text(s, "''''", false))).and_then(|s| builtin_any(s))
            })
        })
    })
}
#[inline]
fn parse_modifier_call(state: Input) -> Output {
    state.rule(ValkyrieRule::ModifierCall, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| s.lookahead(false, |s| parse_keywords_stop(s)))
                .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
        })
    })
}
#[inline]
fn parse_modifier_ahead(state: Input) -> Output {
    state.rule(ValkyrieRule::ModifierAhead, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| s.lookahead(false, |s| parse_identifier_stop(s)))
                .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
        })
    })
}
#[inline]
fn parse_keywords_stop(state: Input) -> Output {
    state.rule(ValkyrieRule::KEYWORDS_STOP, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| {
                Regex::new(
                    "^(?x)(template | generic | constraint
    | class | structure
    | enumerate | flags | union
    | function | micro | macro
    | trait | interface
    | extends?)",
                )
                .unwrap()
            })
        })
    })
}
#[inline]
fn parse_identifier_stop(state: Input) -> Output {
    state.rule(ValkyrieRule::IDENTIFIER_STOP, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    builtin_regex(s, {
                        static REGEX: OnceLock<Regex> = OnceLock::new();
                        REGEX.get_or_init(|| Regex::new("^(?x)([\\[\\](){}<>⟨:∷,.;∈=]|in|is)").unwrap())
                    })
                })
        })
    })
}
#[inline]
fn parse_slot(state: Input) -> Output {
    state.rule(ValkyrieRule::Slot, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_op_slot(s).and_then(|s| s.tag_node("op_slot")))
                .and_then(|s| s.optional(|s| parse_slot_item(s).and_then(|s| s.tag_node("slot_item"))))
        })
    })
}
#[inline]
fn parse_slot_item(state: Input) -> Output {
    state.rule(ValkyrieRule::SlotItem, |s| {
        Err(s)
            .or_else(|s| parse_integer(s).and_then(|s| s.tag_node("integer")))
            .or_else(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
    })
}
#[inline]
fn parse_namepath_free(state: Input) -> Output {
    state.rule(ValkyrieRule::NamepathFree, |s| {
        s.sequence(|s| {
            Ok(s).and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier"))).and_then(|s| {
                s.repeat(0..4294967295, |s| {
                    s.sequence(|s| {
                        Ok(s)
                            .and_then(|s| builtin_ignore(s))
                            .and_then(|s| parse_proportion_2(s))
                            .and_then(|s| builtin_ignore(s))
                            .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
                    })
                })
            })
        })
    })
}
#[inline]
fn parse_namepath(state: Input) -> Output {
    state.rule(ValkyrieRule::Namepath, |s| {
        s.sequence(|s| {
            Ok(s).and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier"))).and_then(|s| {
                s.repeat(0..4294967295, |s| {
                    s.sequence(|s| {
                        Ok(s)
                            .and_then(|s| builtin_ignore(s))
                            .and_then(|s| parse_proportion(s))
                            .and_then(|s| builtin_ignore(s))
                            .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("identifier")))
                    })
                })
            })
        })
    })
}
#[inline]
fn parse_identifier(state: Input) -> Output {
    state.rule(ValkyrieRule::Identifier, |s| {
        Err(s)
            .or_else(|s| parse_identifier_bare(s).and_then(|s| s.tag_node("identifier_bare")))
            .or_else(|s| parse_identifier_raw(s).and_then(|s| s.tag_node("identifier_raw")))
    })
}
#[inline]
fn parse_identifier_bare(state: Input) -> Output {
    state.rule(ValkyrieRule::IdentifierBare, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)([_\\p{XID_start}]\\p{XID_continue}*)").unwrap())
        })
    })
}
#[inline]
fn parse_identifier_raw(state: Input) -> Output {
    state.rule(ValkyrieRule::IdentifierRaw, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| builtin_text(s, "`", false))
                .and_then(|s| parse_identifier_raw_text(s).and_then(|s| s.tag_node("identifier_raw_text")))
                .and_then(|s| builtin_text(s, "`", false))
        })
    })
}
#[inline]
fn parse_identifier_raw_text(state: Input) -> Output {
    state.rule(ValkyrieRule::IdentifierRawText, |s| {
        s.repeat(1..4294967295, |s| {
            s.sequence(|s| {
                Ok(s).and_then(|s| builtin_ignore(s)).and_then(|s| {
                    builtin_regex(s, {
                        static REGEX: OnceLock<Regex> = OnceLock::new();
                        REGEX.get_or_init(|| Regex::new("^(?x)([^`])").unwrap())
                    })
                })
            })
        })
    })
}
#[inline]
fn parse_special(state: Input) -> Output {
    state.rule(ValkyrieRule::Special, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)([∅∞]|true|false|[?]{3})").unwrap())
        })
    })
}
#[inline]
fn parse_number(state: Input) -> Output {
    state.rule(ValkyrieRule::Number, |s| {
        Err(s)
            .or_else(|s| parse_decimal_x(s).and_then(|s| s.tag_node("decimal_x")))
            .or_else(|s| parse_decimal(s).and_then(|s| s.tag_node("decimal")))
    })
}
#[inline]
fn parse_sign(state: Input) -> Output {
    state.rule(ValkyrieRule::Sign, |s| {
        Err(s)
            .or_else(|s| builtin_text(s, "+", false).and_then(|s| s.tag_node("positive")))
            .or_else(|s| builtin_text(s, "-", false).and_then(|s| s.tag_node("netative")))
    })
}
#[inline]
fn parse_integer(state: Input) -> Output {
    state.rule(ValkyrieRule::Integer, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)([0-9](_*[0-9])*)").unwrap())
        })
    })
}
#[inline]
fn parse_digits_x(state: Input) -> Output {
    state.rule(ValkyrieRule::DigitsX, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)([0-9a-zA-Z](_*[0-9a-zA-Z])*)").unwrap())
        })
    })
}
#[inline]
fn parse_decimal(state: Input) -> Output {
    state.rule(ValkyrieRule::Decimal, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_integer(s).and_then(|s| s.tag_node("lhs")))
                .and_then(|s| {
                    s.optional(|s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| parse_dot(s).and_then(|s| s.tag_node("dot")))
                                .and_then(|s| parse_integer(s).and_then(|s| s.tag_node("rhs")))
                        })
                    })
                })
                .and_then(|s| {
                    s.optional(|s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| {
                                    s.sequence(|s| {
                                        Ok(s)
                                            .and_then(|s| {
                                                builtin_regex(s, {
                                                    static REGEX: OnceLock<Regex> = OnceLock::new();
                                                    REGEX.get_or_init(|| Regex::new("^(?x)([⁑]|[*]{2})").unwrap())
                                                })
                                            })
                                            .and_then(|s| s.optional(|s| parse_sign(s).and_then(|s| s.tag_node("sign"))))
                                    })
                                })
                                .and_then(|s| parse_integer(s).and_then(|s| s.tag_node("shift")))
                        })
                    })
                })
                .and_then(|s| {
                    s.optional(|s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| {
                                    builtin_regex(s, {
                                        static REGEX: OnceLock<Regex> = OnceLock::new();
                                        REGEX.get_or_init(|| Regex::new("^(?x)([_]*)").unwrap())
                                    })
                                })
                                .and_then(|s| parse_identifier(s).and_then(|s| s.tag_node("unit")))
                        })
                    })
                })
        })
    })
}
#[inline]
fn parse_decimal_x(state: Input) -> Output {
    state.rule(ValkyrieRule::DecimalX, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| {
                    s.sequence(|s| {
                        Ok(s).and_then(|s| parse_integer(s).and_then(|s| s.tag_node("base"))).and_then(|s| {
                            builtin_regex(s, {
                                static REGEX: OnceLock<Regex> = OnceLock::new();
                                REGEX.get_or_init(|| Regex::new("^(?x)([⁂]|[*]{3})").unwrap())
                            })
                        })
                    })
                })
                .and_then(|s| parse_digits_x(s).and_then(|s| s.tag_node("lhs")))
                .and_then(|s| {
                    s.optional(|s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| parse_dot(s).and_then(|s| s.tag_node("dot")))
                                .and_then(|s| parse_digits_x(s).and_then(|s| s.tag_node("rhs")))
                        })
                    })
                })
                .and_then(|s| {
                    s.optional(|s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| {
                                    builtin_regex(s, {
                                        static REGEX: OnceLock<Regex> = OnceLock::new();
                                        REGEX.get_or_init(|| Regex::new("^(?x)([⁑]|[*]{2})").unwrap())
                                    })
                                })
                                .and_then(|s| {
                                    Err(s)
                                        .or_else(|s| {
                                            s.sequence(|s| {
                                                Ok(s)
                                                    .and_then(|s| {
                                                        s.optional(|s| parse_sign(s).and_then(|s| s.tag_node("sign")))
                                                    })
                                                    .and_then(|s| parse_integer(s).and_then(|s| s.tag_node("shift")))
                                                    .and_then(|s| {
                                                        s.optional(|s| {
                                                            s.sequence(|s| {
                                                                Ok(s)
                                                                    .and_then(|s| {
                                                                        builtin_regex(s, {
                                                                            static REGEX: OnceLock<Regex> = OnceLock::new();
                                                                            REGEX.get_or_init(|| {
                                                                                Regex::new("^(?x)([_]*)").unwrap()
                                                                            })
                                                                        })
                                                                    })
                                                                    .and_then(|s| {
                                                                        parse_identifier(s).and_then(|s| s.tag_node("unit"))
                                                                    })
                                                            })
                                                        })
                                                    })
                                            })
                                        })
                                        .or_else(|s| parse_identifier(s).and_then(|s| s.tag_node("unit")))
                                })
                        })
                    })
                })
        })
    })
}
#[inline]
fn parse_proportion(state: Input) -> Output {
    state.rule(ValkyrieRule::PROPORTION, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)(∷|::)").unwrap())
        })
    })
}
#[inline]
fn parse_ns_concat(state: Input) -> Output {
    state.rule(ValkyrieRule::NS_CONCAT, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)([.∷]|::)").unwrap())
        })
    })
}
#[inline]
fn parse_colon(state: Input) -> Output {
    state.rule(ValkyrieRule::COLON, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)([::])").unwrap())
        })
    })
}
#[inline]
fn parse_arrow_1(state: Input) -> Output {
    state.rule(ValkyrieRule::ARROW1, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)([::⟶]|->)").unwrap())
        })
    })
}
#[inline]
fn parse_comma(state: Input) -> Output {
    state.rule(ValkyrieRule::COMMA, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)([,,])").unwrap())
        })
    })
}
#[inline]
fn parse_dot(state: Input) -> Output {
    state.rule(ValkyrieRule::DOT, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)([..])").unwrap())
        })
    })
}
#[inline]
fn parse_op_slot(state: Input) -> Output {
    state.rule(ValkyrieRule::OP_SLOT, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)([$]{1,3})").unwrap())
        })
    })
}
#[inline]
fn parse_offset_l(state: Input) -> Output {
    state.rule(ValkyrieRule::OFFSET_L, |s| s.match_string("", false))
}
#[inline]
fn parse_offset_r(state: Input) -> Output {
    state.rule(ValkyrieRule::OFFSET_R, |s| s.match_string("", false))
}
#[inline]
fn parse_proportion_2(state: Input) -> Output {
    state.rule(ValkyrieRule::PROPORTION2, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)([..∷]|::)").unwrap())
        })
    })
}
#[inline]
fn parse_op_import_all(state: Input) -> Output {
    state.rule(ValkyrieRule::OP_IMPORT_ALL, |s| s.match_string("*", false))
}
#[inline]
fn parse_op_and_then(state: Input) -> Output {
    state.rule(ValkyrieRule::OP_AND_THEN, |s| s.match_string("?", false))
}
#[inline]
fn parse_op_bind(state: Input) -> Output {
    state.rule(ValkyrieRule::OP_BIND, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)(≔|:=)").unwrap())
        })
    })
}
#[inline]
fn parse_kw_control(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_CONTROL, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| {
                Regex::new(
                    "^(?x)(continue
    | break
    | fallthrough!?
    | raise | throw
    | return
    | resume
    | yield\\s+break
    | yield\\s+from
    | yield\\s+wait
    | yield(\\s+return)?)",
                )
                .unwrap()
            })
        })
    })
}
#[inline]
fn parse_kw_namespace(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_NAMESPACE, |s| s.match_string("namespace", false))
}
#[inline]
fn parse_kw_import(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_IMPORT, |s| s.match_string("using", false))
}
#[inline]
fn parse_kw_constraint(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_CONSTRAINT, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)(template|generic|constraint|∀)").unwrap())
        })
    })
}
#[inline]
fn parse_kw_where(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_WHERE, |s| s.match_string("where", false))
}
#[inline]
fn parse_kw_implements(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_IMPLEMENTS, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)(implements?)").unwrap())
        })
    })
}
#[inline]
fn parse_kw_extends(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_EXTENDS, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)(extends?)").unwrap())
        })
    })
}
#[inline]
fn parse_kw_inherits(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_INHERITS, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)(inherits?)").unwrap())
        })
    })
}
#[inline]
fn parse_kw_for(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_FOR, |s| s.match_string("for", false))
}
#[inline]
fn parse_kw_end(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_END, |s| s.match_string("end", false))
}
#[inline]
fn parse_kw_let(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_LET, |s| s.match_string("let", false))
}
#[inline]
fn parse_kw_new(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_NEW, |s| s.match_string("new", false))
}
#[inline]
fn parse_kw_object(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_OBJECT, |s| s.match_string("object", false))
}
#[inline]
fn parse_kw_lambda(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_LAMBDA, |s| s.match_string("lambda", false))
}
#[inline]
fn parse_kw_if(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_IF, |s| s.match_string("if", false))
}
#[inline]
fn parse_kw_switch(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_SWITCH, |s| s.match_string("switch", false))
}
#[inline]
fn parse_kw_try(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_TRY, |s| s.match_string("try", false))
}
#[inline]
fn parse_kw_type(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_TYPE, |s| s.match_string("type", false))
}
#[inline]
fn parse_kw_case(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_CASE, |s| s.match_string("case", false))
}
#[inline]
fn parse_kw_when(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_WHEN, |s| s.match_string("when", false))
}
#[inline]
fn parse_kw_else(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_ELSE, |s| s.match_string("else", false))
}
#[inline]
fn parse_kw_not(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_NOT, |s| s.match_string("not", false))
}
#[inline]
fn parse_kw_in(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_IN, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)(in|∈)").unwrap())
        })
    })
}
#[inline]
fn parse_kw_is(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_IS, |s| s.match_string("is", false))
}
#[inline]
fn parse_kw_as(state: Input) -> Output {
    state.rule(ValkyrieRule::KW_AS, |s| s.match_string("as", false))
}
#[inline]
fn parse_shebang(state: Input) -> Output {
    state.rule(ValkyrieRule::Shebang, |s| {
        s.sequence(|s| Ok(s).and_then(|s| builtin_text(s, "#!", false)).and_then(|s| s.rest_of_line()))
    })
}
#[inline]
fn parse_white_space(state: Input) -> Output {
    state.rule(ValkyrieRule::WhiteSpace, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)([^\\S\\r\\n]+)").unwrap())
        })
    })
}
#[inline]
fn parse_skip_space(state: Input) -> Output {
    state.rule(ValkyrieRule::SkipSpace, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)(\\p{White_Space}+)").unwrap())
        })
    })
}
#[inline]
fn parse_comment(state: Input) -> Output {
    state.rule(ValkyrieRule::Comment, |s| {
        Err(s)
            .or_else(|s| s.sequence(|s| Ok(s).and_then(|s| builtin_text(s, "//", false)).and_then(|s| s.rest_of_line())))
            .or_else(|s| {
                s.sequence(|s| Ok(s).and_then(|s| builtin_text(s, "/*", false)).and_then(|s| builtin_text(s, "*/", false)))
            })
    })
}
#[inline]
fn parse_string_interpolations(state: Input) -> Output {
    state.rule(ValkyrieRule::StringInterpolations, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        parse_string_interpolation_term(s).and_then(|s| s.tag_node("string_interpolation_term"))
                    })
                })
                .and_then(|s| s.end_of_input())
        })
    })
}
#[inline]
fn parse_string_interpolation_term(state: Input) -> Output {
    state.rule(ValkyrieRule::StringInterpolationTerm, |s| {
        Err(s)
            .or_else(|s| parse_escape_unicode(s).and_then(|s| s.tag_node("escape_unicode")))
            .or_else(|s| parse_escape_character(s).and_then(|s| s.tag_node("escape_character")))
            .or_else(|s| parse_string_interpolation_simple(s).and_then(|s| s.tag_node("string_interpolation_simple")))
            .or_else(|s| parse_string_interpolation_complex(s).and_then(|s| s.tag_node("string_interpolation_complex")))
            .or_else(|s| parse_string_interpolation_text(s).and_then(|s| s.tag_node("string_interpolation_text")))
    })
}
#[inline]
fn parse_escape_character(state: Input) -> Output {
    state.rule(ValkyrieRule::EscapeCharacter, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)(\\\\.|\\{\\{|\\}\\})").unwrap())
        })
    })
}
#[inline]
fn parse_escape_unicode(state: Input) -> Output {
    state.rule(ValkyrieRule::EscapeUnicode, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| {
                    s.sequence(|s| {
                        Ok(s)
                            .and_then(|s| builtin_text(s, "\\u", false))
                            .and_then(|s| builtin_text(s, "{", false))
                            .and_then(|s| builtin_ignore(s))
                    })
                })
                .and_then(|s| parse_escape_unicode_code(s).and_then(|s| s.tag_node("code")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, "}", false))
        })
    })
}
#[inline]
fn parse_escape_unicode_code(state: Input) -> Output {
    state.rule(ValkyrieRule::EscapeUnicodeCode, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)([0-9a-zA-Z]*)").unwrap())
        })
    })
}
#[inline]
fn parse_string_interpolation_simple(state: Input) -> Output {
    state.rule(ValkyrieRule::StringInterpolationSimple, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| builtin_text(s, "{", false))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_main_expression(s).and_then(|s| s.tag_node("main_expression")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.optional(|s| {
                        s.sequence(|s| {
                            Ok(s)
                                .and_then(|s| parse_colon(s))
                                .and_then(|s| builtin_ignore(s))
                                .and_then(|s| parse_string_formatter(s).and_then(|s| s.tag_node("string_formatter")))
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, "}", false))
        })
    })
}
#[inline]
fn parse_string_interpolation_text(state: Input) -> Output {
    state.rule(ValkyrieRule::StringInterpolationText, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)([^{}\\\\]+)").unwrap())
        })
    })
}
#[inline]
fn parse_string_formatter(state: Input) -> Output {
    state.rule(ValkyrieRule::StringFormatter, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)([^}]+)").unwrap())
        })
    })
}
#[inline]
fn parse_string_interpolation_complex(state: Input) -> Output {
    state.rule(ValkyrieRule::StringInterpolationComplex, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| builtin_text(s, "{", false))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_main_expression(s).and_then(|s| s.tag_node("main_expression")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| {
                        s.sequence(|s| {
                            Ok(s).and_then(|s| builtin_ignore(s)).and_then(|s| {
                                s.sequence(|s| {
                                    Ok(s)
                                        .and_then(|s| parse_comma(s))
                                        .and_then(|s| builtin_ignore(s))
                                        .and_then(|s| parse_tuple_pair(s).and_then(|s| s.tag_node("tuple_pair")))
                                })
                            })
                        })
                    })
                })
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_comma(s)))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| builtin_text(s, "}", false))
        })
    })
}
#[inline]
fn parse_string_templates(state: Input) -> Output {
    state.rule(ValkyrieRule::StringTemplates, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| {
                    s.repeat(0..4294967295, |s| parse_string_template_term(s).and_then(|s| s.tag_node("string_template_term")))
                })
                .and_then(|s| s.end_of_input())
        })
    })
}
#[inline]
fn parse_string_template_term(state: Input) -> Output {
    state.rule(ValkyrieRule::StringTemplateTerm, |s| {
        Err(s)
            .or_else(|s| parse_for_template(s).and_then(|s| s.tag_node("for_template")))
            .or_else(|s| parse_expression_template(s).and_then(|s| s.tag_node("expression_template")))
    })
}
#[inline]
fn parse_expression_template(state: Input) -> Output {
    state.rule(ValkyrieRule::ExpressionTemplate, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_template_s(s).and_then(|s| s.tag_node("template_s")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_main_expression(s).and_then(|s| s.tag_node("main_expression")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_template_e(s).and_then(|s| s.tag_node("template_e")))
        })
    })
}
#[inline]
fn parse_for_template(state: Input) -> Output {
    state.rule(ValkyrieRule::ForTemplate, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_for_template_begin(s).and_then(|s| s.tag_node("for_template_begin")))
                .and_then(|s| s.optional(|s| parse_for_template_else(s).and_then(|s| s.tag_node("for_template_else"))))
                .and_then(|s| parse_for_template_end(s).and_then(|s| s.tag_node("for_template_end")))
        })
    })
}
#[inline]
fn parse_for_template_begin(state: Input) -> Output {
    state.rule(ValkyrieRule::ForTemplateBegin, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_template_s(s).and_then(|s| s.tag_node("template_s")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_kw_for(s).and_then(|s| s.tag_node("kw_for")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_let_pattern(s).and_then(|s| s.tag_node("let_pattern")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_kw_in(s).and_then(|s| s.tag_node("kw_in")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_inline_expression(s).and_then(|s| s.tag_node("inline_expression"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_if_guard(s).and_then(|s| s.tag_node("if_guard")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_template_e(s).and_then(|s| s.tag_node("template_e")))
        })
    })
}
#[inline]
fn parse_for_template_else(state: Input) -> Output {
    state.rule(ValkyrieRule::ForTemplateElse, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_template_s(s).and_then(|s| s.tag_node("template_s")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_kw_else(s).and_then(|s| s.tag_node("kw_else")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_template_e(s).and_then(|s| s.tag_node("template_e")))
        })
    })
}
#[inline]
fn parse_for_template_end(state: Input) -> Output {
    state.rule(ValkyrieRule::ForTemplateEnd, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_template_s(s).and_then(|s| s.tag_node("template_s")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_kw_end(s).and_then(|s| s.tag_node("kw_end")))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| s.optional(|s| parse_kw_for(s).and_then(|s| s.tag_node("kw_for"))))
                .and_then(|s| builtin_ignore(s))
                .and_then(|s| parse_template_e(s).and_then(|s| s.tag_node("template_e")))
        })
    })
}
#[inline]
fn parse_template_s(state: Input) -> Output {
    state.rule(ValkyrieRule::TEMPLATE_S, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| parse_template_l(s))
                .and_then(|s| s.optional(|s| parse_template_m(s).and_then(|s| s.tag_node("template_m"))))
        })
    })
}
#[inline]
fn parse_template_e(state: Input) -> Output {
    state.rule(ValkyrieRule::TEMPLATE_E, |s| {
        s.sequence(|s| {
            Ok(s)
                .and_then(|s| s.optional(|s| parse_template_m(s).and_then(|s| s.tag_node("template_m"))))
                .and_then(|s| parse_template_r(s))
        })
    })
}
#[inline]
fn parse_template_l(state: Input) -> Output {
    state.rule(ValkyrieRule::TEMPLATE_L, |s| s.match_string("<%", false))
}
#[inline]
fn parse_template_r(state: Input) -> Output {
    state.rule(ValkyrieRule::TEMPLATE_R, |s| s.match_string("%>", false))
}
#[inline]
fn parse_template_m(state: Input) -> Output {
    state.rule(ValkyrieRule::TEMPLATE_M, |s| {
        s.match_regex({
            static REGEX: OnceLock<Regex> = OnceLock::new();
            REGEX.get_or_init(|| Regex::new("^(?x)([-_~.=])").unwrap())
        })
    })
}

/// All rules ignored in ast mode, inline is not recommended
fn builtin_ignore(state: Input) -> Output {
    state.repeat(0..u32::MAX, |s| parse_skip_space(s).or_else(|s| parse_comment(s)))
}

fn builtin_any(state: Input) -> Output {
    state.rule(ValkyrieRule::HiddenText, |s| s.match_char_if(|_| true))
}

fn builtin_text<'i>(state: Input<'i>, text: &'static str, case: bool) -> Output<'i> {
    state.rule(ValkyrieRule::HiddenText, |s| s.match_string(text, case))
}

fn builtin_regex<'i, 'r>(state: Input<'i>, regex: &'r Regex) -> Output<'i> {
    state.rule(ValkyrieRule::HiddenText, |s| s.match_regex(regex))
}