zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
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
U
H=®dò+ãt@sdZdZdZdZddlZddlmZddlZddl    Z    ddl
Z
ddl Z ddl Z ddl Z ddlZddlZddlZddlmZddlmZddlZdd    lmZdd
lmZzdd lmZWn ek
rÔdd lmZYnXzdd lmZWn"ek
rdd lmZYnXz ddlm Z ddlm!Z!m"Z"Wn2ek
r\ddl m Z ddl m!Z!m"Z"YnXzddl m#Z$WnBek
r°zddl%m#Z$Wnek
rªdZ$YnXYnXzddlm&Z&Wn$ek
ræGdd„dƒZ&YnXe&ƒZ'de'_de'_(e&ƒZ)de)_de)_*de)_+de)_,de)_-de)_.dd„e/e)ƒDƒe)_0dd„Z1e1e)_2ddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dd€dd‚dƒd„d…d†d‡dˆd‰dŠd‹dŒddŽdgtZ3e4e    j5ƒdd…Z6e6ddkZ7e7rˆe    j8Z9e:Z;e<Z=e:Z>e:Z?e@eAeBeCeDe4eEeFeGeHeIg ZJn`e    jKZ9eLZMd‘d’„Z?gZJddlNZNd“ O¡D]8ZPzeJ QeReNePƒ¡WneSk
râYq®YnXq®eTd”d•„eMd–ƒDƒƒZUd—d˜„ZVejWejXZYd™ZZeZdšZ[eYeZZ\e<d›ƒZ]dœ ^dd•„ej_Dƒ¡Z`dadždŽ„ZaGdŸd9„d9ebƒZcGd d;„d;ecƒZdGd¡d=„d=ecƒZeGd¢d?„d?eeƒZfGd£dB„dBebƒZgGd¤d¥„d¥ehƒZiGd¦d>„d>ehƒZje! kej¡d§dV„Zld¨dg„Zmd©dd„Zndªd«„Zod¬d­„Zpd®d¯„Zqd°dn„Zrdbd²d³„ZsGd´d@„d@ehƒZtGdµd¶„d¶etƒZuGd·dH„dHetƒZvGd¸d(„d(evƒZwGd¹d3„d3evƒZxGdºd0„d0evƒZyGd»d¼„d¼eyƒZzeyZ{eyet_|Gd½d-„d-evƒZ}Gd¾d#„d#eyƒZ~Gd¿d"„d"e}ƒZGdÀd‰„d‰evƒZ€GdÁdK„dKevƒZGdÂdÄdÃeƒZ‚GdÄdO„dOe‚ƒZƒGdÅdC„dCevƒZ„GdÆdA„dAevƒZ…GdÇd$„d$evƒZ†GdÈdJ„dJevƒZ‡GdÉdʄdÊevƒZˆGdËd+„d+eˆƒZ‰GdÌd/„d/eˆƒZŠGdÍd.„d.eˆƒZ‹GdÎdF„dFeˆƒZŒGdÏdE„dEeˆƒZGdÐdM„dMeˆƒZŽGdÑdL„dLeˆƒZGdÒd<„d<etƒZGdÓd!„d!eƒZ‘GdÔd8„d8eƒZ’GdÕd2„d2eƒZ“GdÖd'„d'eƒZ”Gd×d:„d:etƒZ•GdØd)„d)e•ƒZ–GdÙd1„d1e•ƒZ—GdÚd4„d4e•ƒZ˜GdÛd܄dÜe•ƒZ™GdÝd5„d5e™ƒZšGdÞdN„dNe™ƒZ›Gdßdà„dàehƒZœGdád7„d7e•ƒZGdâdD„dDe•ƒZžGdãd*„d*e•ƒZŸGdädI„dIe•ƒZ Gdåd%„d%e ƒZ¡Gdæd,„d,e ƒZ¢Gdçd&„d&e ƒZ£GdèdG„dGe ƒZ¤Gdéd6„d6ehƒZ¥dêd„Z¦dcdìd]„Z§dddídY„Z¨dîdï„Z©dðdl„Zªdñdk„Z«dòdó„Z¬dedôdp„Z­dõd^„Z®dfdöd„„Z¯d÷d…„Z°død‡„Z±ewƒ ²d`¡Z³eŠƒ ²df¡Z´e‹ƒ ²de¡ZµeŒƒ ²d~¡Z¶eƒ ²d}¡Z·ee]dùd±dú ¸dûdü„¡Z¹e„dýƒ ¸dþdü„¡Zºe„dÿƒ ¸ddü„¡Z»e¹eºBe»Be†dd–dúBZ¼e¢e¼e¤dƒe¼ƒZ½eydƒedƒ ¾d¡e¢eše½e¼Bƒƒ ¾d¡dZ¿dd|„ZÀd    dj„ZÁd
dy„Zd dw„ZÐd dŠ„ZÄeĐd dü„ƒZÅeĐddü„ƒZÆe¤dƒe¤dƒfdd„Zǐddh„ZȐddi„Zɐdd‚„ZÊehƒeÊ_ːdgddˆ„ZÌe&ƒZÍehƒeÍ_ÎehƒeÍ_Ïe¤dƒe¤dƒfdd†„ZÐeÐZÑe¡e„dƒdƒ ²d¡ZÒe¡e„dƒdƒ ²d¡ZÓe¡e„dƒde„dƒdBƒ ²d ¡ZÔe¡e{d!ƒeÔ ¡ƒ ²d"¡ZՐdddeÔ ¡fd#dm„Z֐dhd$dƒ„Z×eÀd%ƒZØeÀd&ƒZÙeÈeeYe\d'ƒ ²d(¡ƒ\ZÚZÛeÜeݐd) O¡d*ƒƒZÞe„d+d, ^eÞ ß¡¡d-ƒ ²d.¡Zàd/dx„Záe¡e„d0ƒd1ƒ ²d2¡Zâe„d3ƒ ²d4¡Zãe„d5ƒ ä¡ ²d6¡Zåe„d7ƒ ²d8¡Zæe¡e„d0ƒd1eæBƒ ²d9¡ZçeçZèe„d:ƒ ²d;¡Zée¡ešee`dëd<eed=ƒeydëƒe‹ƒƒƒƒ ê¡ ²d>¡Zëe§eeÔ ¡eëBdœd?ƒ ²dW¡ZìGd@d‹„d‹ƒZíGdAdB„dBehƒZîGdCd„dehƒZïGdDdŒ„dŒeïƒZðeðjñjòjóeðjñjôjóeðjñjõjóeðjñ_óe7 r–eöeðdEeðj÷ƒeöeðdFeðjøƒeöeðdGeðjùƒeöeðdHeðjúƒeöeðdIeðjûƒeöeðdJeðjñƒeöeðjñdKeðjñjòƒeöeðjñdLeðjñjõƒeöeðjñdMeðjñjôƒeöeðdNeðjüƒeöeðdOeðjýƒeöeðdPeðjþƒGdQdR„dRƒZÿedSkre~dTƒZe~dUƒZeeYe\dVƒZe§edWddX ¸eÅ¡Ze¢e§eƒƒ ²dY¡ZdZeBZe§edWddX ¸eÅ¡Ze¢e§eƒƒ ²d[¡Zed\ƒedYƒeed[ƒZ    e     
d]¡eíj  
d^¡eíj  
d^¡eíj  
d_¡ddlZeíj ¸eĐejƒ¡eíj 
d`¡dS(ia×
 
pyparsing module - Classes and methods to define and execute parsing grammars
=============================================================================
 
The pyparsing module is an alternative approach to creating and
executing simple grammars, vs. the traditional lex/yacc approach, or the
use of regular expressions.  With pyparsing, you don't need to learn
a new syntax for defining grammars or matching expressions - the parsing
module provides a library of classes that you use to construct the
grammar directly in Python.
 
Here is a program to parse "Hello, World!" (or any greeting of the form
``"<salutation>, <addressee>!"``), built up using :class:`Word`,
:class:`Literal`, and :class:`And` elements
(the :class:`'+'<ParserElement.__add__>` operators create :class:`And` expressions,
and the strings are auto-converted to :class:`Literal` expressions)::
 
    from pip._vendor.pyparsing import Word, alphas
 
    # define grammar of a greeting
    greet = Word(alphas) + "," + Word(alphas) + "!"
 
    hello = "Hello, World!"
    print (hello, "->", greet.parseString(hello))
 
The program outputs the following::
 
    Hello, World! -> ['Hello', ',', 'World', '!']
 
The Python representation of the grammar is quite readable, owing to the
self-explanatory class names, and the use of '+', '|' and '^' operators.
 
The :class:`ParseResults` object returned from
:class:`ParserElement.parseString` can be
accessed as a nested list, a dictionary, or an object with named
attributes.
 
The pyparsing module handles some of the problems that are typically
vexing when writing text parsers:
 
  - extra or missing whitespace (the above program will also handle
    "Hello,World!", "Hello  ,  World  !", etc.)
  - quoted strings
  - embedded comments
 
 
Getting Started -
-----------------
Visit the classes :class:`ParserElement` and :class:`ParseResults` to
see the base classes that most other pyparsing
classes inherit from. Use the docstrings for examples of how to:
 
 - construct literal match expressions from :class:`Literal` and
   :class:`CaselessLiteral` classes
 - construct character word-group expressions using the :class:`Word`
   class
 - see how to create repetitive expressions using :class:`ZeroOrMore`
   and :class:`OneOrMore` classes
 - use :class:`'+'<And>`, :class:`'|'<MatchFirst>`, :class:`'^'<Or>`,
   and :class:`'&'<Each>` operators to combine simple expressions into
   more complex ones
 - associate names with your parsed results using
   :class:`ParserElement.setResultsName`
 - access the parsed data, which is returned as a :class:`ParseResults`
   object
 - find some helpful expression short-cuts like :class:`delimitedList`
   and :class:`oneOf`
 - find more useful common expressions in the :class:`pyparsing_common`
   namespace class
z2.4.7z30 Mar 2020 00:43 UTCz*Paul McGuire <ptmcg@users.sourceforge.net>éN)Úref)Údatetime)Ú
itemgetter)Úwraps)Úcontextmanager)Ú filterfalse)Ú ifilterfalse)ÚRLock)ÚIterable)ÚMutableMappingÚMapping)Ú OrderedDict)ÚSimpleNamespacec@s eZdZdS)rN)Ú__name__Ú
__module__Ú __qualname__©rrúLD:\z\workplace\VsCode\pyvenv\venv\Lib\site-packages\pip/_vendor/pyparsing.pyr–sraA
    A cross-version compatibility configuration for pyparsing features that will be
    released in a future version. By setting values in this configuration to True,
    those features can be enabled in prior versions for compatibility development
    and testing.
 
     - collect_all_And_tokens - flag to enable fix for Issue #63 that fixes erroneous grouping
       of results names when an And expression is nested within an Or or MatchFirst; set to
       True to enable bugfix released in pyparsing 2.3.0, or False to preserve
       pre-2.3.0 handling of named results
Ta“
Diagnostic configuration (all default to False)
     - warn_multiple_tokens_in_named_alternation - flag to enable warnings when a results
       name is defined on a MatchFirst or Or expression with one or more And subexpressions
       (only warns if __compat__.collect_all_And_tokens is False)
     - warn_ungrouped_named_tokens_in_collection - flag to enable warnings when a results
       name is defined on a containing expression with ungrouped subexpressions that also
       have results names
     - warn_name_set_on_empty_Forward - flag to enable warnings whan a Forward is defined
       with a results name, but has no contents defined
     - warn_on_multiple_string_args_to_oneof - flag to enable warnings whan oneOf is
       incorrectly called with multiple str arguments
     - enable_debug_on_named_expressions - flag to auto-enable debug on all subsequent
       calls to ParserElement.setName()
FcCs$g|]}| d¡s| d¡r|‘qS)Zenable_Zwarn_©Ú
startswith)Ú.0ÚnmrrrÚ
<listcomp>¼s
 
rcCsdt_dt_dt_dt_dS©NT)Ú__diag__Ú)warn_multiple_tokens_in_named_alternationÚ)warn_ungrouped_named_tokens_in_collectionÚwarn_name_set_on_empty_ForwardÚ%warn_on_multiple_string_args_to_oneofrrrrÚ_enable_all_warnings¾srÚ __version__Ú__versionTime__Ú
__author__Ú
__compat__rÚAndÚCaselessKeywordÚCaselessLiteralÚ
CharsNotInÚCombineÚDictÚEachÚEmptyÚ
FollowedByÚForwardÚ
GoToColumnÚGroupÚKeywordÚLineEndÚ    LineStartÚLiteralÚ
PrecededByÚ
MatchFirstÚNoMatchÚNotAnyÚ    OneOrMoreÚOnlyOnceÚOptionalÚOrÚParseBaseExceptionÚParseElementEnhanceÚParseExceptionÚParseExpressionÚParseFatalExceptionÚ ParseResultsÚParseSyntaxExceptionÚ ParserElementÚ QuotedStringÚRecursiveGrammarExceptionÚRegexÚSkipToÚ    StringEndÚ StringStartÚSuppressÚTokenÚTokenConverterÚWhiteÚWordÚWordEndÚ    WordStartÚ
ZeroOrMoreÚCharÚ    alphanumsÚalphasÚ
alphas8bitÚ anyCloseTagÚ
anyOpenTagÚ cStyleCommentÚcolÚcommaSeparatedListÚcommonHTMLEntityÚ countedArrayÚcppStyleCommentÚdblQuotedStringÚdblSlashCommentÚ delimitedListÚdictOfÚdowncaseTokensÚemptyÚhexnumsÚ htmlCommentÚjavaStyleCommentÚlineÚlineEndÚ    lineStartÚlinenoÚ makeHTMLTagsÚ makeXMLTagsÚmatchOnlyAtColÚmatchPreviousExprÚmatchPreviousLiteralÚ
nestedExprÚnullDebugActionÚnumsÚoneOfÚopAssocÚoperatorPrecedenceÚ
printablesÚpunc8bitÚpythonStyleCommentÚ quotedStringÚ removeQuotesÚreplaceHTMLEntityÚ replaceWithÚ
restOfLineÚsglQuotedStringÚsrangeÚ    stringEndÚ stringStartÚtraceParseActionÚ unicodeStringÚ upcaseTokensÚ withAttributeÚ indentedBlockÚoriginalTextForÚungroupÚ infixNotationÚ locatedExprÚ    withClassÚ
CloseMatchÚtokenMapÚpyparsing_commonÚpyparsing_unicodeÚ unicode_setÚconditionAsParseActionÚreécCsft|tƒr|Sz
t|ƒWStk
r`t|ƒ t ¡d¡}tdƒ}| dd„¡|     |¡YSXdS)aDrop-in replacement for str(obj) that tries to be Unicode
        friendly. It first tries str(obj). If that fails with
        a UnicodeEncodeError, then it tries unicode(obj). It then
        < returns the unicode object | encodes it with the default
        encoding | ... >.
        Úxmlcharrefreplacez&#\d+;cSs$dtt|ddd…ƒƒdd…S)Nz\urééÿÿÿÿ)ÚhexÚint©ÚtrrrÚ<lambda>ÿóz_ustr.<locals>.<lambda>N)
Ú
isinstanceÚunicodeÚstrÚUnicodeEncodeErrorÚencodeÚsysÚgetdefaultencodingrFÚsetParseActionÚtransformString)ÚobjÚretZ
xmlcharrefrrrÚ_ustrìs
 
r¨z6sum len sorted reversed list tuple set any all min maxccs|]
}|VqdS©Nr)rÚyrrrÚ    <genexpr> sr«écCs:d}dd„d ¡Dƒ}t||ƒD]\}}| ||¡}q |S)z/Escape &, <, >, ", ', etc. in a string of data.z&><"'css|]}d|dVqdS)ú&ú;Nr)rÚsrrrr«sz_xml_escape.<locals>.<genexpr>zamp gt lt quot apos)ÚsplitÚzipÚreplace)ÚdataÚ from_symbolsÚ
to_symbolsÚfrom_Úto_rrrÚ _xml_escapes
r¸Ú
0123456789Z ABCDEFabcdefé\Úccs|]}|tjkr|VqdSr©)ÚstringÚ
whitespace©rÚcrrrr«s
cs@|dk    r |nd‰|rtnt‰tˆƒ‰tˆƒ‡‡‡fdd„ƒ}|S)Nzfailed user-defined conditioncs tˆ|||ƒƒsˆ||ˆƒ‚dSr©)Úbool©r¯Úlrš©Úexc_typeÚfnÚmsgrrÚpa%sz"conditionAsParseAction.<locals>.pa)r@r>Ú _trim_arityr)rÅÚmessageÚfatalrÇrrÃrr‘ s  c@sPeZdZdZddd„Zedd„ƒZdd    „Zd
d „Zd d „Z    ddd„Z
dd„Z dS)r<z7base exception class for all parsing runtime exceptionsrNcCs>||_|dkr||_d|_n ||_||_||_|||f|_dS©Nr»)ÚlocrÆÚpstrÚ parserElementÚargs)ÚselfrÍrÌrÆÚelemrrrÚ__init__0szParseBaseException.__init__cCs||j|j|j|jƒS)z¬
        internal factory method to simplify creating one type of ParseException
        from another - avoids having __init__ signature conflicts among subclasses
        )rÍrÌrÆrÎ)ÚclsÚperrrÚ_from_exception;sz"ParseBaseException._from_exceptioncCsN|dkrt|j|jƒS|dkr,t|j|jƒS|dkrBt|j|jƒSt|ƒ‚dS)zôsupported attributes by name are:
           - lineno - returns the line number of the exception text
           - col - returns the column number of the exception text
           - line - returns the line containing the exception text
        rj)rYÚcolumnrgN)rjrÌrÍrYrgÚAttributeError)rÐÚanamerrrÚ __getattr__CszParseBaseException.__getattr__cCs^|jr@|jt|jƒkrd}qDd|j|j|jd… dd¡}nd}d|j||j|j|jfS)Nz, found end of textz
, found %rr¬z\\ú\r»z%%s%s  (at char %d), (line:%d, col:%d))rÍrÌÚlenr²rÆrjrÖ)rÐÚfoundstrrrrÚ__str__Rs$ÿzParseBaseException.__str__cCst|ƒSr©©r¨©rÐrrrÚ__repr__\szParseBaseException.__repr__ú>!<cCs<|j}|jd}|r4d |d|…|||d…f¡}| ¡S)z…Extracts the exception line from the input string, and marks
           the location of the exception with a special symbol.
        r¬r»N)rgrÖÚjoinÚstrip)rÐÚ markerStringÚline_strÚ line_columnrrrÚ markInputline^s
 
ÿz ParseBaseException.markInputlinecCsd ¡tt|ƒƒS)Nzlineno col line)r°ÚdirÚtyperßrrrÚ__dir__hszParseBaseException.__dir__)rNN)rá) rrrÚ__doc__rÒÚ classmethodrÕrÙrÝràrçrêrrrrr<,s
 
 
 
 
c@seZdZdZeddd„ƒZdS)r>a:
    Exception thrown when parse expressions don't match class;
    supported attributes by name are:
    - lineno - returns the line number of the exception text
    - col - returns the column number of the exception text
    - line - returns the line containing the exception text
 
    Example::
 
        try:
            Word(nums).setName("integer").parseString("ABC")
        except ParseException as pe:
            print(pe)
            print("column: {}".format(pe.col))
 
    prints::
 
       Expected integer (at char 0), (line:1, col:1)
        column: 1
 
    éc Cspddl}|dkrt ¡}g}t|tƒrJ| |j¡| d|jdd¡| d t    |ƒj
|¡¡|dkrf|j |j |d}t ƒ}t|| d…ƒD]Ð\}}|d}|j dd¡}    t|    tƒr|jjd    krÌq”|    |krÖq”| |    ¡t    |    ƒ}
| d
 |
j|
j
|    ¡¡nP|    dk    r,t    |    ƒ}
| d  |
j|
j
¡¡n&|j} | jd kr@q”| d  | j¡¡|d8}|s”qfq”d |¡S)ap
        Method to take an exception and translate the Python internal traceback into a list
        of the pyparsing expressions that caused the exception to be raised.
 
        Parameters:
 
         - exc - exception raised during parsing (need not be a ParseException, in support
           of Python exceptions that might be raised in a parse action)
         - depth (default=16) - number of levels back in the stack trace to list expression
           and function names; if None, the full stack trace names will be listed; if 0, only
           the failing input line, marker, and exception string will be shown
 
        Returns a multi-line string listing the ParserElements and/or function names in the
        exception's stack trace.
 
        Note: the diagnostic output will include string representations of the expressions
        that failed to parse. These representations will be more helpful if you use `setName` to
        give identifiable names to your expressions. Otherwise they will use the default string
        forms, which may be cryptic to read.
 
        explain() is only supported under Python 3.
        rNú r¬ú^z{0}: {1})ÚcontextrÐ)Ú    parseImplÚ _parseNoCachez {0}.{1} - {2}z{0}.{1})Úwrapperz<module>z{0}Ú
)Úinspectr¢Úgetrecursionlimitrr<ÚappendrgrYÚformatrérÚgetinnerframesÚ __traceback__ÚsetÚ    enumerateÚf_localsÚgetrCÚf_codeÚco_nameÚaddrrâ) ÚexcÚdepthrõr§ÚcallersÚseenÚiÚffÚfrmÚf_selfÚ    self_typeÚcoderrrÚexplain‚sL
 
 
 þ
 ÿ zParseException.explainN)rí)rrrrëÚ staticmethodr rrrrr>ksc@seZdZdZdS)r@znuser-throwable exception thrown when inconsistent parse content
       is found; stops all parsing immediatelyN©rrrrërrrrr@Èsc@seZdZdZdS)rBzîjust like :class:`ParseFatalException`, but thrown internally
    when an :class:`ErrorStop<And._ErrorStop>` ('-' operator) indicates
    that parsing is to stop immediately because an unbacktrackable
    syntax error has been found.
    NrrrrrrBÍsc@s eZdZdZdd„Zdd„ZdS)rEziexception thrown by :class:`ParserElement.validate` if the
    grammar could be improperly recursive
    cCs
||_dSr©©ÚparseElementTrace©rÐÚparseElementListrrrrÒæsz"RecursiveGrammarException.__init__cCs
d|jS)NzRecursiveGrammarException: %srrßrrrrÝész!RecursiveGrammarException.__str__N)rrrrërÒrÝrrrrrEâsc@s,eZdZdd„Zdd„Zdd„Zdd„Zd    S)
Ú_ParseResultsWithOffsetcCs||f|_dSr©©Útup)rÐÚp1Úp2rrrrÒísz _ParseResultsWithOffset.__init__cCs
|j|Sr©r©rÐrrrrÚ __getitem__ïsz#_ParseResultsWithOffset.__getitem__cCst|jdƒS©Nr)Úreprrrßrrrràñsz _ParseResultsWithOffset.__repr__cCs|jd|f|_dSrrrrrrÚ    setOffsetósz!_ParseResultsWithOffset.setOffsetN)rrrrÒrràrrrrrrìsrc@sªeZdZdZd]dd„Zddddefdd„Zdd    „Zefd
d „Zd d „Z    dd„Z
dd„Z dd„Z e Z dd„Zdd„Zdd„Zdd„Zdd„ZerœeZeZeZn$eZeZeZdd„Zd d!„Zd"d#„Zd$d%„Zd&d'„Zd^d(d)„Zd*d+„Zd,d-„Zd.d/„Zd0d1„Z d2d3„Z!d4d5„Z"d6d7„Z#d8d9„Z$d:d;„Z%d<d=„Z&d_d?d@„Z'dAdB„Z(dCdD„Z)dEdF„Z*d`dHdI„Z+dJdK„Z,dLdM„Z-dadOdP„Z.dQdR„Z/dSdT„Z0dUdV„Z1dWdX„Z2dYdZ„Z3e4dbd[d\„ƒZ5dS)crAaSStructured parse results, to provide multiple means of access to
    the parsed data:
 
       - as a list (``len(results)``)
       - by list index (``results[0], results[1]``, etc.)
       - by attribute (``results.<resultsName>`` - see :class:`ParserElement.setResultsName`)
 
    Example::
 
        integer = Word(nums)
        date_str = (integer.setResultsName("year") + '/'
                        + integer.setResultsName("month") + '/'
                        + integer.setResultsName("day"))
        # equivalent form:
        # date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
 
        # parseString returns a ParseResults object
        result = date_str.parseString("1999/12/31")
 
        def test(s, fn=repr):
            print("%s -> %s" % (s, fn(eval(s))))
        test("list(result)")
        test("result[0]")
        test("result['month']")
        test("result.day")
        test("'month' in result")
        test("'minutes' in result")
        test("result.dump()", str)
 
    prints::
 
        list(result) -> ['1999', '/', '12', '/', '31']
        result[0] -> '1999'
        result['month'] -> '12'
        result.day -> '31'
        'month' in result -> True
        'minutes' in result -> False
        result.dump() -> ['1999', '/', '12', '/', '31']
        - day: 31
        - month: 12
        - year: 1999
    NTcCs"t||ƒr|St |¡}d|_|Sr)rÚobjectÚ__new__Ú_ParseResults__doinit)rÓÚtoklistÚnameÚasListÚmodalÚretobjrrrr!s
 
 
zParseResults.__new__c
Csd|jrvd|_d|_d|_i|_||_||_|dkr6g}||tƒrP|dd…|_n||tƒrft|ƒ|_n|g|_t    ƒ|_
|dk    r`|r`|s”d|j|<||t ƒr¦t |ƒ}||_||t dƒttfƒrÐ|ddgfks`||tƒrà|g}|r*||tƒrtt|jƒdƒ||<ntt|dƒdƒ||<|||_n6z|d||<Wn$tttfk
r^|||<YnXdS)NFrr»)rÚ_ParseResults__nameÚ_ParseResults__parentÚ_ParseResults__accumNamesÚ_ParseResults__asListÚ_ParseResults__modalÚlistÚ_ParseResults__toklistÚ_generatorTypeÚdictÚ_ParseResults__tokdictr˜r¨réÚ
basestringrArÚKeyErrorÚ    TypeErrorÚ
IndexError)rÐr r!r"r#rrrrrÒ*sB
 
 
 
$
  zParseResults.__init__cCsPt|ttfƒr|j|S||jkr4|j|ddStdd„|j|DƒƒSdS)Nr–rcSsg|] }|d‘qS©rr©rÚvrrrrXsz,ParseResults.__getitem__.<locals>.<listcomp>)rr˜Úslicer+r'r.rArrrrrQs
 
 
zParseResults.__getitem__cCsŒ||tƒr0|j |tƒ¡|g|j|<|d}nD||ttfƒrN||j|<|}n&|j |tƒ¡t|dƒg|j|<|}||tƒrˆt|ƒ|_    dSr)
rr.rþr*r˜r6r+rAÚwkrefr&)rÐÚkr5rÚsubrrrÚ __setitem__Zs
 
 
"
zParseResults.__setitem__c
Csºt|ttfƒr®t|jƒ}|j|=t|tƒrH|dkr:||7}t||dƒ}tt| |¡Žƒ}| ¡|j     
¡D]>\}}|D]0}t |ƒD]"\}\}}    t ||    |    |kƒ||<q„qxqln|j    |=dS©Nrr¬) rr˜r6rÛr+r*ÚrangeÚindicesÚreverser.Úitemsrür)
rÐrÚmylenÚremovedr!Ú occurrencesÚjr8ÚvalueÚpositionrrrÚ __delitem__gs
 
zParseResults.__delitem__cCs
||jkSr©)r.)rÐr8rrrÚ __contains__|szParseResults.__contains__cCs
t|jƒSr©)rÛr+rßrrrÚ__len__szParseResults.__len__cCs
|j Sr©©r+rßrrrÚ__bool__‚szParseResults.__bool__cCs
t|jƒSr©©Úiterr+rßrrrÚ__iter__†szParseResults.__iter__cCst|jddd…ƒS©Nr–rKrßrrrÚ __reversed__‰szParseResults.__reversed__cCs$t|jdƒr|j ¡St|jƒSdS)NÚiterkeys)Úhasattrr.rPrLrßrrrÚ    _iterkeysŒs 
zParseResults._iterkeyscs‡fdd„ˆ ¡DƒS)Nc3s|]}ˆ|VqdSr©r©rr8rßrrr«“sz+ParseResults._itervalues.<locals>.<genexpr>©rRrßrrßrÚ _itervalues’szParseResults._itervaluescs‡fdd„ˆ ¡DƒS)Nc3s|]}|ˆ|fVqdSr©rrSrßrrr«–sz*ParseResults._iteritems.<locals>.<genexpr>rTrßrrßrÚ
_iteritems•szParseResults._iteritemscCs t| ¡ƒS)zVReturns all named result keys (as a list in Python 2.x, as an iterator in Python 3.x).)r*rPrßrrrÚkeys¬szParseResults.keyscCs t| ¡ƒS)zXReturns all named result values (as a list in Python 2.x, as an iterator in Python 3.x).)r*Ú
itervaluesrßrrrÚvalues°szParseResults.valuescCs t| ¡ƒS)zfReturns all named result key-values (as a list of tuples in Python 2.x, as an iterator in Python 3.x).)r*Ú    iteritemsrßrrrr?´szParseResults.itemscCs
t|jƒS)zSince keys() returns an iterator, this method is helpful in bypassing
           code that looks for the existence of any defined results names.)rÀr.rßrrrÚhaskeys¸szParseResults.haskeyscOsŽ|s
dg}| ¡D]*\}}|dkr0|d|f}qtd|ƒ‚qt|dtƒsdt|ƒdksd|d|kr~|d}||}||=|S|d}|SdS)aÁ
        Removes and returns item at specified index (default= ``last``).
        Supports both ``list`` and ``dict`` semantics for ``pop()``. If
        passed no argument or an integer argument, it will use ``list``
        semantics and pop tokens from the list of parsed tokens. If passed
        a non-integer argument (most likely a string), it will use ``dict``
        semantics and pop the corresponding value from any defined results
        names. A second default return value argument is supported, just as in
        ``dict.pop()``.
 
        Example::
 
            def remove_first(tokens):
                tokens.pop(0)
            print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321']
            print(OneOrMore(Word(nums)).addParseAction(remove_first).parseString("0 123 321")) # -> ['123', '321']
 
            label = Word(alphas)
            patt = label("LABEL") + OneOrMore(Word(nums))
            print(patt.parseString("AAB 123 321").dump())
 
            # Use pop() in a parse action to remove named result (note that corresponding value is not
            # removed from list form of results)
            def remove_LABEL(tokens):
                tokens.pop("LABEL")
                return tokens
            patt.addParseAction(remove_LABEL)
            print(patt.parseString("AAB 123 321").dump())
 
        prints::
 
            ['AAB', '123', '321']
            - LABEL: AAB
 
            ['AAB', '123', '321']
        r–Údefaultrz-pop() got an unexpected keyword argument '%s'r¬N)r?r1rr˜rÛ)rÐrÏÚkwargsr8r5Úindexr§Ú defaultvaluerrrÚpop½s"%
ÿ
þzParseResults.popcCs||kr||S|SdS)a[
        Returns named result matching the given key, or if there is no
        such name, then returns the given ``defaultValue`` or ``None`` if no
        ``defaultValue`` is specified.
 
        Similar to ``dict.get()``.
 
        Example::
 
            integer = Word(nums)
            date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
 
            result = date_str.parseString("1999/12/31")
            print(result.get("year")) # -> '1999'
            print(result.get("hour", "not specified")) # -> 'not specified'
            print(result.get("hour")) # -> None
        Nr)rÐÚkeyÚ defaultValuerrrrþôszParseResults.getcCsR|j ||¡|j ¡D]4\}}t|ƒD]"\}\}}t||||kƒ||<q(qdS)a
        Inserts new element at location index in the list of parsed tokens.
 
        Similar to ``list.insert()``.
 
        Example::
 
            print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321']
 
            # use a parse action to insert the parse location in the front of the parsed results
            def insert_locn(locn, tokens):
                tokens.insert(0, locn)
            print(OneOrMore(Word(nums)).addParseAction(insert_locn).parseString("0 123 321")) # -> [0, '0', '123', '321']
        N)r+Úinsertr.r?rür)rÐr^ÚinsStrr!rBr8rDrErrrrc szParseResults.insertcCs|j |¡dS)aó
        Add single element to end of ParseResults list of elements.
 
        Example::
 
            print(OneOrMore(Word(nums)).parseString("0 123 321")) # -> ['0', '123', '321']
 
            # use a parse action to compute the sum of the parsed integers, and add it to the end
            def append_sum(tokens):
                tokens.append(sum(map(int, tokens)))
            print(OneOrMore(Word(nums)).addParseAction(append_sum).parseString("0 123 321")) # -> ['0', '123', '321', 444]
        N)r+r÷)rÐÚitemrrrr÷ s zParseResults.appendcCs&t|tƒr| |¡n |j |¡dS)a    
        Add sequence of elements to end of ParseResults list of elements.
 
        Example::
 
            patt = OneOrMore(Word(alphas))
 
            # use a parse action to append the reverse of the matched strings, to make a palindrome
            def make_palindrome(tokens):
                tokens.extend(reversed([t[::-1] for t in tokens]))
                return ''.join(tokens)
            print(patt.addParseAction(make_palindrome).parseString("lskdj sdlkjf lksd")) # -> 'lskdjsdlkjflksddsklfjkldsjdksl'
        N)rrAÚ__iadd__r+Úextend)rÐÚitemseqrrrrg/s
 zParseResults.extendcCs|jdd…=|j ¡dS)z7
        Clear all elements and results names.
        N)r+r.ÚclearrßrrrriBs zParseResults.clearcCs&z
||WStk
r YdSXdSrË)r0©rÐr!rrrrÙIs
zParseResults.__getattr__cCs| ¡}||7}|Sr©©Úcopy)rÐÚotherr§rrrÚ__add__OszParseResults.__add__csŒ|jrjt|jƒ‰‡fdd„‰|j ¡}‡fdd„|Dƒ}|D],\}}|||<t|dtƒr<t|ƒ|d_q<|j|j7_|j     |j¡|S)Ncs|dkr ˆS|ˆSrr)Úa)Úoffsetrrr›Wrœz'ParseResults.__iadd__.<locals>.<lambda>c    s4g|],\}}|D]}|t|dˆ|dƒƒf‘qqS©rr¬)r©rr8Úvlistr5)Ú    addoffsetrrrYsÿz)ParseResults.__iadd__.<locals>.<listcomp>r)
r.rÛr+r?rrAr7r&r'Úupdate)rÐrmÚ
otheritemsÚotherdictitemsr8r5r)rtrprrfTs
 
 
ÿ zParseResults.__iadd__cCs&t|tƒr|dkr| ¡S||SdSr)rr˜rl©rÐrmrrrÚ__radd__dszParseResults.__radd__cCsdt|jƒt|jƒfS)Nz(%s, %s))rr+r.rßrrrràlszParseResults.__repr__cCsdd dd„|jDƒ¡dS)Nú[ú, css(|] }t|tƒrt|ƒnt|ƒVqdSr©)rrAr¨r©rrrrrr«psz'ParseResults.__str__.<locals>.<genexpr>ú])râr+rßrrrrÝoszParseResults.__str__r»cCsLg}|jD]<}|r |r | |¡t|tƒr8|| ¡7}q
| t|ƒ¡q
|Sr©)r+r÷rrAÚ _asStringListr¨)rÐÚsepÚoutrerrrr~rs
 
 
zParseResults._asStringListcCsdd„|jDƒS)ax
        Returns the parse results as a nested list of matching tokens, all converted to strings.
 
        Example::
 
            patt = OneOrMore(Word(alphas))
            result = patt.parseString("sldkj lsdkj sldkj")
            # even though the result prints in string-like form, it is actually a pyparsing ParseResults
            print(type(result), result) # -> <class 'pyparsing.ParseResults'> ['sldkj', 'lsdkj', 'sldkj']
 
            # Use asList() to create an actual list
            result_list = result.asList()
            print(type(result_list), result_list) # -> <class 'list'> ['sldkj', 'lsdkj', 'sldkj']
        cSs"g|]}t|tƒr| ¡n|‘qSr)rrAr")rÚresrrrrŒsz'ParseResults.asList.<locals>.<listcomp>rIrßrrrr"}szParseResults.asListcs6tr |j}n|j}‡fdd„‰t‡fdd„|ƒDƒƒS)a¬
        Returns the named parse results as a nested dictionary.
 
        Example::
 
            integer = Word(nums)
            date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
 
            result = date_str.parseString('12/31/1999')
            print(type(result), repr(result)) # -> <class 'pyparsing.ParseResults'> (['12', '/', '31', '/', '1999'], {'day': [('1999', 4)], 'year': [('12', 0)], 'month': [('31', 2)]})
 
            result_dict = result.asDict()
            print(type(result_dict), repr(result_dict)) # -> <class 'dict'> {'day': '1999', 'year': '12', 'month': '31'}
 
            # even though a ParseResults supports dict-like access, sometime you just need to have a dict
            import json
            print(json.dumps(result)) # -> Exception: TypeError: ... is not JSON serializable
            print(json.dumps(result.asDict())) # -> {"month": "31", "day": "1999", "year": "12"}
        cs6t|tƒr.| ¡r| ¡S‡fdd„|DƒSn|SdS)Ncsg|] }ˆ|ƒ‘qSrrr4©ÚtoItemrrr¬sz7ParseResults.asDict.<locals>.toItem.<locals>.<listcomp>)rrAr[ÚasDict©r¦r‚rrrƒ§s
 
z#ParseResults.asDict.<locals>.toItemc3s|]\}}|ˆ|ƒfVqdSr©r©rr8r5r‚rrr«°sz&ParseResults.asDict.<locals>.<genexpr>)ÚPY_3r?rZr-)rÐÚitem_fnrr‚rr„Žs
     zParseResults.asDictcCs<t|jƒ}t|j ¡ƒ|_|j|_|j |j¡|j|_|S)zG
        Returns a new copy of a :class:`ParseResults` object.
        )    rAr+r-r.r?r&r'rur%©rÐr§rrrrl²s 
zParseResults.copyFc CsLd}g}tdd„|j ¡Dƒƒ}|d}|s8d}d}d}d}    |dk    rJ|}    n |jrV|j}    |    sf|rbdSd}    |||d|    d    g7}t|jƒD]¬\}
} t| tƒrà|
|krÀ||  ||
|o²|dk||¡g7}n||  d|oÒ|dk||¡g7}q‚d} |
|krô||
} | s|rq‚nd} t    t
| ƒƒ} |||d| d    | d
| d    g    7}q‚|||d
|    d    g7}d  |¡S) z‡
        (Deprecated) Returns the parse results as XML. Tags are created for tokens and lists that have defined results names.
        rôcss(|] \}}|D]}|d|fVqqdS©r¬Nrrrrrrr«Ãsÿz%ParseResults.asXML.<locals>.<genexpr>ú  r»NÚITEMú<ú>ú</) r-r.r?r%rür+rrAÚasXMLr¸r¨râ)rÐÚdoctagÚnamedItemsOnlyÚindentÚ    formattedÚnlr€Ú
namedItemsÚnextLevelIndentÚselfTagrrÚresTagÚ xmlBodyTextrrrr½s^
 
ý
 
ý
  þzParseResults.asXMLcCs:|j ¡D]*\}}|D]\}}||kr|Sqq
dSr©)r.r?)rÐr9r8rsr5rÌrrrÚ__lookupús
 zParseResults.__lookupcCs€|jr |jS|jr.| ¡}|r(| |¡SdSnNt|ƒdkrxt|jƒdkrxtt|j ¡ƒƒdddkrxtt|j ¡ƒƒSdSdS)a
        Returns the results name for this token expression. Useful when several
        different expressions might match at a particular location.
 
        Example::
 
            integer = Word(nums)
            ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d")
            house_number_expr = Suppress('#') + Word(nums, alphanums)
            user_data = (Group(house_number_expr)("house_number")
                        | Group(ssn_expr)("ssn")
                        | Group(integer)("age"))
            user_info = OneOrMore(user_data)
 
            result = user_info.parseString("22 111-22-3333 #221B")
            for item in result:
                print(item.getName(), ':', item[0])
 
        prints::
 
            age : 22
            ssn : 111-22-3333
            house_number : 221B
        Nr¬r)rr–)    r%r&Ú_ParseResults__lookuprÛr.ÚnextrLrYrW)rÐÚparrrrÚgetNames
  ÿþzParseResults.getNamerc Csvg}d}|r$| |t| ¡ƒ¡n
| d¡|rl| ¡rÒtdd„| ¡Dƒƒ}|D]x\}}    |rl| |¡| d|d||f¡t|    tƒrÀ|    r°| |    j||||dd¡qÎ| t|    ƒ¡qV| t    |    ƒ¡qVnšt
d    d„|Dƒƒrl|}    t |    ƒD]x\}
} t| tƒr@| d
|d||
|d|d| j||||ddf¡qò| d
|d||
|d|dt| ƒf¡qòd  |¡S) aF
        Diagnostic method for listing out the contents of
        a :class:`ParseResults`. Accepts an optional ``indent`` argument so
        that this string can be embedded in a nested display of other data.
 
        Example::
 
            integer = Word(nums)
            date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
 
            result = date_str.parseString('12/31/1999')
            print(result.dump())
 
        prints::
 
            ['12', '/', '31', '/', '1999']
            - day: 1999
            - month: 31
            - year: 12
        rôr»css|]\}}t|ƒ|fVqdSr©)rŸr†rrrr«Gsz$ParseResults.dump.<locals>.<genexpr>z
%s%s- %s: r‹r¬)r“ÚfullÚ include_listÚ_depthcss|]}t|tƒVqdSr©)rrA)rÚvvrrrr«Ssz
%s%s[%d]:
%s%s%s) r÷r¨r"r[Úsortedr?rrAÚdumprÚanyrürâ) rÐr“r r¡r¢r€ÚNLr?r8r5rr£rrrr¥)sP
 
 
 
ýû
 
 
û
zParseResults.dumpcOstj| ¡f|ž|ŽdS)a#
        Pretty-printer for parsed results as a list, using the
        `pprint <https://docs.python.org/3/library/pprint.html>`_ module.
        Accepts additional positional or keyword args as defined for
        `pprint.pprint <https://docs.python.org/3/library/pprint.html#pprint.pprint>`_ .
 
        Example::
 
            ident = Word(alphas, alphanums)
            num = Word(nums)
            func = Forward()
            term = ident | num | Group('(' + func + ')')
            func <<= ident + Group(Optional(delimitedList(term)))
            result = func.parseString("fna a,b,(fnb c,d,200),100")
            result.pprint(width=40)
 
        prints::
 
            ['fna',
             ['a',
              'b',
              ['(', 'fnb', ['c', 'd', '200'], ')'],
              '100']]
        N)Úpprintr"©rÐrÏr]rrrr¨jszParseResults.pprintcCs.|j|j ¡|jdk    r| ¡p d|j|jffSr©)r+r.rlr&r'r%rßrrrÚ __getstate__†sýÿzParseResults.__getstate__cCsN|d|_|d\|_}}|_i|_|j |¡|dk    rDt|ƒ|_nd|_dSr;)r+r.r%r'rur7r&)rÐÚstateržÚ inAccumNamesrrrÚ __setstate__s
  zParseResults.__setstate__cCs|j|j|j|jfSr©)r+r%r(r)rßrrrÚ__getnewargs__—szParseResults.__getnewargs__cCstt|ƒƒt| ¡ƒSr©)rèrér*rWrßrrrrêšszParseResults.__dir__cCsrdd„}|gƒ}| ¡D]>\}}t|tƒr>||j||d7}q|||g|||ƒd7}q|dk    rn||g|d}|S)zã
        Helper classmethod to construct a ParseResults from a dict, preserving the
        name-value relations as results names. If an optional 'name' argument is
        given, a nested ParseResults will be returned
        cSsHz t|ƒWntk
r"YdSXtr8t|ttfƒ St|tƒ SdS©NF)rLÚ    Exceptionr‡rrŸÚbytesr/r…rrrÚ is_iterable¤s z+ParseResults.from_dict.<locals>.is_iterable©r!)r!r"N)r?rr Ú    from_dict)rÓrmr!r²r§r8r5rrrr´s 
zParseResults.from_dict)NNTT)N)r»)NFr»T)r»TTr)N)6rrrrërrrÒrr:rFrGrHrJÚ __nonzero__rMrOrRrUrVr‡rWrYr?rPrXrZr[r`rþrcr÷rgrirÙrnrfryràrÝr~r"r„rlrrœrŸr¥r¨rªr­r®rêrìr´rrrrrAösl*
    '     7
 
$
=(
A
cCsF|}d|krt|ƒkr4nn||ddkr4dS|| dd|¡S)añReturns current column within a string, counting newlines as line separators.
   The first column is number 1.
 
   Note: the default parsing behavior is to expand tabs in the input string
   before starting the parsing process.  See
   :class:`ParserElement.parseString` for more
   information on parsing strings containing ``<TAB>`` s, and suggested
   methods to maintain a consistent view of the parsed string, the parse
   location, and line and column positions within the parsed string.
   rr¬rô)rÛÚrfind)rÌÚstrgr¯rrrrY»s cCs| dd|¡dS)aùReturns current line number within a string, counting newlines as line separators.
    The first line is number 1.
 
    Note - the default parsing behavior is to expand tabs in the input string
    before starting the parsing process.  See :class:`ParserElement.parseString`
    for more information on parsing strings containing ``<TAB>`` s, and
    suggested methods to maintain a consistent view of the parsed string, the
    parse location, and line and column positions within the parsed string.
    rôrr¬)Úcount)rÌr·rrrrjÉs
cCsF| dd|¡}| d|¡}|dkr2||d|…S||dd…SdS)zfReturns the line of text containing loc within a string, counting newlines as line separators.
       rôrr¬N)r¶Úfind)rÌr·ÚlastCRÚnextCRrrrrgÕs
 cCs8tdt|ƒdt|ƒdt||ƒt||ƒfƒdS)NzMatch z at loc z(%d,%d))Úprintr¨rjrY)ÚinstringrÌÚexprrrrÚ_defaultStartDebugActionßsr¿cCs$tdt|ƒdt| ¡ƒƒdS)NzMatched z -> )r¼r¨rŸr")r½ÚstartlocÚendlocr¾ÚtoksrrrÚ_defaultSuccessDebugActionâsrÃcCstdt|ƒƒdS)NzException raised:)r¼r¨)r½rÌr¾rrrrÚ_defaultExceptionDebugActionåsrÄcGsdS)zG'Do-nothing' debug action, to suppress debugging output during parsing.Nr)rÏrrrrqèsr•cs҈tkr‡fdd„Sdg‰dg‰tdd…dkrFddd„}dd    d
„‰n tj}tj‰d }|dd d }|d|d|f‰‡‡‡‡‡‡fdd„}d}ztˆdtˆdƒjƒ}Wntk
rÆtˆƒ}YnX||_|S)Ncsˆ|ƒSr©rrÁ)Úfuncrrr›rœz_trim_arity.<locals>.<lambda>rFr•)r“écSs8tdkr dnd}tj| |dd|}|dd…gS)N)r“rÆréýÿÿÿéþÿÿÿr¬©Úlimitr•)Úsystem_versionÚ    tracebackÚ extract_stack)rÊrpÚ frame_summaryrrrrÍ sz"_trim_arity.<locals>.extract_stackcSs$tj||d}|d}|dd…gS)NrÉr–r•)rÌÚ
extract_tb)ÚtbrÊÚframesrÎrrrrÏsz_trim_arity.<locals>.extract_tbérÉr–r¬csºz"ˆ|ˆdd…Ž}dˆd<|WStk
r²ˆdr>‚nNz.t ¡d}ˆ|ddddd…ˆksj‚W5z~Wntk
rˆYnXXˆdˆkr¬ˆdd7<Yq‚YqXqdS)NrTr–r•rÉr¬)r1Ú    NameErrorr¢Úexc_info)rÏr§rЩrÏÚ
foundArityrÅrÊÚmaxargsÚpa_call_line_synthrrró!s&  z_trim_arity.<locals>.wrapperz<parse action>rÚ    __class__)r)r)    ÚsingleArgBuiltinsrËrÌrÍrÏÚgetattrrr°rŸ)rÅr×rÍÚ    LINE_DIFFÚ    this_lineróÚ    func_namerrÕrrÈs, 
 
ÿrÈc@s°eZdZdZdZdZedd„ƒZedd„ƒZe    dd    „ƒZ
dŽd
d „Z d d „Z dd„Z ddd„Zddd„Zd‘dd„Zdd„Zdd„Zdd„Zdd„Zdd „Zd!d"„Zd’d#d$„Zd%d&„Zd“d'd(„Zd)d*„Zd+d,„ZGd-d.„d.eƒZed/k    røGd0d1„d1eƒZnGd2d1„d1eƒZiZ e!ƒZ"d3d3gZ#d”d4d5„Z$eZ%ed6d7„ƒZ&dZ'ed•d9d:„ƒZ(d–d;d<„Z)e*dfd=d>„Z+d?d@„Z,e*fdAdB„Z-e*dfdCdD„Z.dEdF„Z/dGdH„Z0dIdJ„Z1dKdL„Z2dMdN„Z3dOdP„Z4dQdR„Z5dSdT„Z6dUdV„Z7dWdX„Z8dYdZ„Z9d[d\„Z:d]d^„Z;d_d`„Z<dadb„Z=d—dcdd„Z>dedf„Z?dgdh„Z@didj„ZAdkdl„ZBdmdn„ZCdodp„ZDd˜dqdr„ZEdsdt„ZFdudv„ZGdwdx„ZHdydz„ZId™d{d|„ZJdšd}d~„ZKdd€„ZLdd‚„ZMdƒd„„ZNd…d†„ZOd‡dˆ„ZPd›d‰dŠ„ZQdœdŒd„ZRd/S)rCz)Abstract base level parser element class.z 
     FcCs
|t_dS)aÆ
        Overrides the default whitespace chars
 
        Example::
 
            # default whitespace chars are space, <TAB> and newline
            OneOrMore(Word(alphas)).parseString("abc def\nghi jkl")  # -> ['abc', 'def', 'ghi', 'jkl']
 
            # change to just treat newline as significant
            ParserElement.setDefaultWhitespaceChars(" \t")
            OneOrMore(Word(alphas)).parseString("abc def\nghi jkl")  # -> ['abc', 'def']
        N)rCÚDEFAULT_WHITE_CHARS©ÚcharsrrrÚsetDefaultWhitespaceCharsLsz'ParserElement.setDefaultWhitespaceCharscCs
|t_dS)ah
        Set class to be used for inclusion of string literals into a parser.
 
        Example::
 
            # default literal class used is Literal
            integer = Word(nums)
            date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
 
            date_str.parseString("1999/12/31")  # -> ['1999', '/', '12', '/', '31']
 
 
            # change to Suppress
            ParserElement.inlineLiteralsUsing(Suppress)
            date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
 
            date_str.parseString("1999/12/31")  # -> ['1999', '12', '31']
        N)rCÚ_literalStringClass©rÓrrrÚinlineLiteralsUsing\sz!ParserElement.inlineLiteralsUsingcCs|jr|j}q|Sr©)Útb_next)rÓrÐrrrÚ_trim_tracebackrszParserElement._trim_tracebackcCs†tƒ|_d|_d|_d|_||_d|_ttj    ƒ|_
d|_ d|_ d|_ tƒ|_d|_d|_d|_d|_d|_d|_d|_d|_d|_dS)NTFr»)NNN)r*Ú parseActionÚ
failActionÚstrReprÚ resultsNameÚ
saveAsListÚskipWhitespacerûrCrßÚ
whiteCharsÚcopyDefaultWhiteCharsÚmayReturnEmptyÚkeepTabsÚ ignoreExprsÚdebugÚ streamlinedÚ mayIndexErrorÚerrmsgÚ modalResultsÚ debugActionsr’Ú callPreparseÚ callDuringTry)rÐÚsavelistrrrrÒxs( zParserElement.__init__cCs<t |¡}|jdd…|_|jdd…|_|jr8tj|_|S)a/
        Make a copy of this :class:`ParserElement`.  Useful for defining
        different parse actions for the same parsing pattern, using copies of
        the original parse element.
 
        Example::
 
            integer = Word(nums).setParseAction(lambda toks: int(toks[0]))
            integerK = integer.copy().addParseAction(lambda toks: toks[0] * 1024) + Suppress("K")
            integerM = integer.copy().addParseAction(lambda toks: toks[0] * 1024 * 1024) + Suppress("M")
 
            print(OneOrMore(integerK | integerM | integer).parseString("5K 100 640K 256M"))
 
        prints::
 
            [5120, 100, 655360, 268435456]
 
        Equivalent form of ``expr.copy()`` is just ``expr()``::
 
            integerM = integer().addParseAction(lambda toks: toks[0] * 1024 * 1024) + Suppress("M")
        N)rlrèròrïrCrßrî)rÐÚcpyrrrrls 
zParserElement.copycCs$||_d|j|_tjr | ¡|S)a_
        Define name for this expression, makes debugging and exception messages clearer.
 
        Example::
 
            Word(nums).parseString("ABC")  # -> Exception: Expected W:(0123...) (at char 0), (line:1, col:1)
            Word(nums).setName("integer").parseString("ABC")  # -> Exception: Expected integer (at char 0), (line:1, col:1)
        ú    Expected )r!rörÚ!enable_debug_on_named_expressionsÚsetDebugrjrrrÚsetName¬s
     zParserElement.setNamecCs | ||¡S)aO
        Define name for referencing matching tokens as a nested attribute
        of the returned parse results.
        NOTE: this returns a *copy* of the original :class:`ParserElement` object;
        this is so that the client can define a basic element, such as an
        integer, and reference it in multiple places with different names.
 
        You can also set results names using the abbreviated syntax,
        ``expr("name")`` in place of ``expr.setResultsName("name")``
        - see :class:`__call__`.
 
        Example::
 
            date_str = (integer.setResultsName("year") + '/'
                        + integer.setResultsName("month") + '/'
                        + integer.setResultsName("day"))
 
            # equivalent form:
            date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
        )Ú_setResultsName©rÐr!ÚlistAllMatchesrrrÚsetResultsName»szParserElement.setResultsNamecCs4| ¡}| d¡r"|dd…}d}||_| |_|S)NÚ*r–T)rlÚendswithrër÷)rÐr!rÚnewselfrrrrÒs
 zParserElement._setResultsNameTcs@|r&|j‰d‡fdd„    }ˆ|_||_nt|jdƒr<|jj|_|S)z§Method to invoke the Python pdb debugger when this element is
           about to be parsed. Set ``breakFlag`` to True to enable, False to
           disable.
        Tcsddl}| ¡ˆ||||ƒSr)ÚpdbÚ    set_trace)r½rÌÚ    doActionsÚ callPreParser©Ú _parseMethodrrÚbreakerâsz'ParserElement.setBreak.<locals>.breakerÚ_originalParseMethod)TT)Ú_parserrQ)rÐÚ    breakFlagrrr rÚsetBreakÛs 
zParserElement.setBreakcOsVt|ƒdgkrg|_n<tdd„|Dƒƒs0tdƒ‚tttt|ƒƒƒ|_| dd¡|_|S)a’
        Define one or more actions to perform when successfully matching parse element definition.
        Parse action fn is a callable method with 0-3 arguments, called as ``fn(s, loc, toks)`` ,
        ``fn(loc, toks)`` , ``fn(toks)`` , or just ``fn()`` , where:
 
        - s   = the original string being parsed (see note below)
        - loc = the location of the matching substring
        - toks = a list of the matched tokens, packaged as a :class:`ParseResults` object
 
        If the functions in fns modify the tokens, they can return them as the return
        value from fn, and the modified list of tokens will replace the original.
        Otherwise, fn does not need to return any value.
 
        If None is passed as the parse action, all previously added parse actions for this
        expression are cleared.
 
        Optional keyword arguments:
        - callDuringTry = (default= ``False``) indicate if parse action should be run during lookaheads and alternate testing
 
        Note: the default parsing behavior is to expand tabs in the input string
        before starting the parsing process.  See :class:`parseString for more
        information on parsing strings containing ``<TAB>`` s, and suggested
        methods to maintain a consistent view of the parsed string, the parse
        location, and line and column positions within the parsed string.
 
        Example::
 
            integer = Word(nums)
            date_str = integer + '/' + integer + '/' + integer
 
            date_str.parseString("1999/12/31")  # -> ['1999', '/', '12', '/', '31']
 
            # use parse action to convert to ints at parse time
            integer = Word(nums).setParseAction(lambda toks: int(toks[0]))
            date_str = integer + '/' + integer + '/' + integer
 
            # note that integer fields are now ints, not strings
            date_str.parseString("1999/12/31")  # -> [1999, '/', 12, '/', 31]
        Ncss|]}t|ƒVqdSr©)Úcallable)rrÅrrrr«sz/ParserElement.setParseAction.<locals>.<genexpr>zparse actions must be callablerúF)r*rèÚallr1ÚmaprÈrþrú©rÐÚfnsr]rrrr¤îs(zParserElement.setParseActioncOs4|jtttt|ƒƒƒ7_|jp,| dd¡|_|S)z›
        Add one or more parse actions to expression's list of parse actions. See :class:`setParseAction`.
 
        See examples in :class:`copy`.
        rúF)rèr*rrÈrúrþrrrrÚaddParseActionszParserElement.addParseActionc
OsF|D](}|j t|| d¡| dd¡d¡q|jp>| dd¡|_|S)a¼Add a boolean predicate function to expression's list of parse actions. See
        :class:`setParseAction` for function call signatures. Unlike ``setParseAction``,
        functions passed to ``addCondition`` need to return boolean success/fail of the condition.
 
        Optional keyword arguments:
        - message = define a custom message to be used in the raised exception
        - fatal   = if True, will raise ParseFatalException to stop parsing immediately; otherwise will raise ParseException
 
        Example::
 
            integer = Word(nums).setParseAction(lambda toks: int(toks[0]))
            year_int = integer.copy()
            year_int.addCondition(lambda toks: toks[0] >= 2000, message="Only support years 2000 and later")
            date_str = year_int + '/' + integer + '/' + integer
 
            result = date_str.parseString("1999/12/31")  # -> Exception: Only support years 2000 and later (at char 0), (line:1, col:1)
        rÉrÊF)rÉrÊrú)rèr÷r‘rþrú)rÐrr]rÅrrrÚ addCondition)s 
ÿ
zParserElement.addConditioncCs
||_|S)aDefine action to perform if parsing fails at this expression.
           Fail acton fn is a callable function that takes the arguments
           ``fn(s, loc, expr, err)`` where:
           - s = string being parsed
           - loc = location where expression match was attempted and failed
           - expr = the parse expression that failed
           - err = the exception thrown
           The function returns no value.  It may throw :class:`ParseFatalException`
           if it is desired to stop parsing immediately.)ré©rÐrÅrrrÚ setFailActionBs
zParserElement.setFailActionc    CsNd}|rJd}|jD]4}z| ||¡\}}d}qWqtk
rDYqXqq|S©NTF)ròrr>)rÐr½rÌÚ
exprsFoundÚeÚdummyrrrÚ_skipIgnorablesOs
 
 
zParserElement._skipIgnorablescCsH|jr| ||¡}|jrD|j}t|ƒ}||krD|||krD|d7}q&|S©Nr¬)ròr rírîrÛ)rÐr½rÌÚwtÚinstrlenrrrÚpreParse\s 
zParserElement.preParsecCs|gfSr©r©rÐr½rÌr
rrrrñhszParserElement.parseImplcCs|Sr©r©rÐr½rÌÚ    tokenlistrrrÚ    postParsekszParserElement.postParsec Csd\}}}|j}|s|jr"|j|r8|j||||ƒzŠ|rR|jrR| ||¡}    n|}    |    }
|jsl|    t|ƒkr®z| ||    |¡\}} WqÀtk
rªt    |t|ƒ|j
|ƒ‚YqÀXn| ||    |¡\}} Wn\t k
r} z<|j|rô|j|||
|| ƒ|jr | ||
|| ¡‚W5d} ~ XYnXn|r>|jr>| ||¡}    n|}    |    }
|js\|    t|ƒkr z| ||    |¡\}} Wn*tk
rœt    |t|ƒ|j
|ƒ‚YnXn| ||    |¡\}} |  ||| ¡} t | |j|j|jd} |jr`|sì|jr`|rÐz”|jD]ˆ}z|||
| ƒ} Wn6tk
rD}zt    dƒ}||_|‚W5d}~XYnX| dk    rú| | k    rút | |j|jovt| t tfƒ|jd} qúWnFt k
rÌ} z&|j|rº|j|||
|| ƒ‚W5d} ~ XYnXn|jD]ˆ}z|||
| ƒ} Wn6tk
r }zt    dƒ}||_|‚W5d}~XYnX| dk    rÖ| | k    rÖt | |j|joRt| t tfƒ|jd} qÖ|rˆ|j|rˆ|j|||
||| ƒ|| fS)N)rr¬r•)r"r#z exception raised in parse action)rórérørùr$rõrÛrñr2r>rör°r(rArërìr÷rèrúÚ    __cause__rr*)rÐr½rÌr
r ÚTRYÚMATCHÚFAILÚ    debuggingÚprelocÚ tokensStartÚtokensÚerrÚ    retTokensrÅÚparse_action_excrrrrròosŽ
 
 
 
 
ý 
ý
 zParserElement._parseNoCachecCs@z|j||dddWStk
r:t|||j|ƒ‚YnXdS)NF©r
r)rr@r>rö©rÐr½rÌrrrÚtryParseÆszParserElement.tryParsec    Cs4z| ||¡Wnttfk
r*YdSXdSdS)NFT)r6r>r2r5rrrÚ canParseNextÌs
zParserElement.canParseNextc@seZdZdd„ZdS)zParserElement._UnboundedCachecs~i‰tƒ|_‰‡‡fdd„}‡fdd„}‡fdd„}‡fdd„}t ||¡|_t ||¡|_t ||¡|_t ||¡|_dS)    Ncs ˆ |ˆ¡Sr©©rþ©rÐra©ÚcacheÚ not_in_cacherrrþÙsz3ParserElement._UnboundedCache.__init__.<locals>.getcs |ˆ|<dSr©r©rÐrarD©r;rrrûÜsz3ParserElement._UnboundedCache.__init__.<locals>.setcs ˆ ¡dSr©©rirßr>rrrißsz5ParserElement._UnboundedCache.__init__.<locals>.clearcstˆƒSr©©rÛrßr>rrÚ    cache_lenâsz9ParserElement._UnboundedCache.__init__.<locals>.cache_len)rr<ÚtypesÚ
MethodTyperþrûrirH)rÐrþrûrirArr:rrÒÕs    z&ParserElement._UnboundedCache.__init__N©rrrrÒrrrrÚ_UnboundedCacheÔsrENc@seZdZdd„ZdS)úParserElement._FifoCachecs‚tƒ|_‰tƒ‰‡‡fdd„}‡‡fdd„}‡fdd„}‡fdd„}t ||¡|_t ||¡|_t ||¡|_t ||¡|_dS)    Ncs ˆ |ˆ¡Sr©r8r9r:rrrþñsú.ParserElement._FifoCache.__init__.<locals>.getcs>|ˆ|<tˆƒˆkr:zˆ d¡Wqtk
r6YqXqdSr¯)rÛÚpopitemr0r=)r;Úsizerrrûôs  ú.ParserElement._FifoCache.__init__.<locals>.setcs ˆ ¡dSr©r?rßr>rrriüsú0ParserElement._FifoCache.__init__.<locals>.clearcstˆƒSr©r@rßr>rrrAÿsú4ParserElement._FifoCache.__init__.<locals>.cache_len)    rr<Ú _OrderedDictrBrCrþrûrirH©rÐrIrþrûrirAr)r;r<rIrrÒìs   ú!ParserElement._FifoCache.__init__NrDrrrrÚ
_FifoCacheësrPc@seZdZdd„ZdS)rFcstƒ|_‰i‰t gˆ¡‰‡‡fdd„}‡‡‡fdd„}‡‡fdd„}‡fdd„}t ||¡|_t ||¡|_t ||¡|_t ||¡|_    dS)    Ncs ˆ |ˆ¡Sr©r8r9r:rrrþsrGcs4|ˆ|<tˆƒˆkr&ˆ ˆ ¡d¡qˆ |¡dSr©)rÛr`Úpopleftr÷r=)r;Úkey_fiforIrrrûs rJcsˆ ¡ˆ ¡dSr©r?rß)r;rRrrrisrKcstˆƒSr©r@rßr>rrrAsrL)
rr<Ú collectionsÚdequerBrCrþrûrirHrNr)r;rRr<rIrrÒ    s   rONrDrrrrrPsrc Csd\}}|||||f}tjîtj}| |¡}    |    |jkrÆtj|d7<z| ||||¡}    Wn8tk
r–}
z| ||
j    |
j
Ž¡‚W5d}
~
XYn.X| ||    d|    d  ¡f¡|    W5QR£Sn@tj|d7<t |    t ƒræ|    ‚|    d|    d  ¡fW5QR£SW5QRXdS)Nrqr¬r)rCÚpackrat_cache_lockÚ packrat_cacherþr<Úpackrat_cache_statsròr<rûrÙrÏrlrr°) rÐr½rÌr
r ÚHITÚMISSÚlookupr;rDrÔrrrÚ _parseCache+s$
 
 
zParserElement._parseCachecCs(tj ¡dgttjƒtjdd…<dSr)rCrVrirÛrWrrrrÚ
resetCacheDs
zParserElement.resetCacheé€cCs8tjs4dt_|dkr t ¡t_n t |¡t_tjt_dS)aÒEnables "packrat" parsing, which adds memoizing to the parsing logic.
           Repeated parse attempts at the same string location (which happens
           often in many complex grammars) can immediately return a cached value,
           instead of re-executing parsing/validating code.  Memoizing is done of
           both valid results and parsing exceptions.
 
           Parameters:
 
           - cache_size_limit - (default= ``128``) - if an integer value is provided
             will limit the size of the packrat cache; if None is passed, then
             the cache size will be unbounded; if 0 is passed, the cache will
             be effectively disabled.
 
           This speedup may break existing programs that use parse actions that
           have side-effects.  For this reason, packrat parsing is disabled when
           you first import pyparsing.  To activate the packrat feature, your
           program must call the class method :class:`ParserElement.enablePackrat`.
           For best results, call ``enablePackrat()`` immediately after
           importing pyparsing.
 
           Example::
 
               from pip._vendor import pyparsing
               pyparsing.ParserElement.enablePackrat()
        TN)rCÚ_packratEnabledrErVrPr[r)Úcache_size_limitrrrÚ enablePackratJs   zParserElement.enablePackratc
CsÌt ¡|js| ¡|jD] }| ¡q|js8| ¡}z<| |d¡\}}|rr| ||¡}t    ƒt
ƒ}| ||¡WnNt k
rÂ}z0tj r‚n"t |ddƒdk    r®| |j¡|_|‚W5d}~XYnX|SdS)aû
        Execute the parse expression with the given string.
        This is the main interface to the client code, once the complete
        expression has been built.
 
        Returns the parsed data as a :class:`ParseResults` object, which may be
        accessed as a list, or as a dict or object with attributes if the given parser
        includes results names.
 
        If you want the grammar to require that the entire input string be
        successfully parsed, then set ``parseAll`` to True (equivalent to ending
        the grammar with ``StringEnd()``).
 
        Note: ``parseString`` implicitly calls ``expandtabs()`` on the input string,
        in order to report proper column numbers in parse actions.
        If the input string contains tabs and
        the grammar uses parse actions that use the ``loc`` argument to index into the
        string being parsed, you can ensure you have a consistent view of the input
        string by:
 
        - calling ``parseWithTabs`` on your grammar before calling ``parseString``
          (see :class:`parseWithTabs`)
        - define your parse action using the full ``(s, loc, toks)`` signature, and
          reference the input string using the parse action's ``s`` argument
        - explictly expand the tabs in your input string before calling
          ``parseString``
 
        Example::
 
            Word('a').parseString('aaaaabaaa')  # -> ['aaaaa']
            Word('a').parseString('aaaaabaaa', parseAll=True)  # -> Exception: Expected end of text
        rrúN)rCr\rôÚ
streamlineròrñÚ
expandtabsrr$r+rHr<Úverbose_stacktracerÛrçrú)rÐr½ÚparseAllrrÌr0ÚserrrrÚ parseStringms(!
 
  zParserElement.parseStringc
csV|js| ¡|jD] }| ¡q|js4t|ƒ ¡}t|ƒ}d}|j}|j}t     
¡d}    z¤||krú|    |krúz |||ƒ}
|||
dd\} } Wnt k
r¦|
d}YqZX| |krð|    d7}    | |
| fV|rê|||ƒ} | |krà| }qî|d7}qø| }qZ|
d}qZWnTt k
rP}z4t    j r‚n$t|ddƒdk    r<| |j¡|_|‚W5d}~XYnXdS)aq
        Scan the input string for expression matches.  Each match will return the
        matching tokens, start location, and end location.  May be called with optional
        ``maxMatches`` argument, to clip scanning after 'n' matches are found.  If
        ``overlap`` is specified, then overlapping matches will be reported.
 
        Note that the start and end locations are reported relative to the string
        being parsed.  See :class:`parseString` for more information on parsing
        strings with embedded tabs.
 
        Example::
 
            source = "sldjf123lsdjjkf345sldkjf879lkjsfd987"
            print(source)
            for tokens, start, end in Word(alphas).scanString(source):
                print(' '*start + '^'*(end-start))
                print(' '*start + tokens[0])
 
        prints::
 
            sldjf123lsdjjkf345sldkjf879lkjsfd987
            ^^^^^
            sldjf
                    ^^^^^^^
                    lsdjjkf
                              ^^^^^^
                              sldkjf
                                       ^^^^^^
                                       lkjsfd
        rF©r r¬rúN)rôraròrñr¨rbrÛr$rrCr\r>r<rcrÛrçrú)rÐr½Ú
maxMatchesÚoverlaprr#rÌÚ
preparseFnÚparseFnÚmatchesr.ÚnextLocr0ÚnextlocrrrrÚ
scanString§sF
 
 
 
 
zParserElement.scanStringc
Csþg}d}d|_zœ| |¡D]Z\}}}| |||…¡|rpt|tƒrR|| ¡7}nt|tƒrf||7}n
| |¡|}q| ||d…¡dd„|Dƒ}d tt    t
|ƒƒ¡WSt k
rø}z0t j rƂn"t|ddƒdk    rä| |j¡|_|‚W5d}~XYnXdS)a[
        Extension to :class:`scanString`, to modify matching text with modified tokens that may
        be returned from a parse action.  To use ``transformString``, define a grammar and
        attach a parse action to it that modifies the returned token list.
        Invoking ``transformString()`` on a target string will then scan for matches,
        and replace the matched text patterns according to the logic in the parse
        action.  ``transformString()`` returns the resulting transformed string.
 
        Example::
 
            wd = Word(alphas)
            wd.setParseAction(lambda toks: toks[0].title())
 
            print(wd.transformString("now is the winter of our discontent made glorious summer by this sun of york."))
 
        prints::
 
            Now Is The Winter Of Our Discontent Made Glorious Summer By This Sun Of York.
        rTNcSsg|] }|r|‘qSrr©rÚorrrrsz1ParserElement.transformString.<locals>.<listcomp>r»rú)rñror÷rrAr"r*rârr¨Ú_flattenr<rCrcrÛrçrú)rÐr½r€ÚlastEršr¯rrrrrr¥ñs,
 
 
 
zParserElement.transformStringc
Cspztdd„| ||¡DƒƒWStk
rj}z0tjr8‚n"t|ddƒdk    rV| |j¡|_|‚W5d}~XYnXdS)a 
        Another extension to :class:`scanString`, simplifying the access to the tokens found
        to match the given parse expression.  May be called with optional
        ``maxMatches`` argument, to clip searching after 'n' matches are found.
 
        Example::
 
            # a capitalized word starts with an uppercase letter, followed by zero or more lowercase letters
            cap_word = Word(alphas.upper(), alphas.lower())
 
            print(cap_word.searchString("More than Iron, more than Lead, more than Gold I need Electricity"))
 
            # the sum() builtin can be used to merge results into a single ParseResults object
            print(sum(cap_word.searchString("More than Iron, more than Lead, more than Gold I need Electricity")))
 
        prints::
 
            [['More'], ['Iron'], ['Lead'], ['Gold'], ['I'], ['Electricity']]
            ['More', 'Iron', 'Lead', 'Gold', 'I', 'Electricity']
        cSsg|]\}}}|‘qSrr)rršr¯rrrrr7sz.ParserElement.searchString.<locals>.<listcomp>rúN)rAror<rCrcrÛrçrú)rÐr½rhrrrrÚ searchString!szParserElement.searchStringc    csTd}d}|j||dD]*\}}}|||…V|r<|dV|}q||d…VdS)aR
        Generator method to split a string using the given expression as a separator.
        May be called with optional ``maxsplit`` argument, to limit the number of splits;
        and the optional ``includeSeparators`` argument (default= ``False``), if the separating
        matching text should be included in the split results.
 
        Example::
 
            punc = oneOf(list(".,;:/-!?"))
            print(list(punc.split("This, this?, this sentence, is badly punctuated!")))
 
        prints::
 
            ['This', ' this', '', ' this sentence', ' is badly punctuated', '']
        r)rhN)ro)    rÐr½ÚmaxsplitÚincludeSeparatorsÚsplitsÚlastršr¯rrrrr°As
zParserElement.splitcCsV|tkrt|ƒSt|tƒr$| |¡}t|tƒsJtjdt|ƒt    dddSt
||gƒS)a[
        Implementation of + operator - returns :class:`And`. Adding strings to a ParserElement
        converts them to :class:`Literal`s by default.
 
        Example::
 
            greet = Word(alphas) + "," + Word(alphas) + "!"
            hello = "Hello, World!"
            print (hello, "->", greet.parseString(hello))
 
        prints::
 
            Hello, World! -> ['Hello', ',', 'World', '!']
 
        ``...`` may be used as a parse expression as a short form of :class:`SkipTo`.
 
            Literal('start') + ... + Literal('end')
 
        is equivalent to:
 
            Literal('start') + SkipTo('end')("_skipped*") + Literal('end')
 
        Note that the skipped text is returned with '_skipped' as a results name,
        and to support having multiple skips in the same parser, the value returned is
        a list of all skipped text.
        ú4Cannot combine element of type %s with ParserElementr•©Ú
stacklevelN) ÚEllipsisÚ _PendingSkiprr/rãrCÚwarningsÚwarnréÚ SyntaxWarningr$rxrrrrnZs
 
 
ÿzParserElement.__add__cCsZ|tkrt|ƒdƒ|St|tƒr,| |¡}t|tƒsRtjdt|ƒt    dddS||S)z`
        Implementation of + operator when left operand is not a :class:`ParserElement`
        ú    _skipped*ryr•rzN)
r|rGrr/rãrCr~rrér€rxrrrry€s
 
 
ÿzParserElement.__radd__cCsJt|tƒr| |¡}t|tƒs:tjdt|ƒtdddS|t     ¡|S)zT
        Implementation of - operator, returns :class:`And` with error stop
        ryr•rzN)
rr/rãrCr~rrér€r$Ú
_ErrorStoprxrrrÚ__sub__s
 
 
ÿzParserElement.__sub__cCsBt|tƒr| |¡}t|tƒs:tjdt|ƒtdddS||S)z`
        Implementation of - operator when left operand is not a :class:`ParserElement`
        ryr•rzN©rr/rãrCr~rrér€rxrrrÚ__rsub__›s
 
 
ÿzParserElement.__rsub__cs|tkrd}n8t|tƒrF|dd…tfkrFd|dd…ddd…}t|tƒr\|d}}nüt|tƒrJtdd    „|Dƒƒ}|d
dd…}|ddkr¢d|df}t|dtƒrú|ddkrú|ddkrÐtˆƒS|ddkrätˆƒSˆ|dtˆƒSnNt|dtƒr,t|dtƒr,|\}}||8}ntd t|dƒt|dƒƒ‚ntd t|ƒƒ‚|dkrjtd ƒ‚|dkr|tdƒ‚||kr”dkr nntdƒ‚|rô‡‡fdd„‰|rê|dkr҈ˆ|ƒ}nt    ˆg|ƒˆ|ƒ}nˆ|ƒ}n|dkrˆ}nt    ˆg|ƒ}|S)aø
        Implementation of * operator, allows use of ``expr * 3`` in place of
        ``expr + expr + expr``.  Expressions may also me multiplied by a 2-integer
        tuple, similar to ``{min, max}`` multipliers in regular expressions.  Tuples
        may also include ``None`` as in:
         - ``expr*(n, None)`` or ``expr*(n, )`` is equivalent
              to ``expr*n + ZeroOrMore(expr)``
              (read as "at least n instances of ``expr``")
         - ``expr*(None, n)`` is equivalent to ``expr*(0, n)``
              (read as "0 to n instances of ``expr``")
         - ``expr*(None, None)`` is equivalent to ``ZeroOrMore(expr)``
         - ``expr*(1, None)`` is equivalent to ``OneOrMore(expr)``
 
        Note that ``expr*(None, n)`` does not raise an exception if
        more than n exprs exist in the input stream; that is,
        ``expr*(None, n)`` does not enforce a maximum number of expr
        occurrences.  If this behavior is desired, then write
        ``expr*(None, n) + ~expr``
        )rNNr¬r3r©r•rcss|]}|tk    r|ndVqdSr©)r|rprrrr«Ãsz(ParserElement.__mul__.<locals>.<genexpr>©NNz8cannot multiply 'ParserElement' and ('%s', '%s') objectsz0cannot multiply 'ParserElement' and '%s' objectsz/cannot multiply ParserElement by negative valuez@second tuple value must be greater or equal to first tuple valuez,cannot multiply ParserElement by 0 or (0, 0)cs(|dkrtˆˆ|dƒƒStˆƒSdSr!)r:©Ún©ÚmakeOptionalListrÐrrrŠÞsz/ParserElement.__mul__.<locals>.makeOptionalList)
r|rÚtupler˜rQr8r1réÚ
ValueErrorr$)rÐrmÚ minElementsÚ optElementsr§rr‰rÚ__mul__§sN
       
 
 
 
 
 
zParserElement.__mul__cCs
| |¡Sr©)rrxrrrÚ__rmul__ñszParserElement.__rmul__cCsZ|tkrt|ddSt|tƒr(| |¡}t|tƒsNtjdt|ƒt    dddSt
||gƒS)zL
        Implementation of | operator - returns :class:`MatchFirst`
        T)Ú    must_skipryr•rzN) r|r}rr/rãrCr~rrér€r5rxrrrÚ__or__ôs 
 
 
ÿzParserElement.__or__cCsBt|tƒr| |¡}t|tƒs:tjdt|ƒtdddS||BS)z`
        Implementation of | operator when left operand is not a :class:`ParserElement`
        ryr•rzNr„rxrrrÚ__ror__    s
 
 
ÿzParserElement.__ror__cCsFt|tƒr| |¡}t|tƒs:tjdt|ƒtdddSt||gƒS)zD
        Implementation of ^ operator - returns :class:`Or`
        ryr•rzN)    rr/rãrCr~rrér€r;rxrrrÚ__xor__    s
 
 
ÿzParserElement.__xor__cCsBt|tƒr| |¡}t|tƒs:tjdt|ƒtdddS||AS)z`
        Implementation of ^ operator when left operand is not a :class:`ParserElement`
        ryr•rzNr„rxrrrÚ__rxor__    s
 
 
ÿzParserElement.__rxor__cCsFt|tƒr| |¡}t|tƒs:tjdt|ƒtdddSt||gƒS)zF
        Implementation of & operator - returns :class:`Each`
        ryr•rzN)    rr/rãrCr~rrér€r*rxrrrÚ__and__'    s
 
 
ÿzParserElement.__and__cCsBt|tƒr| |¡}t|tƒs:tjdt|ƒtdddS||@S)z`
        Implementation of & operator when left operand is not a :class:`ParserElement`
        ryr•rzNr„rxrrrÚ__rand__3    s
 
 
ÿzParserElement.__rand__cCst|ƒS)zH
        Implementation of ~ operator - returns :class:`NotAny`
        )r7rßrrrÚ
__invert__?    szParserElement.__invert__cCstd|jjƒ‚dS)Nz%r object is not iterable)r1rÙrrßrrrrME    szParserElement.__iter__c    Cs’zt|tƒr|f}t|ƒWntk
r8||f}YnXt|ƒdkrzt d |dd…t|ƒdkrrd t|ƒ¡nd¡¡|t|dd…ƒ}|S)a‚
        use ``[]`` indexing notation as a short form for expression repetition:
         - ``expr[n]`` is equivalent to ``expr*n``
         - ``expr[m, n]`` is equivalent to ``expr*(m, n)``
         - ``expr[n, ...]`` or ``expr[n,]`` is equivalent
              to ``expr*n + ZeroOrMore(expr)``
              (read as "at least n instances of ``expr``")
         - ``expr[..., n]`` is equivalent to ``expr*(0, n)``
              (read as "0 to n instances of ``expr``")
         - ``expr[...]`` and ``expr[0, ...]`` are equivalent to ``ZeroOrMore(expr)``
         - ``expr[1, ...]`` is equivalent to ``OneOrMore(expr)``
         ``None`` may be used in place of ``...``.
 
        Note that ``expr[..., n]`` and ``expr[m, n]``do not raise an exception
        if more than ``n`` ``expr``s exist in the input stream.  If this behavior is
        desired, then write ``expr[..., n] + ~expr``.
       r•z.only 1 or 2 index arguments supported ({0}{1})NrÆz    ... [{0}]r»)    rrŸrLr1rÛr~rrør‹)rÐrar§rrrrJ    s
 
ÿþzParserElement.__getitem__cCs|dk    r| |¡S| ¡SdS)aý
        Shortcut for :class:`setResultsName`, with ``listAllMatches=False``.
 
        If ``name`` is given with a trailing ``'*'`` character, then ``listAllMatches`` will be
        passed as ``True``.
 
        If ``name` is omitted, same as calling :class:`copy`.
 
        Example::
 
            # these are equivalent
            userdata = Word(alphas).setResultsName("name") + Word(nums + "-").setResultsName("socsecno")
            userdata = Word(alphas)("name") + Word(nums + "-")("socsecno")
        N)rrlrjrrrÚ__call__n    s
zParserElement.__call__cCst|ƒS)zŽ
        Suppresses the output of this :class:`ParserElement`; useful to keep punctuation from
        cluttering up returned output.
        )rJrßrrrÚsuppress‚    szParserElement.suppresscCs
d|_|S)a
        Disables the skipping of whitespace before matching the characters in the
        :class:`ParserElement`'s defined pattern.  This is normally only used internally by
        the pyparsing module, but may be needed in some whitespace-sensitive grammars.
        F©rírßrrrÚleaveWhitespace‰    szParserElement.leaveWhitespacecCsd|_||_d|_|S)z8
        Overrides the default whitespace chars
        TF)rírîrï)rÐrárrrÚsetWhitespaceChars’    sz ParserElement.setWhitespaceCharscCs
d|_|S)zì
        Overrides default behavior to expand ``<TAB>``s to spaces before parsing the input string.
        Must be called before ``parseString`` when the input grammar contains elements that
        match ``<TAB>`` characters.
        T)rñrßrrrÚ parseWithTabs›    szParserElement.parseWithTabscCsLt|tƒrt|ƒ}t|tƒr4||jkrH|j |¡n|j t| ¡ƒ¡|S)aÄ
        Define expression to be ignored (e.g., comments) while doing pattern
        matching; may be called repeatedly, to define multiple comment or other
        ignorable patterns.
 
        Example::
 
            patt = OneOrMore(Word(alphas))
            patt.parseString('ablaj /* comment */ lskjd') # -> ['ablaj']
 
            patt.ignore(cStyleComment)
            patt.parseString('ablaj /* comment */ lskjd') # -> ['ablaj', 'lskjd']
        )rr/rJròr÷rlrxrrrÚignore¤    s
 
 
zParserElement.ignorecCs"|pt|p t|ptf|_d|_|S)zT
        Enable display of debugging messages while doing pattern matching.
        T)r¿rÃrÄrøró)rÐÚ startActionÚ successActionÚexceptionActionrrrÚsetDebugActions¼    s þzParserElement.setDebugActionscCs|r| ttt¡nd|_|S)a•
        Enable display of debugging messages while doing pattern matching.
        Set ``flag`` to True to enable, False to disable.
 
        Example::
 
            wd = Word(alphas).setName("alphaword")
            integer = Word(nums).setName("numword")
            term = wd | integer
 
            # turn on debugging for wd
            wd.setDebug()
 
            OneOrMore(term).parseString("abc 123 xyz 890")
 
        prints::
 
            Match alphaword at loc 0(1,1)
            Matched alphaword -> ['abc']
            Match alphaword at loc 3(1,4)
            Exception raised:Expected alphaword (at char 4), (line:1, col:5)
            Match alphaword at loc 7(1,8)
            Matched alphaword -> ['xyz']
            Match alphaword at loc 11(1,12)
            Exception raised:Expected alphaword (at char 12), (line:1, col:13)
            Match alphaword at loc 15(1,16)
            Exception raised:Expected alphaword (at char 15), (line:1, col:16)
 
        The output shown is that produced by the default debug actions - custom debug actions can be
        specified using :class:`setDebugActions`. Prior to attempting
        to match the ``wd`` expression, the debugging message ``"Match <exprname> at loc <n>(<line>,<col>)"``
        is shown. Then if the parse succeeds, a ``"Matched"`` message is shown, or an ``"Exception raised"``
        message is shown. Also note the use of :class:`setName` to assign a human-readable name to the expression,
        which makes debugging and exception messages easier to understand - for instance, the default
        name created for the :class:`Word` expression without calling ``setName`` is ``"W:(ABCD...)"``.
        F)r£r¿rÃrÄró)rÐÚflagrrrrÿÆ    s%zParserElement.setDebugcCs|jSr©r³rßrrrrÝñ    szParserElement.__str__cCst|ƒSr©rÞrßrrrràô    szParserElement.__repr__cCsd|_d|_|Sr)rôrêrßrrrra÷    szParserElement.streamlinecCsdSr©rrrrrÚcheckRecursionü    szParserElement.checkRecursioncCs| g¡dS)zj
        Check defined expressions for valid structure, check for infinite recursive definitions.
        N)r¥)rÐÚ validateTracerrrÚvalidateÿ    szParserElement.validatec Cs¢z | ¡}Wn2tk
r>t|dƒ}| ¡}W5QRXYnXz| ||¡WStk
rœ}z0tjrj‚n"t|ddƒdk    rˆ| |j    ¡|_    |‚W5d}~XYnXdS)zÐ
        Execute the parse expression on the given file or filename.
        If a filename is specified (instead of a file object),
        the entire file is opened, read, and closed before parsing.
        ÚrrúN)
Úreadr×Úopenrfr<rCrcrÛrçrú)rÐÚfile_or_filenamerdÚ file_contentsÚfrrrrÚ    parseFile
s  zParserElement.parseFilecCs>||kr dSt|tƒr | |¡St|tƒr:t|ƒt|ƒkSdSr)rr/rlrCÚvarsrxrrrÚ__eq__
s
 
 
zParserElement.__eq__cCs
||k Sr©rrxrrrÚ__ne__$
szParserElement.__ne__cCst|ƒSr©)ÚidrßrrrÚ__hash__'
szParserElement.__hash__cCs||kSr©rrxrrrÚ__req__*
szParserElement.__req__cCs
||k Sr©rrxrrrÚ__rne__-
szParserElement.__rne__cCs4z|jt|ƒ|dWdStk
r.YdSXdS)aÁ
        Method for quick testing of a parser against a test string. Good for simple
        inline microtests of sub expressions while building up larger parser.
 
        Parameters:
         - testString - to test against this expression for a match
         - parseAll - (default= ``True``) - flag to pass to :class:`parseString` when running tests
 
        Example::
 
            expr = Word(nums)
            assert expr.matches("100")
        ©rdTFN)rfr¨r<)rÐÚ
testStringrdrrrrl0
s
zParserElement.matchesú#c     Csêt|tƒr"tttj| ¡ ¡ƒƒ}t|tƒr4t|ƒ}|dkrBt    j
}|j }    g}
g} d} tdƒ  t dƒ¡ t¡} d}|D]j}|dk    rŽ| |d¡s–| r¢|s¢|  |¡qt|s¨qt| rºdd | ¡nd|g}g} z"|  | |¡¡}|j||d}Wnôtk
rš}zt|tƒr d    nd}d|krP| t|j|ƒ¡| d
t|j|ƒd d |¡n| d
|jd |¡| d t|ƒ¡| o‚|} |}W5d}~XYntk
rÜ}z$| dt|ƒ¡| oÆ|} |}W5d}~XYnÒX| oè| } |dk    rœzR|||ƒ}|dk    r6t|tƒr&| | ¡¡n| t|ƒ¡n| | ¡¡WnRtk
r˜}z2| |j|d¡| d |jt |ƒj|¡¡W5d}~XYnXn| |j|d¡|rÒ|rÄ| d¡|    d |¡ƒ|
 ||f¡qt| |
fS)as
        Execute the parse expression on a series of test strings, showing each
        test, the parsed results or where the parse failed. Quick and easy way to
        run a parse expression against a list of sample strings.
 
        Parameters:
         - tests - a list of separate test strings, or a multiline string of test strings
         - parseAll - (default= ``True``) - flag to pass to :class:`parseString` when running tests
         - comment - (default= ``'#'``) - expression for indicating embedded comments in the test
              string; pass None to disable comment filtering
         - fullDump - (default= ``True``) - dump results as list followed by results names in nested outline;
              if False, only dump nested list
         - printResults - (default= ``True``) prints test output to stdout
         - failureTests - (default= ``False``) indicates if these tests are expected to fail parsing
         - postParse - (default= ``None``) optional callback for successful parse results; called as
              `fn(test_string, parse_results)` and returns a string to be added to the test output
         - file - (default=``None``) optional file-like object to which test output will be written;
              if None, will default to ``sys.stdout``
 
        Returns: a (success, results) tuple, where success indicates that all tests succeeded
        (or failed if ``failureTests`` is True), and the results contain a list of lines of each
        test's output
 
        Example::
 
            number_expr = pyparsing_common.number.copy()
 
            result = number_expr.runTests('''
                # unsigned integer
                100
                # negative integer
                -100
                # float with scientific notation
                6.02e23
                # integer with scientific notation
                1e-12
                ''')
            print("Success" if result[0] else "Failed!")
 
            result = number_expr.runTests('''
                # stray character
                100Z
                # missing leading digit before '.'
                -.100
                # too many '.'
                3.14.159
                ''', failureTests=True)
            print("Success" if result[0] else "Failed!")
 
        prints::
 
            # unsigned integer
            100
            [100]
 
            # negative integer
            -100
            [-100]
 
            # float with scientific notation
            6.02e23
            [6.02e+23]
 
            # integer with scientific notation
            1e-12
            [1e-12]
 
            Success
 
            # stray character
            100Z
               ^
            FAIL: Expected end of text (at char 3), (line:1, col:4)
 
            # missing leading digit before '.'
            -.100
            ^
            FAIL: Expected {real number with scientific notation | real number | signed integer} (at char 0), (line:1, col:1)
 
            # too many '.'
            3.14.159
                ^
            FAIL: Expected end of text (at char 4), (line:1, col:5)
 
            Success
 
        Each test string must be on a single line. If you want to test a string that spans multiple
        lines, create a test like this::
 
            expr.runTest(r"this is a test\n of strings that spans \n 3 lines")
 
        (Note that this is a raw string literal, you must include the leading 'r'.)
        NTú\nrôuFr»r¶z(FATAL)rîr¬rïzFAIL: zFAIL-EXCEPTION: )r z{0} failed: {1}: {2})!rr/r*rrŸrãÚrstripÚ
splitlinesr3r¢ÚstdoutÚwriterr|rŸryrlr÷râr¥Úlstriprfr<r@rgrÌrYr°rAr¥rørré)rÐÚtestsrdÚcommentÚfullDumpÚ printResultsÚ failureTestsr(ÚfileÚprint_Ú
allResultsÚcommentsÚsuccessr§ÚBOMršr€ÚresultrÔrÊrÚpp_valuerrrrÚrunTestsD
sn`
 
 
 
 
$
 
 
 
 
 0
zParserElement.runTests)F)F)F)T)T)TT)TT)r])F)N)T)N)F)T)Tr¸TTFNN)Srrrrërßrcr rârårìrçrÒrlrrrrr¤rrrr r$rñr(ròr6r7rrErMrPrVr    rUrWr[rr\r^r`rfÚ_MAX_INTror¥rtr°rnryrƒr…rrr’r“r”r•r–r—r˜rMrr™ršrœrržrŸr£rÿrÝràrar¥r§r®r°r±r³r´rµrlrÌrrrrrCGs®
 
 
 
 
 
    
1
 
 
W
 
 
 "
:J0  &  J     $
            
 
+
 
    
þcs6eZdZd
‡fdd„    Zdd„Zdd„Zdd    „Z‡ZS) r}Fcs>tt|ƒ ¡t|tƒƒ dd¡|_|j|_||_||_    dS)Nr+ú...)
Úsuperr}rÒrŸr+r²rêr!Úanchorr‘)rÐr¾r‘©rÙrrrÒê
s
z_PendingSkip.__init__cs\t|ƒ d¡dƒ}ˆjrNdd„}‡fdd„}ˆj|ƒ |¡|ƒ |¡B|Sˆj||S)NrÎrcSs,|jr|j ¡dgkr(|d=| dd¡dS)Nr»rÚ_skipped)rÒr"r`r™rrrr‘ô
sz'_PendingSkip.__add__.<locals>.must_skipcs<|j ¡dd…dgkr8| d¡}dtˆjƒd|d<dS)Nr–r»rÒz    missing <rŽ)rÒr"r`rrÐ)ršÚskippedrßrrÚ    show_skipø
s
z'_PendingSkip.__add__.<locals>.show_skip)rGrr‘rÐr)rÐrmÚskipperr‘rÔrrßrrnñ
s 
ÿÿz_PendingSkip.__add__cCs|jSr©)rêrßrrrrà sz_PendingSkip.__repr__cGs tdƒ‚dS)NzBuse of `...` expression without following SkipTo target expression)r°©rÐrÏrrrrñ sz_PendingSkip.parseImpl)F)rrrrÒrnràrñÚ __classcell__rrrÑrr}ç
sr}cs eZdZdZ‡fdd„Z‡ZS)rKzYAbstract :class:`ParserElement` subclass, for defining atomic
    matching patterns.
    cstt|ƒjdddS©NF©rû)rÏrKrÒrßrÑrrrÒ szToken.__init__©rrrrërÒr×rrrÑrrK scs eZdZdZ‡fdd„Z‡ZS)r+z'An empty token, will always match.
    cs$tt|ƒ ¡d|_d|_d|_dS)Nr+TF)rÏr+rÒr!rðrõrßrÑrrrÒ szEmpty.__init__rÚrrrÑrr+ scs*eZdZdZ‡fdd„Zddd„Z‡ZS)r6z#A token that will never match.
    cs*tt|ƒ ¡d|_d|_d|_d|_dS)Nr6TFzUnmatchable token)rÏr6rÒr!rðrõrörßrÑrrrÒ s
zNoMatch.__init__TcCst|||j|ƒ‚dSr©)r>rör%rrrrñ$ szNoMatch.parseImpl)T©rrrrërÒrñr×rrrÑrr6 s cs*eZdZdZ‡fdd„Zddd„Z‡ZS)r3aÒToken to exactly match a specified string.
 
    Example::
 
        Literal('blah').parseString('blah')  # -> ['blah']
        Literal('blah').parseString('blahfooblah')  # -> ['blah']
        Literal('blah').parseString('bla')  # -> Exception: Expected "blah"
 
    For case-insensitive matching, use :class:`CaselessLiteral`.
 
    For keyword matching (force word break before and after the matched string),
    use :class:`Keyword` or :class:`CaselessKeyword`.
    cs tt|ƒ ¡||_t|ƒ|_z|d|_Wn*tk
rVtj    dt
ddt |_ YnXdt |jƒ|_d|j|_d|_d|_|jdkrœt|ƒtkrœt|_ dS)    Nrz2null string passed to Literal; use Empty() insteadr•rzú"%s"rýFr¬)rÏr3rÒÚmatchrÛÚmatchLenÚfirstMatchCharr2r~rr€r+rÙr¨r!rörðrõréÚ_SingleCharLiteral©rÐÚ matchStringrÑrrrÒ6 s"
ÿ  zLiteral.__init__TcCs@|||jkr,| |j|¡r,||j|jfSt|||j|ƒ‚dSr©)rßrrÝrÞr>rör%rrrrñJ szLiteral.parseImpl)TrÛrrrÑrr3( s c@seZdZddd„ZdS)ràTcCs0|||jkr|d|jfSt|||j|ƒ‚dSr!)rßrÝr>rör%rrrrñP sz_SingleCharLiteral.parseImplN)T©rrrrñrrrrràO sràcsLeZdZdZedZd‡fdd„    Zddd    „Z‡fd
d „Ze    d d „ƒZ
‡Z S)r0aToken to exactly match a specified string as a keyword, that is,
    it must be immediately followed by a non-keyword character.  Compare
    with :class:`Literal`:
 
     - ``Literal("if")`` will match the leading ``'if'`` in
       ``'ifAndOnlyIf'``.
     - ``Keyword("if")`` will not; it will only match the leading
       ``'if'`` in ``'if x=1'``, or ``'if(y==2)'``
 
    Accepts two optional constructor arguments in addition to the
    keyword string:
 
     - ``identChars`` is a string of characters that would be valid
       identifier characters, defaulting to all alphanumerics + "_" and
       "$"
     - ``caseless`` allows case-insensitive matching, default is ``False``.
 
    Example::
 
        Keyword("start").parseString("start")  # -> ['start']
        Keyword("start").parseString("starting")  # -> Exception
 
    For case-insensitive matching, use :class:`CaselessKeyword`.
    ú_$NFcs®tt|ƒ ¡|dkrtj}||_t|ƒ|_z|d|_Wn$tk
r^t    j
dt ddYnXd|j|_ d|j |_ d|_d|_||_|r | ¡|_| ¡}t|ƒ|_dS)Nrz2null string passed to Keyword; use Empty() insteadr•rzrÜrýF)rÏr0rÒÚDEFAULT_KEYWORD_CHARSrÝrÛrÞrßr2r~rr€r!rörðrõÚcaselessÚupperÚ caselessmatchrûÚ
identChars)rÐrârérærÑrrrÒs s*
ÿ   
zKeyword.__init__TcCs|jr|||||j… ¡|jkrò|t|ƒ|jksL|||j ¡|jkrò|dksj||d ¡|jkrò||j|jfSnv|||jkrò|jdks¢| |j|¡rò|t|ƒ|jksÈ|||j|jkrò|dksâ||d|jkrò||j|jfSt    |||j
|ƒ‚dSr;) rærÞrçrèrÛrérÝrßrr>rör%rrrrñˆ s.ÿþýüÿþýýzKeyword.parseImplcstt|ƒ ¡}tj|_|Sr©)rÏr0rlråré)rÐr¿rÑrrrl› sz Keyword.copycCs
|t_dS)z,Overrides the default Keyword chars
        N)r0råràrrrÚsetDefaultKeywordChars  szKeyword.setDefaultKeywordChars)NF)T) rrrrërSrårÒrñrlr rêr×rrrÑrr0X s
 cs*eZdZdZ‡fdd„Zddd„Z‡ZS)r&afToken to match a specified string, ignoring case of letters.
    Note: the matched results will always be in the case of the given
    match string, NOT the case of the input text.
 
    Example::
 
        OneOrMore(CaselessLiteral("CMD")).parseString("cmd CMD Cmd10") # -> ['CMD', 'CMD', 'CMD']
 
    (Contrast with example for :class:`CaselessKeyword`.)
    cs6tt|ƒ | ¡¡||_d|j|_d|j|_dS)Nz'%s'rý)rÏr&rÒrçÚ returnStringr!rörárÑrrrÒ± s zCaselessLiteral.__init__TcCs@||||j… ¡|jkr,||j|jfSt|||j|ƒ‚dSr©)rÞrçrÝrër>rör%rrrrñ¸ szCaselessLiteral.parseImpl)TrÛrrrÑrr&¦ s
cs"eZdZdZd‡fdd„    Z‡ZS)r%zÕ
    Caseless version of :class:`Keyword`.
 
    Example::
 
        OneOrMore(CaselessKeyword("CMD")).parseString("cmd CMD Cmd10") # -> ['CMD', 'CMD']
 
    (Contrast with example for :class:`CaselessLiteral`.)
    Ncstt|ƒj||dddS)NT©ræ)rÏr%rÒ)rÐrârérÑrrrÒÇ szCaselessKeyword.__init__)NrÚrrrÑrr%½ s    cs,eZdZdZd‡fdd„    Zd    dd„Z‡ZS)
rŒaœA variation on :class:`Literal` which matches "close" matches,
    that is, strings with at most 'n' mismatching characters.
    :class:`CloseMatch` takes parameters:
 
     - ``match_string`` - string to be matched
     - ``maxMismatches`` - (``default=1``) maximum number of
       mismatches allowed to count as a match
 
    The results from a successful parse will contain the matched text
    from the input string and the following named results:
 
     - ``mismatches`` - a list of the positions within the
       match_string where mismatches were found
     - ``original`` - the original match_string used to compare
       against the input string
 
    If ``mismatches`` is an empty list, then the match was an exact
    match.
 
    Example::
 
        patt = CloseMatch("ATCATCGAATGGA")
        patt.parseString("ATCATCGAAXGGA") # -> (['ATCATCGAAXGGA'], {'mismatches': [[9]], 'original': ['ATCATCGAATGGA']})
        patt.parseString("ATCAXCGAAXGGA") # -> Exception: Expected 'ATCATCGAATGGA' (with up to 1 mismatches) (at char 0), (line:1, col:1)
 
        # exact match
        patt.parseString("ATCATCGAATGGA") # -> (['ATCATCGAATGGA'], {'mismatches': [[]], 'original': ['ATCATCGAATGGA']})
 
        # close match allowing up to 2 mismatches
        patt = CloseMatch("ATCATCGAATGGA", maxMismatches=2)
        patt.parseString("ATCAXCGAAXGGA") # -> (['ATCAXCGAAXGGA'], {'mismatches': [[4, 9]], 'original': ['ATCATCGAATGGA']})
    r¬csBtt|ƒ ¡||_||_||_d|j|jf|_d|_d|_dS)Nz&Expected %r (with up to %d mismatches)F)    rÏrŒrÒr!Ú match_stringÚ maxMismatchesrörõrð)rÐrírîrÑrrrÒë szCloseMatch.__init__TcCsÆ|}t|ƒ}|t|jƒ}||kr²|j}d}g}    |j}
tt|||…|ƒƒD]2\}} | \} } | | krL|     |¡t|    ƒ|
krLq²qL|d}t|||…gƒ}||d<|    |d<||fSt|||j|ƒ‚dS)Nrr¬ÚoriginalÚ
mismatches)    rÛrírîrür±r÷rAr>rö)rÐr½rÌr
Ústartr#ÚmaxlocríÚmatch_stringlocrðrîÚs_mÚsrcÚmatÚresultsrrrrñô s(
 zCloseMatch.parseImpl)r¬)TrÛrrrÑrrŒÊ s     cs8eZdZdZd ‡fdd„    Zdd    d
„Z‡fd d „Z‡ZS)rNaX    Token for matching words composed of allowed character sets.
    Defined with string containing all allowed initial characters, an
    optional string containing allowed body characters (if omitted,
    defaults to the initial character set), and an optional minimum,
    maximum, and/or exact length.  The default value for ``min`` is
    1 (a minimum value < 1 is not valid); the default values for
    ``max`` and ``exact`` are 0, meaning no maximum or exact
    length restriction. An optional ``excludeChars`` parameter can
    list characters that might be found in the input ``bodyChars``
    string; useful to define a word of all printables except for one or
    two characters, for instance.
 
    :class:`srange` is useful for defining custom character set strings
    for defining ``Word`` expressions, using range notation from
    regular expression character sets.
 
    A common mistake is to use :class:`Word` to match a specific literal
    string, as in ``Word("Address")``. Remember that :class:`Word`
    uses the string argument to define *sets* of matchable characters.
    This expression would match "Add", "AAA", "dAred", or any other word
    made up of the characters 'A', 'd', 'r', 'e', and 's'. To match an
    exact literal string, use :class:`Literal` or :class:`Keyword`.
 
    pyparsing includes helper strings for building Words:
 
     - :class:`alphas`
     - :class:`nums`
     - :class:`alphanums`
     - :class:`hexnums`
     - :class:`alphas8bit` (alphabetic characters in ASCII range 128-255
       - accented, tilded, umlauted, etc.)
     - :class:`punc8bit` (non-alphabetic characters in ASCII range
       128-255 - currency, symbols, superscripts, diacriticals, etc.)
     - :class:`printables` (any non-whitespace character)
 
    Example::
 
        # a word composed of digits
        integer = Word(nums) # equivalent to Word("0123456789") or Word(srange("0-9"))
 
        # a word with a leading capital, and zero or more lowercase
        capital_word = Word(alphas.upper(), alphas.lower())
 
        # hostnames are alphanumeric, with leading alpha, and '-'
        hostname = Word(alphas, alphanums + '-')
 
        # roman numeral (not a strict parser, accepts invalid mix of characters)
        roman = Word("IVXLCDM")
 
        # any string of non-whitespace characters, except for ','
        csv_value = Word(printables, excludeChars=",")
    Nr¬rFcsätt|ƒ ¡ˆrNtˆƒ‰d ‡fdd„|Dƒ¡}|rNd ‡fdd„|Dƒ¡}||_t|ƒ|_|rt||_t|ƒ|_n||_t|ƒ|_|dk|_    |dkržt
dƒ‚||_ |dkr´||_ nt |_ |dkrÎ||_ ||_ t|ƒ|_d|j|_d    |_||_d
|j|jkrà|dkrà|dkrà|dkrà|j|jkr@d t|jƒ|_nHt|jƒdkrnd t |j¡t|jƒf|_nd t|jƒt|jƒf|_|jr d|jd|_zt |j¡|_Wntk
rÎd|_YnX|jj|_t|_dS)Nr»c3s|]}|ˆkr|VqdSr©rr¾©Ú excludeCharsrrr«H sz Word.__init__.<locals>.<genexpr>c3s|]}|ˆkr|VqdSr©rr¾rørrr«J srr¬zZcannot specify a minimum length < 1; use Optional(Word()) if zero-length word is permittedrýFrîz[%s]+z%s[%s]*z    [%s][%s]*z\b)rÏrNrÒrûrâÚ initCharsOrigÚ    initCharsÚ bodyCharsOrigÚ    bodyCharsÚ maxSpecifiedrŒÚminLenÚmaxLenrÍr¨r!rörõÚ    asKeywordÚ_escapeRegexRangeCharsÚreStringrÛr’ÚescapeÚcompiler°rÝÚre_matchÚ
_WordRegexrÙ)rÐrûrýÚminÚmaxÚexactrrùrÑrørrÒD sZ
 
 
 
 0 ÿ
 
ÿ 
z Word.__init__Tc    Csü|||jkrt|||j|ƒ‚|}|d7}t|ƒ}|j}||j}t||ƒ}||krj|||krj|d7}qLd}|||jkr‚d}nV|jr¢||kr¢|||kr¢d}n6|j    rØ|dkrÀ||d|ksÔ||krØ|||krØd}|rìt|||j|ƒ‚||||…fS)Nr¬FTr)
rûr>rörÛrýrrrÿrþr)    rÐr½rÌr
rñr#Ú    bodycharsròÚthrowExceptionrrrrñ} s2
 
 
ÿ
ÿzWord.parseImplcsvztt|ƒ ¡WStk
r$YnX|jdkrpdd„}|j|jkr`d||jƒ||jƒf|_nd||jƒ|_|jS)NcSs$t|ƒdkr|dd…dS|SdS)NérÎr@©r¯rrrÚ
charsAsStr¡ s z Word.__str__.<locals>.charsAsStrz
W:(%s, %s)zW:(%s))rÏrNrÝr°rêrúrü)rÐrrÑrrrݙ s
 z Word.__str__)Nr¬rrFN)T©rrrrërÒrñrÝr×rrrÑrrN s49
c@seZdZddd„ZdS)rTcCs4| ||¡}|s t|||j|ƒ‚| ¡}|| ¡fSr©)rr>röÚendÚgroup)rÐr½rÌr
rÊrrrrñ¯ s
 z_WordRegex.parseImplN)Trãrrrrr® srcs"eZdZdZd‡fdd„    Z‡ZS)rRz“A short-cut class for defining ``Word(characters, exact=1)``,
    when defining a match of any single character in a string of
    characters.
    FNcsZtt|ƒj|d||ddtd |j¡ƒ|_|r>d|j|_t |j¡|_|jj    |_
dS)Nr¬)r
rrùú[%s]r»z\b%s\b) rÏrRrÒrrârûrr’rrÝr)rÐÚcharsetrrùrÑrrrÒ½ s  z Char.__init__)FNrÚrrrÑrrR¸ scsTeZdZdZd‡fdd„    Zddd„Zdd    d
„Zdd d „Z‡fd d„Zdd„Z    ‡Z
S)rFahToken for matching strings that match a given regular
    expression. Defined with string specifying the regular expression in
    a form recognized by the stdlib Python  `re module <https://docs.python.org/3/library/re.html>`_.
    If the given regex contains named groups (defined using ``(?P<name>...)``),
    these will be preserved as named parse results.
 
    If instead of the Python stdlib re module you wish to use a different RE module
    (such as the `regex` module), you can replace it by either building your
    Regex object with a compiled RE that was compiled using regex:
 
    Example::
 
        realnum = Regex(r"[+-]?\d+\.\d*")
        date = Regex(r'(?P<year>\d{4})-(?P<month>\d\d?)-(?P<day>\d\d?)')
        # ref: https://stackoverflow.com/questions/267399/how-do-you-match-only-valid-roman-numerals-with-a-regular-expression
        roman = Regex(r"M{0,4}(CM|CD|D?{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})")
 
        # use regex module instead of stdlib re module to construct a Regex using
        # a compiled regular expression
        import regex
        parser = pp.Regex(regex.compile(r'[0-9]'))
 
    rFcs$tt|ƒ ¡t|tƒr†|s,tjdtdd||_||_    zt
  |j|j    ¡|_
|j|_ Wq¾t jk
r‚tjd|tdd‚Yq¾Xn8t|dƒr¶t|dƒr¶||_
|j|_|_ ||_    ntdƒ‚|j
j|_t|ƒ|_d|j|_d    |_| d
¡d k    |_||_||_|jr|j|_|jr |j|_d S) aThe parameters ``pattern`` and ``flags`` are passed
        to the ``re.compile()`` function as-is. See the Python
        `re module <https://docs.python.org/3/library/re.html>`_ module for an
        explanation of the acceptable patterns and flags.
        z0null string passed to Regex; use Empty() insteadr•rzú$invalid pattern (%s) passed to RegexÚpatternrÝzCRegex may only be constructed with a string or a compiled RE objectrýFr»N)rÏrFrÒrr/r~rr€rÚflagsr’rrÚ sre_constantsÚerrorrQr1rÝrr¨r!rörõrðÚ asGroupListÚasMatchÚparseImplAsGroupListrñÚparseImplAsMatch)rÐrrrrrÑrrrÒÞ sD
ÿ 
ÿ
 
 
 zRegex.__init__Tc    Csb| ||¡}|s t|||j|ƒ‚| ¡}t| ¡ƒ}| ¡}|rZ| ¡D]\}}|||<qH||fSr©)rr>rörrArÚ    groupdictr?)    rÐr½rÌr
rÊr§Údr8r5rrrrñ s  
zRegex.parseImplcCs8| ||¡}|s t|||j|ƒ‚| ¡}| ¡}||fSr©)rr>rörÚgroups©rÐr½rÌr
rÊr§rrrr s  zRegex.parseImplAsGroupListcCs4| ||¡}|s t|||j|ƒ‚| ¡}|}||fSr©)rr>rörr!rrrr! s  zRegex.parseImplAsMatchcsFztt|ƒ ¡WStk
r$YnX|jdkr@dt|jƒ|_|jS)NzRe:(%s))rÏrFrÝr°rêrrrßrÑrrrÝ* s
z Regex.__str__cslˆjrtjdtddtƒ‚ˆjr@tˆƒr@tjdtddtƒ‚ˆjrT‡fdd„}n‡‡fdd„}ˆ |¡S)a‰
        Return Regex with an attached parse action to transform the parsed
        result as if called using `re.sub(expr, repl, string) <https://docs.python.org/3/library/re.html#re.sub>`_.
 
        Example::
 
            make_html = Regex(r"(\w+):(.*?):").sub(r"<\1>\2</\1>")
            print(make_html.transformString("h1:main title:"))
            # prints "<h1>main title</h1>"
        z-cannot use sub() with Regex(asGroupList=True)r•rzz9cannot use sub() with a callable with Regex(asMatch=True)cs|d ˆ¡Sr)Úexpand©r0)ÚreplrrrÇK szRegex.sub.<locals>.pacsˆj ˆ|d¡Sr)r’r9r#©r$rÐrrrÇN s)rr~rr€Ú SyntaxErrorrrr)rÐr$rÇrr%rr95 s  ÿÿz    Regex.sub)rFF)T)T)T) rrrrërÒrñrrrÝr9r×rrrÑrrFÆ s-
 
    
     cs8eZdZdZd ‡fdd„    Zd dd„Z‡fd    d
„Z‡ZS) rDa&
    Token for matching strings that are delimited by quoting characters.
 
    Defined with the following parameters:
 
        - quoteChar - string of one or more characters defining the
          quote delimiting string
        - escChar - character to escape quotes, typically backslash
          (default= ``None``)
        - escQuote - special quote sequence to escape an embedded quote
          string (such as SQL's ``""`` to escape an embedded ``"``)
          (default= ``None``)
        - multiline - boolean indicating whether quotes can span
          multiple lines (default= ``False``)
        - unquoteResults - boolean indicating whether the matched text
          should be unquoted (default= ``True``)
        - endQuoteChar - string of one or more characters defining the
          end of the quote delimited string (default= ``None``  => same as
          quoteChar)
        - convertWhitespaceEscapes - convert escaped whitespace
          (``'\t'``, ``'\n'``, etc.) to actual whitespace
          (default= ``True``)
 
    Example::
 
        qs = QuotedString('"')
        print(qs.searchString('lsjdf "This is the quote" sldjf'))
        complex_qs = QuotedString('{{', endQuoteChar='}}')
        print(complex_qs.searchString('lsjdf {{This is the "quote"}} sldjf'))
        sql_qs = QuotedString('"', escQuote='""')
        print(sql_qs.searchString('lsjdf "This is the quote with ""embedded"" quotes" sldjf'))
 
    prints::
 
        [['This is the quote']]
        [['This is the "quote"']]
        [['This is the quote with "embedded" quotes']]
    NFTc
sXttˆƒ ¡| ¡}|s0tjdtddtƒ‚|dkr>|}n"| ¡}|s`tjdtddtƒ‚|ˆ_t    |ƒˆ_
|dˆ_ |ˆ_ t    |ƒˆ_ |ˆ_|ˆ_|ˆ_|ˆ_|rètjtjBˆ_dt ˆj¡tˆj dƒ|dk    rÜt|ƒpÞdfˆ_n<dˆ_dt ˆj¡tˆj dƒ|dk    rt|ƒpdfˆ_t    ˆj ƒd    krpˆjd
d  ‡fd d „tt    ˆj ƒd    ddƒDƒ¡d7_|rŽˆjdt |¡7_|r¾ˆjdt |¡7_t ˆj¡dˆ_ˆjdt ˆj ¡7_z(t ˆjˆj¡ˆ_ˆjˆ_ˆjjˆ_Wn0t j!k
r0tjdˆjtdd‚YnXt"ˆƒˆ_#dˆj#ˆ_$dˆ_%dˆ_&dS)Nz$quoteChar cannot be the empty stringr•rzz'endQuoteChar cannot be the empty stringrz %s(?:[^%s%s]r»z%s(?:[^%s\n\r%s]r¬z|(?:z)|(?:c3s4|],}dt ˆjd|…¡tˆj|ƒfVqdS)z%s[^%s]N)r’rÚ endQuoteCharrr|rßrrr«¡ sþ ÿz(QuotedString.__init__.<locals>.<genexpr>r–ú)z|(?:%s)z|(?:%s.)z(.)z)*%srrýFT)'rÏrDrÒrãr~rr€r&Ú    quoteCharrÛÚ quoteCharLenÚfirstQuoteCharr'ÚendQuoteCharLenÚescCharÚescQuoteÚunquoteResultsÚconvertWhitespaceEscapesr’Ú    MULTILINEÚDOTALLrrrrrâr<ÚescCharReplacePatternrrrÝrrrr¨r!rörõrð)rÐr)r-r.Ú    multiliner/r'r0rÑrßrrÒy sv
 
 
  þ
  þþþÿ ÿ
 zQuotedString.__init__c    CsÒ|||jkr| ||¡pd}|s2t|||j|ƒ‚| ¡}| ¡}|jrÊ||j|j …}t    |t
ƒrÊd|krž|j rždddddœ}|  ¡D]\}}|  ||¡}qˆ|jr´t |jd|¡}|jrÊ|  |j|j¡}||fS)NrÚú    rôú ú )ú\tr¹z\fz\rz\g<1>)r+rr>rörrr/r*r,rr/r0r?r²r-r’r9r3r.r')    rÐr½rÌr
rÊr§Úws_mapÚwslitÚwscharrrrrñº s*
üzQuotedString.parseImplcsHztt|ƒ ¡WStk
r$YnX|jdkrBd|j|jf|_|jS)Nz.quoted string, starting with %s ending with %s)rÏrDrÝr°rêr)r'rßrÑrrrÝÝ s
zQuotedString.__str__)NNFTNT)TrrrrÑrrDR s&ÿA
#cs8eZdZdZd ‡fdd„    Zd dd„Z‡fd    d
„Z‡ZS) r'aüToken for matching words composed of characters *not* in a given
    set (will include whitespace in matched characters if not listed in
    the provided exclusion set - see example). Defined with string
    containing all disallowed characters, and an optional minimum,
    maximum, and/or exact length.  The default value for ``min`` is
    1 (a minimum value < 1 is not valid); the default values for
    ``max`` and ``exact`` are 0, meaning no maximum or exact
    length restriction.
 
    Example::
 
        # define a comma-separated-value as anything that is not a ','
        csv_value = CharsNotIn(',')
        print(delimitedList(csv_value).parseString("dkls,lsdkjf,s12 34,@!#,213"))
 
    prints::
 
        ['dkls', 'lsdkjf', 's12 34', '@!#', '213']
    r¬rcs†tt|ƒ ¡d|_||_|dkr*tdƒ‚||_|dkr@||_nt|_|dkrZ||_||_t    |ƒ|_
d|j
|_ |jdk|_ d|_ dS)NFr¬zfcannot specify a minimum length < 1; use Optional(CharsNotIn()) if zero-length char group is permittedrrý)rÏr'rÒríÚnotCharsrŒrÿrrÍr¨r!rörðrõ)rÐr<rr    r
rÑrrrÒý s 
  zCharsNotIn.__init__TcCs|||jkrt|||j|ƒ‚|}|d7}|j}t||jt|ƒƒ}||krb|||krb|d7}qD|||jkr€t|||j|ƒ‚||||…fSr!)r<r>rörrrÛrÿ)rÐr½rÌr
rñÚnotcharsÚmaxlenrrrrñs
zCharsNotIn.parseImplcsfztt|ƒ ¡WStk
r$YnX|jdkr`t|jƒdkrTd|jdd…|_n d|j|_|jS)Nr z
!W:(%s...)z!W:(%s))rÏr'rÝr°rêrÛr<rßrÑrrrÝ&s
 zCharsNotIn.__str__)r¬rr)TrrrrÑrr'é s
cs`eZdZdZdddddddd    d
d d d ddddddddddddœZd"‡fdd„    Zd#d d!„Z‡ZS)$rMa™Special matching class for matching whitespace.  Normally,
    whitespace is ignored by pyparsing grammars.  This class is included
    when some whitespace structures are significant.  Define with
    a string containing the whitespace characters to be matched; default
    is ``" \t\r\n"``.  Also takes optional ``min``,
    ``max``, and ``exact`` arguments, as defined for the
    :class:`Word` class.
    z<SP>z<TAB>z<LF>z<CR>z<FF>z<NBSP>z<OGHAM_SPACE_MARK>z<MONGOLIAN_VOWEL_SEPARATOR>z    <EN_QUAD>z    <EM_QUAD>z
<EN_SPACE>z
<EM_SPACE>z<THREE-PER-EM_SPACE>z<FOUR-PER-EM_SPACE>z<SIX-PER-EM_SPACE>z<FIGURE_SPACE>z<PUNCTUATION_SPACE>z <THIN_SPACE>z <HAIR_SPACE>z<ZERO_WIDTH_SPACE>z<NNBSP>z<MMSP>z<IDEOGRAPHIC_SPACE>)rîr5rôr7r6õ u u᠎u u u u u u u u u u u u​u u u ú     
r¬rcs’ttˆƒ ¡|ˆ_ˆ d ‡fdd„ˆjDƒ¡¡d dd„ˆjDƒ¡ˆ_dˆ_dˆjˆ_    |ˆ_
|dkrt|ˆ_ nt ˆ_ |dkrŽ|ˆ_ |ˆ_
dS)Nr»c3s|]}|ˆjkr|VqdSr©)Ú
matchWhiter¾rßrrr«Ys
z!White.__init__.<locals>.<genexpr>css|]}tj|VqdSr©)rMÚ    whiteStrsr¾rrrr«[sTrýr) rÏrMrÒrArrârîr!rðrörÿrrÍ)rÐÚwsrr    r
rÑrßrrÒVs  zWhite.__init__TcCs|||jkrt|||j|ƒ‚|}|d7}||j}t|t|ƒƒ}||krb|||jkrb|d7}qB|||jkr€t|||j|ƒ‚||||…fSr!)rAr>rörrrÛrÿ)rÐr½rÌr
rñròrrrrñjs
 
zWhite.parseImpl)r@r¬rr)T)rrrrërBrÒrñr×rrrÑrrM4s6    écseZdZ‡fdd„Z‡ZS)Ú_PositionTokencs(tt|ƒ ¡|jj|_d|_d|_dSr)rÏrDrÒrÙrr!rðrõrßrÑrrrÒ{s
z_PositionToken.__init__©rrrrÒr×rrrÑrrDzsrDcs2eZdZdZ‡fdd„Zdd„Zd    dd„Z‡ZS)
r.zaToken to advance to a specific column of input text; useful for
    tabular report scraping.
    cstt|ƒ ¡||_dSr©)rÏr.rÒrY)rÐÚcolnorÑrrr҅szGoToColumn.__init__cCs\t||ƒ|jkrXt|ƒ}|jr*| ||¡}||krX|| ¡rXt||ƒ|jkrX|d7}q*|Sr!)rYrÛròr Úisspace)rÐr½rÌr#rrrr$‰s $
zGoToColumn.preParseTcCsDt||ƒ}||jkr"t||d|ƒ‚||j|}|||…}||fS)NzText not in expected column©rYr>)rÐr½rÌr
ÚthiscolÚnewlocr§rrrrñ’s 
 
 zGoToColumn.parseImpl)T)rrrrërÒr$rñr×rrrÑrr.s     cs*eZdZdZ‡fdd„Zddd„Z‡ZS)r2a±Matches if current position is at the beginning of a line within
    the parse string
 
    Example::
 
        test = '''\
        AAA this line
        AAA and this line
          AAA but not this one
        B AAA and definitely not this one
        '''
 
        for t in (LineStart() + 'AAA' + restOfLine).searchString(test):
            print(t)
 
    prints::
 
        ['AAA', ' this line']
        ['AAA', ' and this line']
 
    cstt|ƒ ¡d|_dS)NzExpected start of line)rÏr2rÒrörßrÑrrrÒ±szLineStart.__init__TcCs*t||ƒdkr|gfSt|||j|ƒ‚dSr!)rYr>rör%rrrrñµszLineStart.parseImpl)TrÛrrrÑrr2›s cs*eZdZdZ‡fdd„Zddd„Z‡ZS)r1zTMatches if current position is at the end of a line within the
    parse string
    cs,tt|ƒ ¡| tj dd¡¡d|_dS)Nrôr»zExpected end of line)rÏr1rÒrrCrßr²rörßrÑrrrÒ¾szLineEnd.__init__TcCsb|t|ƒkr6||dkr$|ddfSt|||j|ƒ‚n(|t|ƒkrN|dgfSt|||j|ƒ‚dS)Nrôr¬©rÛr>rör%rrrrñÃs     zLineEnd.parseImpl)TrÛrrrÑrr1ºs cs*eZdZdZ‡fdd„Zddd„Z‡ZS)rIzLMatches if current position is at the beginning of the parse
    string
    cstt|ƒ ¡d|_dS)NzExpected start of text)rÏrIrÒrörßrÑrrrÒÒszStringStart.__init__TcCs0|dkr(|| |d¡kr(t|||j|ƒ‚|gfSr)r$r>rör%rrrrñÖszStringStart.parseImpl)TrÛrrrÑrrIÎs cs*eZdZdZ‡fdd„Zddd„Z‡ZS)rHzBMatches if current position is at the end of the parse string
    cstt|ƒ ¡d|_dS)NzExpected end of text)rÏrHrÒrörßrÑrrrÒàszStringEnd.__init__TcCs^|t|ƒkrt|||j|ƒ‚n<|t|ƒkr6|dgfS|t|ƒkrJ|gfSt|||j|ƒ‚dSr!rKr%rrrrñäs    zStringEnd.parseImpl)TrÛrrrÑrrHÝs cs.eZdZdZef‡fdd„    Zddd„Z‡ZS)rPayMatches if the current position is at the beginning of a Word,
    and is not preceded by any character in a given set of
    ``wordChars`` (default= ``printables``). To emulate the
    ```` behavior of regular expressions, use
    ``WordStart(alphanums)``. ``WordStart`` will also match at
    the beginning of the string being parsed, or at the beginning of
    a line.
    cs"tt|ƒ ¡t|ƒ|_d|_dS)NzNot at the start of a word)rÏrPrÒrûÚ    wordCharsrö©rÐrLrÑrrrÒ÷s
zWordStart.__init__TcCs@|dkr8||d|jks(|||jkr8t|||j|ƒ‚|gfSr;)rLr>rör%rrrrñüs  ÿzWordStart.parseImpl)T©rrrrërvrÒrñr×rrrÑrrPîscs.eZdZdZef‡fdd„    Zddd„Z‡ZS)rOa_Matches if the current position is at the end of a Word, and is
    not followed by any character in a given set of ``wordChars``
    (default= ``printables``). To emulate the ```` behavior of
    regular expressions, use ``WordEnd(alphanums)``. ``WordEnd``
    will also match at the end of the string being parsed, or at the end
    of a line.
    cs(tt|ƒ ¡t|ƒ|_d|_d|_dS)NFzNot at the end of a word)rÏrOrÒrûrLrírörMrÑrrrÒ s
zWordEnd.__init__TcCsPt|ƒ}|dkrH||krH|||jks8||d|jkrHt|||j|ƒ‚|gfSr;)rÛrLr>rö)rÐr½rÌr
r#rrrrñsÿzWordEnd.parseImpl)TrNrrrÑrrOscszeZdZdZd‡fdd„    Zdd„Zdd„Z‡fd    d
„Z‡fd d „Z‡fd d„Z    ddd„Z
‡fdd„Z d‡fdd„    Z ‡Z S)r?z]Abstract subclass of ParserElement, for combining and
    post-processing parsed tokens.
    FcsÈttˆƒ |¡t|tƒr"t|ƒ}t|tƒr<ˆ |¡gˆ_n‚t|t    ƒrP|gˆ_nnt|t
ƒr’t|ƒ}t dd„|Dƒƒr†‡fdd„|Dƒ}t|ƒˆ_n,zt|ƒˆ_Wnt k
r¼|gˆ_YnXdˆ_ dS)Ncss|]}t|tƒVqdSr©)rr/)rr¾rrrr«*sz+ParseExpression.__init__.<locals>.<genexpr>c3s&|]}t|tƒrˆ |¡n|VqdSr©)rr/rã©rrrßrrr«+sF)rÏr?rÒrr,r*r/rãÚexprsrCr
r¦r1rù©rÐrPrûrÑrßrrÒs"
 
 
 
 
 zParseExpression.__init__cCs|j |¡d|_|Sr©)rPr÷rêrxrrrr÷4s zParseExpression.appendcCs0d|_dd„|jDƒ|_|jD] }| ¡q|S)z€Extends ``leaveWhitespace`` defined in base class, and also invokes ``leaveWhitespace`` on
           all contained expressions.FcSsg|] }| ¡‘qSrrkrOrrrr=sz3ParseExpression.leaveWhitespace.<locals>.<listcomp>)rírPrœ)rÐrrrrrœ9s
 
 
zParseExpression.leaveWhitespacecsrt|tƒrB||jkrntt|ƒ |¡|jD]}| |jd¡q*n,tt|ƒ |¡|jD]}| |jd¡qX|SrN)rrJròrÏr?rŸrP)rÐrmrrÑrrrŸBs
 
 
 
zParseExpression.ignorecsNztt|ƒ ¡WStk
r$YnX|jdkrHd|jjt|jƒf|_|jS©Nz%s:(%s))    rÏr?rÝr°rêrÙrr¨rPrßrÑrrrÝNs
zParseExpression.__str__cs*tt|ƒ ¡|jD] }| ¡qt|jƒdkr|jd}t||jƒr |js |jdkr |j    s |jdd…|jdg|_d|_
|j |j O_ |j |j O_ |jd}t||jƒr|js|jdkr|j    s|jdd…|jdd…|_d|_
|j |j O_ |j |j O_ dt |ƒ|_|S)Nr•rr¬r–rý)rÏr?rarPrÛrrÙrèrërórêrðrõr¨rö)rÐrrmrÑrrraXs<
 
 
 ÿþý
ÿþýzParseExpression.streamlineNcCsB|dk    r |ngdd…|g}|jD]}| |¡q$| g¡dSr©)rPr§r¥)rÐr¦Útmprrrrr§zs
 zParseExpression.validatecs$tt|ƒ ¡}dd„|jDƒ|_|S)NcSsg|] }| ¡‘qSrrkrOrrrr‚sz(ParseExpression.copy.<locals>.<listcomp>)rÏr?rlrPr‰rÑrrrl€szParseExpression.copycsVtjrD|jD]6}t|tƒr |jr tjd d|t    |ƒj
|j¡ddq t t |ƒ  ||¡S)Nú]{0}: setting results name {1!r} on {2} expression collides with {3!r} on contained expressionrr“rz)rrrPrrCrër~rrørérrÏr?r©rÐr!rrrÑrrr…s
üûzParseExpression._setResultsName)F)N)F)rrrrërÒr÷rœrŸrÝrar§rlrr×rrrÑrr?s    
"
 cs`eZdZdZGdd„deƒZd‡fdd„    Z‡fdd„Zdd    d
„Zd d „Z    d d„Z
dd„Z ‡Z S)r$a
    Requires all given :class:`ParseExpression` s to be found in the given order.
    Expressions may be separated by whitespace.
    May be constructed using the ``'+'`` operator.
    May also be constructed using the ``'-'`` operator, which will
    suppress backtracking.
 
    Example::
 
        integer = Word(nums)
        name_expr = OneOrMore(Word(alphas))
 
        expr = And([integer("id"), name_expr("name"), integer("age")])
        # more easily written as:
        expr = integer("id") + name_expr("name") + integer("age")
    cseZdZ‡fdd„Z‡ZS)zAnd._ErrorStopcs&ttj|ƒj||Žd|_| ¡dS)Nú-)rÏr$r‚rÒr!rœr©rÑrrrÒ¦szAnd._ErrorStop.__init__rErrrÑrr‚¥sr‚Tcsàt|ƒ}|rŽt|krŽg}t|ƒD]`\}}|tkrv|t|ƒdkrltƒ||djd}| t|ƒdƒ¡q€tdƒ‚q | |¡q ||dd…<t    t
|ƒ  ||¡t dd„|jDƒƒ|_ | |jdj¡|jdj|_d|_dS)    Nr¬r–rz0cannot construct And with sequence ending in ...css|] }|jVqdSr©©rðrOrrrr«ºszAnd.__init__.<locals>.<genexpr>rT)r*r|rürÛr+rPr÷rGr°rÏr$rÒrrðrrîrírù)rÐrPrûrSrr¾Ú
skipto_argrÑrrrÒ«s  
  z And.__init__csÎ|jr¦tdd„|jdd…Dƒƒr¦t|jdd…ƒD]^\}}|dkrFq4t|tƒr4|jr4t|jdtƒr4|jd|j|d|jd<d|j|d<q4dd„|jDƒ|_tt|ƒ ¡t    dd„|jDƒƒ|_
|S)Ncss.|]&}t|tƒo$|jo$t|jdtƒVqdS©r–N)rr?rPr}rOrrrr«Âsÿz!And.streamline.<locals>.<genexpr>r–r¬cSsg|]}|dk    r|‘qSr©rrOrrrrËsz"And.streamline.<locals>.<listcomp>css|] }|jVqdSr©rWrOrrrr«Îs) rPr¦rürr?r}rÏr$rarrð)rÐrrrÑrrra¿s$ ÿ
ÿÿzAnd.streamlinec     Csþ|jdj|||dd\}}d}|jdd…D]Æ}t|tjƒrDd}q.|rÎz| |||¡\}}Wqàtk
rt‚Yqàtk
r¤}zd|_t |¡‚W5d}~XYqàt    k
rÊt|t
|ƒ|j |ƒ‚YqàXn| |||¡\}}|sì|  ¡r.||7}q.||fS)NrFrgr¬T) rPrrr$r‚rBr<rúrÕr2rÛrör[)    rÐr½rÌr
resultlistÚ    errorStoprÚ
exprtokensrÔrrrrñÑs(  
z And.parseImplcCst|tƒr| |¡}| |¡Sr©©rr/rãr÷rxrrrrfês
 
z And.__iadd__cCs6|dd…|g}|jD]}| |¡|jsq2qdSr©)rPr¥rð©rÐrÚsubRecCheckListrrrrr¥ïs
 
 
zAnd.checkRecursioncCs@t|dƒr|jS|jdkr:dd dd„|jDƒ¡d|_|jS)Nr!Ú{rîcss|]}t|ƒVqdSr©rÞrOrrrr«ûszAnd.__str__.<locals>.<genexpr>Ú}©rQr!rêrârPrßrrrrÝös
 
 
 z And.__str__)T)T) rrrrër+r‚rÒrarñrfr¥rÝr×rrrÑrr$“s 
cs^eZdZdZd‡fdd„    Z‡fdd„Zddd    „Zd
d „Zd d „Zdd„Z    d‡fdd„    Z
‡Z S)r;a¿Requires that at least one :class:`ParseExpression` is found. If
    two expressions match, the expression that matches the longest
    string will be used. May be constructed using the ``'^'``
    operator.
 
    Example::
 
        # construct Or using '^' operator
 
        number = Word(nums) ^ Combine(Word(nums) + '.' + Word(nums))
        print(number.searchString("123 3.1416 789"))
 
    prints::
 
        [['123'], ['3.1416'], ['789']]
    Fcs:tt|ƒ ||¡|jr0tdd„|jDƒƒ|_nd|_dS)Ncss|] }|jVqdSr©rWrOrrrr«szOr.__init__.<locals>.<genexpr>T)rÏr;rÒrPr¦rðrQrÑrrrÒsz Or.__init__cs.tt|ƒ ¡tjr*tdd„|jDƒƒ|_|S)Ncss|] }|jVqdSr©©rìrOrrrr«sz Or.streamline.<locals>.<genexpr>)rÏr;rar#Úcollect_all_And_tokensr¦rPrìrßrÑrrrasz Or.streamlineTc CsÆd}d}g}|jD]š}z| ||¡}Wnvtk
rb}    zd|    _|    j|krR|    }|    j}W5d}    ~    XYqtk
rœt|ƒ|kr˜t|t|ƒ|j|ƒ}t|ƒ}YqX| ||f¡q|rœ|j    t
dƒdd|sä|dd}
|
  |||¡Sd} |D] \} } | | dkr
| Sz|   |||¡\}}Wn@tk
r`}    z d|    _|    j|krP|    }|    j}W5d}    ~    XYqìX|| krx||fS|| dkrì||f} qì| dkrœ| S|dk    r´|j|_ |‚nt||d|ƒ‚dS)Nr–rT)rar>r¬rYú no defined alternatives to match) rPr6r>rúrÌr2rÛrör÷ÚsortrrrÆ)rÐr½rÌr
Ú    maxExcLocÚ maxExceptionrlrÚloc2r1Ú    best_exprÚlongestÚloc1Úexpr1rÂrrrrñsT
 
 
 
 
 
z Or.parseImplcCst|tƒr| |¡}| |¡Sr©r]rxrrrÚ__ixor__[s
 
z Or.__ixor__cCs@t|dƒr|jS|jdkr:dd dd„|jDƒ¡d|_|jS)Nr!r`z ^ css|]}t|ƒVqdSr©rÞrOrrrr«eszOr.__str__.<locals>.<genexpr>rarbrßrrrrÝ`s
 
 
 z
Or.__str__cCs,|dd…|g}|jD]}| |¡qdSr©©rPr¥r^rrrr¥is
zOr.checkRecursioncsPtjs>tjr>tdd„|jDƒƒr>tjd d|t    |ƒj
¡ddt t |ƒ  ||¡S)Ncss|]}t|tƒVqdSr©©rr$rOrrrr«qsz%Or._setResultsName.<locals>.<genexpr>ú–{0}: setting results name {1!r} on {2} expression may only return a single token for an And alternative, in future will return the full list of tokensrr“rz)r#rdrrr¦rPr~rrørérrÏr;rrrÑrrrnsÿýüzOr._setResultsName)F)T)F) rrrrërÒrarñrnrÝr¥rr×rrrÑrr;s 
=    cs^eZdZdZd‡fdd„    Z‡fdd„Zddd    „Zd
d „Zd d „Zdd„Z    d‡fdd„    Z
‡Z S)r5a¸Requires that at least one :class:`ParseExpression` is found. If
    two expressions match, the first one listed is the one that will
    match. May be constructed using the ``'|'`` operator.
 
    Example::
 
        # construct MatchFirst using '|' operator
 
        # watch the order of expressions to match
        number = Word(nums) | Combine(Word(nums) + '.' + Word(nums))
        print(number.searchString("123 3.1416 789")) #  Fail! -> [['123'], ['3'], ['1416'], ['789']]
 
        # put more selective expression first
        number = Combine(Word(nums) + '.' + Word(nums)) | Word(nums)
        print(number.searchString("123 3.1416 789")) #  Better -> [['123'], ['3.1416'], ['789']]
    Fcs:tt|ƒ ||¡|jr0tdd„|jDƒƒ|_nd|_dS)Ncss|] }|jVqdSr©rWrOrrrr«sz&MatchFirst.__init__.<locals>.<genexpr>T)rÏr5rÒrPr¦rðrQrÑrrrҌszMatchFirst.__init__cs.tt|ƒ ¡tjr*tdd„|jDƒƒ|_|S)Ncss|] }|jVqdSr©rcrOrrrr«–sz(MatchFirst.streamline.<locals>.<genexpr>)rÏr5rar#rdr¦rPrìrßrÑrrra“szMatchFirst.streamlineTc     CsÆd}d}|jD]Ž}z| |||¡}|WStk
r`}z|j|krP|}|j}W5d}~XYqtk
ršt|ƒ|kr–t|t|ƒ|j|ƒ}t|ƒ}YqXq|dk    r´|j|_|‚nt||d|ƒ‚dS)Nr–re)rPrr>rÌr2rÛrörÆ)    rÐr½rÌr
rgrhrr§r1rrrrñ™s$
 
 
 zMatchFirst.parseImplcCst|tƒr| |¡}| |¡Sr©r]rxrrrÚ__ior__±s
 
zMatchFirst.__ior__cCs@t|dƒr|jS|jdkr:dd dd„|jDƒ¡d|_|jS)Nr!r`ú | css|]}t|ƒVqdSr©rÞrOrrrr«»sz%MatchFirst.__str__.<locals>.<genexpr>rarbrßrrrrݶs
 
 
 zMatchFirst.__str__cCs,|dd…|g}|jD]}| |¡qdSr©ror^rrrr¥¿s
zMatchFirst.checkRecursioncsPtjs>tjr>tdd„|jDƒƒr>tjd d|t    |ƒj
¡ddt t |ƒ  ||¡S)Ncss|]}t|tƒVqdSr©rprOrrrr«Çsz-MatchFirst._setResultsName.<locals>.<genexpr>rqrr“rz)r#rdrrr¦rPr~rrørérrÏr5rrrÑrrrÄsÿýüzMatchFirst._setResultsName)F)T)F) rrrrërÒrarñrrrÝr¥rr×rrrÑrr5{s 
    csHeZdZdZd ‡fdd„    Z‡fdd„Zddd„Zd    d
„Zd d „Z‡Z    S)r*asRequires all given :class:`ParseExpression` s to be found, but in
    any order. Expressions may be separated by whitespace.
 
    May be constructed using the ``'&'`` operator.
 
    Example::
 
        color = oneOf("RED ORANGE YELLOW GREEN BLUE PURPLE BLACK WHITE BROWN")
        shape_type = oneOf("SQUARE CIRCLE TRIANGLE STAR HEXAGON OCTAGON")
        integer = Word(nums)
        shape_attr = "shape:" + shape_type("shape")
        posn_attr = "posn:" + Group(integer("x") + ',' + integer("y"))("posn")
        color_attr = "color:" + color("color")
        size_attr = "size:" + integer("size")
 
        # use Each (using operator '&') to accept attributes in any order
        # (shape and posn are required, color and size are optional)
        shape_spec = shape_attr & posn_attr & Optional(color_attr) & Optional(size_attr)
 
        shape_spec.runTests('''
            shape: SQUARE color: BLACK posn: 100, 120
            shape: CIRCLE size: 50 color: BLUE posn: 50,80
            color:GREEN size:20 shape:TRIANGLE posn:20,40
            '''
            )
 
    prints::
 
        shape: SQUARE color: BLACK posn: 100, 120
        ['shape:', 'SQUARE', 'color:', 'BLACK', 'posn:', ['100', ',', '120']]
        - color: BLACK
        - posn: ['100', ',', '120']
          - x: 100
          - y: 120
        - shape: SQUARE
 
 
        shape: CIRCLE size: 50 color: BLUE posn: 50,80
        ['shape:', 'CIRCLE', 'size:', '50', 'color:', 'BLUE', 'posn:', ['50', ',', '80']]
        - color: BLUE
        - posn: ['50', ',', '80']
          - x: 50
          - y: 80
        - shape: CIRCLE
        - size: 50
 
 
        color: GREEN size: 20 shape: TRIANGLE posn: 20,40
        ['color:', 'GREEN', 'size:', '20', 'shape:', 'TRIANGLE', 'posn:', ['20', ',', '40']]
        - color: GREEN
        - posn: ['20', ',', '40']
          - x: 20
          - y: 40
        - shape: TRIANGLE
        - size: 20
    Tcs>tt|ƒ ||¡tdd„|jDƒƒ|_d|_d|_d|_dS)Ncss|] }|jVqdSr©rWrOrrrr« sz Each.__init__.<locals>.<genexpr>T)    rÏr*rÒrrPrðríÚinitExprGroupsrìrQrÑrrrÒ
s
z Each.__init__cs(tt|ƒ ¡tdd„|jDƒƒ|_|S)Ncss|] }|jVqdSr©rWrOrrrr«sz"Each.streamline.<locals>.<genexpr>)rÏr*rarrPrðrßrÑrrraszEach.streamlinec    sî|jr’tdd„|jDƒƒ|_dd„|jDƒ}dd„|jDƒ}|||_dd„|jDƒ|_dd„|jDƒ|_dd„|jDƒ|_|j|j7_d    |_|}|jdd…}|jdd…‰g}d
}    |    rj|ˆ|j|j}
g} |
D]v} z|  ||¡}Wn t    k
r|  
| ¡YqÜX| 
|j  t | ƒ| ¡¡| |kr@|  | ¡qÜ| ˆkr܈  | ¡qÜt| ƒt|
ƒkrºd    }    qº|r”d  d d„|Dƒ¡} t    ||d | ƒ‚|‡fdd„|jDƒ7}g}|D]"} |  |||¡\}}| 
|¡q´t|tgƒƒ}||fS)Ncss&|]}t|tƒrt|jƒ|fVqdSr©)rr:r²r¾rOrrrr«s
z!Each.parseImpl.<locals>.<genexpr>cSsg|]}t|tƒr|j‘qSr©rr:r¾rOrrrrs
z"Each.parseImpl.<locals>.<listcomp>cSs$g|]}|jrt|ttfƒs|‘qSr)rðrr:rFrOrrrrscSsg|]}t|tƒr|j‘qSr)rrQr¾rOrrrrs
cSsg|]}t|tƒr|j‘qSr)rr8r¾rOrrrrs
cSs g|]}t|tttfƒs|‘qSr)rr:rQr8rOrrrrsFTr{css|]}t|ƒVqdSr©rÞrOrrrr«9sz*Missing one or more required elements (%s)cs$g|]}t|tƒr|jˆkr|‘qSrrurO©ÚtmpOptrrr=s
 
)rtr-rPÚopt1mapÚ    optionalsÚmultioptionalsÚ multirequiredÚrequiredr6r>r÷rþr²ÚremoverÛrârÚsumrA)rÐr½rÌr
Úopt1Úopt2ÚtmpLocÚtmpReqdÚ
matchOrderÚ keepMatchingÚtmpExprsÚfailedrÚmissingrZr÷Ú finalResultsrrvrrñsP
 
  zEach.parseImplcCs@t|dƒr|jS|jdkr:dd dd„|jDƒ¡d|_|jS)Nr!r`z & css|]}t|ƒVqdSr©rÞrOrrrr«LszEach.__str__.<locals>.<genexpr>rarbrßrrrrÝGs
 
 
 z Each.__str__cCs,|dd…|g}|jD]}| |¡qdSr©ror^rrrr¥Ps
zEach.checkRecursion)T)T)
rrrrërÒrarñrÝr¥r×rrrÑrr*Ñs 8 
1    csjeZdZdZd‡fdd„    Zddd„Zdd    „Z‡fd
d „Z‡fd d „Zdd„Z    ddd„Z
‡fdd„Z ‡Z S)r=zfAbstract subclass of :class:`ParserElement`, for combining and
    post-processing parsed tokens.
    Fcsštt|ƒ |¡t|tƒr@t|jtƒr2| |¡}n| t|ƒ¡}||_    d|_
|dk    r–|j |_ |j |_ |  |j¡|j|_|j|_|j|_|j |j¡dSr©)rÏr=rÒrr/Ú
issubclassrãrKr3r¾rêrõrðrrîrírìrùròrg©rÐr¾rûrÑrrrÒZs
   zParseElementEnhance.__init__TcCs2|jdk    r|jj|||ddStd||j|ƒ‚dS)NFrgr»)r¾rr>rör%rrrrñls
zParseElementEnhance.parseImplcCs*d|_|j ¡|_|jdk    r&|j ¡|Sr¯)rír¾rlrœrßrrrrœrs
 
 
z#ParseElementEnhance.leaveWhitespacecsrt|tƒrB||jkrntt|ƒ |¡|jdk    rn|j |jd¡n,tt|ƒ |¡|jdk    rn|j |jd¡|SrN)rrJròrÏr=rŸr¾rxrÑrrrŸys
 
 
 
zParseElementEnhance.ignorecs&tt|ƒ ¡|jdk    r"|j ¡|Sr©)rÏr=rar¾rßrÑrrra…s
 
zParseElementEnhance.streamlinecCsB||krt||gƒ‚|dd…|g}|jdk    r>|j |¡dSr©)rEr¾r¥)rÐrr_rrrr¥‹s
 
z"ParseElementEnhance.checkRecursionNcCsB|dkr g}|dd…|g}|jdk    r4|j |¡| g¡dSr©©r¾r§r¥©rÐr¦rSrrrr§’s 
 zParseElementEnhance.validatecsXztt|ƒ ¡WStk
r$YnX|jdkrR|jdk    rRd|jjt|jƒf|_|jSrR)    rÏr=rÝr°rêr¾rÙrr¨rßrÑrrrݚszParseElementEnhance.__str__)F)T)N) rrrrërÒrñrœrŸrar¥r§rÝr×rrrÑrr=Vs
 
cs*eZdZdZ‡fdd„Zddd„Z‡ZS)r,abLookahead matching of the given parse expression.
    ``FollowedBy`` does *not* advance the parsing position within
    the input string, it only verifies that the specified parse
    expression matches at the current position.  ``FollowedBy``
    always returns a null token list. If any results names are defined
    in the lookahead expression, those *will* be returned for access by
    name.
 
    Example::
 
        # use FollowedBy to match a label only if it is followed by a ':'
        data_word = Word(alphas)
        label = data_word + FollowedBy(':')
        attr_expr = Group(label + Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join))
 
        OneOrMore(attr_expr).parseString("shape: SQUARE color: BLACK posn: upper left").pprint()
 
    prints::
 
        [['shape', 'SQUARE'], ['color', 'BLACK'], ['posn', 'upper left']]
    cstt|ƒ |¡d|_dSr)rÏr,rÒrð©rÐr¾rÑrrrÒ»szFollowedBy.__init__TcCs(|jj|||d\}}|dd…=||fS)Nr4)r¾r)rÐr½rÌr
Ú_r§rrrrñ¿s
zFollowedBy.parseImpl)TrÛrrrÑrr,¥s cs,eZdZdZd    ‡fdd„    Zd
dd„Z‡ZS) r4apLookbehind matching of the given parse expression.
    ``PrecededBy`` does not advance the parsing position within the
    input string, it only verifies that the specified parse expression
    matches prior to the current position.  ``PrecededBy`` always
    returns a null token list, but if a results name is defined on the
    given expression, it is returned.
 
    Parameters:
 
     - expr - expression that must match prior to the current parse
       location
     - retreat - (default= ``None``) - (int) maximum number of characters
       to lookbehind prior to the current parse location
 
    If the lookbehind expression is a string, Literal, Keyword, or
    a Word or CharsNotIn with a specified exact or maximum length, then
    the retreat parameter is not required. Otherwise, retreat must be
    specified to give a maximum number of characters to look back from
    the current parse position for a lookbehind match.
 
    Example::
 
        # VB-style variable names with type prefixes
        int_var = PrecededBy("#") + pyparsing_common.identifier
        str_var = PrecededBy("$") + pyparsing_common.identifier
 
    NcsÎtt|ƒ |¡| ¡ ¡|_d|_d|_d|_t|t    ƒrJt
|ƒ}d|_nVt|t t fƒrf|j }d|_n:t|ttfƒrŒ|jtkrŒ|j}d|_nt|tƒr d}d|_||_dt    |ƒ|_d|_|j dd„¡dS)NTFrznot preceded by cSs| tddƒ¡Sr©)rFr6rÁrrrr›ùrœz%PrecededBy.__init__.<locals>.<lambda>)rÏr4rÒr¾rœrðrõr
rrŸrÛr3r0rÞrNr'rrÍrDÚretreatrörírèr÷)rÐr¾rrÑrrrÒäs*
 
zPrecededBy.__init__rTc Csâ|jr<||jkrt|||jƒ‚||j}|j ||¡\}}nž|jtƒ}|td||jƒ|…}t|||jƒ}    tdt    ||jdƒdƒD]L}
z| |t
|ƒ|
¡\}}Wn&t k
rÎ} z| }    W5d} ~ XYqˆXqÚqˆ|    ‚||fSr;) r
rr>rör¾rrHr    r<rrÛr<) rÐr½rÌr
rñrŽr§Ú    test_exprÚinstring_sliceÚ    last_exprrpÚpberrrrñûs 
 
 zPrecededBy.parseImpl)N)rTrÛrrrÑrr4Èscs2eZdZdZ‡fdd„Zd    dd„Zdd„Z‡ZS)
r7a¹Lookahead to disallow matching with the given parse expression.
    ``NotAny`` does *not* advance the parsing position within the
    input string, it only verifies that the specified parse expression
    does *not* match at the current position.  Also, ``NotAny`` does
    *not* skip over leading whitespace. ``NotAny`` always returns
    a null token list.  May be constructed using the '~' operator.
 
    Example::
 
        AND, OR, NOT = map(CaselessKeyword, "AND OR NOT".split())
 
        # take care not to mistake keywords for identifiers
        ident = ~(AND | OR | NOT) + Word(alphas)
        boolean_term = Optional(NOT) + ident
 
        # very crude boolean expression - to support parenthesis groups and
        # operation hierarchy, use infixNotation
        boolean_expr = boolean_term + ZeroOrMore((AND | OR) + boolean_term)
 
        # integers that are followed by "." are actually floats
        integer = Word(nums) + ~Char(".")
    cs0tt|ƒ |¡d|_d|_dt|jƒ|_dS)NFTzFound unwanted token, )rÏr7rÒrírðr¨r¾rörrÑrrrÒ*szNotAny.__init__TcCs&|j ||¡rt|||j|ƒ‚|gfSr©)r¾r7r>rör%rrrrñ1szNotAny.parseImplcCs4t|dƒr|jS|jdkr.dt|jƒd|_|jS)Nr!z~{ra©rQr!rêr¨r¾rßrrrrÝ6s
 
 
zNotAny.__str__)TrrrrÑrr7s 
cs>eZdZd ‡fdd„    Zdd„Zd dd„Zd‡fd
d „    Z‡ZS)Ú_MultipleMatchNcs<tt|ƒ |¡d|_|}t|tƒr.| |¡}| |¡dSr)rÏr•rÒrìrr/rãÚstopOn)rÐr¾r–ÚenderrÑrrrÒ@s 
 
z_MultipleMatch.__init__cCs,t|tƒr| |¡}|dk    r"|nd|_|Sr©)rr/rãÚ    not_ender)rÐr—rrrr–Hs
 
z_MultipleMatch.stopOnTc     Cs¾|jj}|j}|jdk    }|r$|jj}|r2|||ƒ||||dd\}}zV|j }    |r`|||ƒ|    rp|||ƒ}
n|}
|||
|ƒ\}} | s|  ¡rR|| 7}qRWnttfk
r´YnX||fS©NFrg)    r¾rr r˜r6ròr[r>r2) rÐr½rÌr
Úself_expr_parseÚself_skip_ignorablesÚ check_enderÚ try_not_enderr0ÚhasIgnoreExprsr.Ú    tmptokensrrrrñNs*
 
 
 
  z_MultipleMatch.parseImplFcsftjrT|jgt|jdgƒD]6}t|tƒr|jrtjd     d|t
|ƒj |j¡ddqt t |ƒ ||¡S)NrPrTrr“rz)rrr¾rÛrrCrër~rrørérrÏr•rrUrÑrrrksüûz_MultipleMatch._setResultsName)N)T)F)rrrrÒr–rñrr×rrrÑrr•?s
r•c@seZdZdZdd„ZdS)r8ajRepetition of one or more of the given expression.
 
    Parameters:
     - expr - expression that must match one or more times
     - stopOn - (default= ``None``) - expression for a terminating sentinel
          (only required if the sentinel would ordinarily match the repetition
          expression)
 
    Example::
 
        data_word = Word(alphas)
        label = data_word + FollowedBy(':')
        attr_expr = Group(label + Suppress(':') + OneOrMore(data_word).setParseAction(' '.join))
 
        text = "shape: SQUARE posn: upper left color: BLACK"
        OneOrMore(attr_expr).parseString(text).pprint()  # Fail! read 'color' as data instead of next label -> [['shape', 'SQUARE color']]
 
        # use stopOn attribute for OneOrMore to avoid reading label string as part of the data
        attr_expr = Group(label + Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join))
        OneOrMore(attr_expr).parseString(text).pprint() # Better -> [['shape', 'SQUARE'], ['posn', 'upper left'], ['color', 'BLACK']]
 
        # could also be written as
        (attr_expr * (1,)).parseString(text).pprint()
    cCs4t|dƒr|jS|jdkr.dt|jƒd|_|jS)Nr!r`z}...r”rßrrrrݓs
 
 
zOneOrMore.__str__N)rrrrërÝrrrrr8yscs8eZdZdZd
‡fdd„    Zd ‡fdd„    Zdd    „Z‡ZS) rQakOptional repetition of zero or more of the given expression.
 
    Parameters:
     - expr - expression that must match zero or more times
     - stopOn - (default= ``None``) - expression for a terminating sentinel
          (only required if the sentinel would ordinarily match the repetition
          expression)
 
    Example: similar to :class:`OneOrMore`
    Ncstt|ƒj||dd|_dS)N©r–T)rÏrQrÒrð)rÐr¾r–rÑrrrÒ§szZeroOrMore.__init__Tc    s<ztt|ƒ |||¡WSttfk
r6|gfYSXdSr©)rÏrQrñr>r2r%rÑrrrñ«szZeroOrMore.parseImplcCs4t|dƒr|jS|jdkr.dt|jƒd|_|jS)Nr!rzú]...r”rßrrrrݱs
 
 
zZeroOrMore.__str__)N)TrrrrÑrrQœs
c@s eZdZdd„ZeZdd„ZdS)Ú
_NullTokencCsdSr¯rrßrrrrJ¼sz_NullToken.__bool__cCsdSrËrrßrrrrÝ¿sz_NullToken.__str__N)rrrrJrµrÝrrrrr¢»sr¢cs<eZdZdZeƒZef‡fdd„    Zd    dd„Zdd„Z‡Z    S)
r:aGOptional matching of the given expression.
 
    Parameters:
     - expr - expression that must match zero or more times
     - default (optional) - value to be returned if the optional expression is not found.
 
    Example::
 
        # US postal code can be a 5-digit zip, plus optional 4-digit qualifier
        zip = Combine(Word(nums, exact=5) + Optional('-' + Word(nums, exact=4)))
        zip.runTests('''
            # traditional ZIP code
            12345
 
            # ZIP+4 form
            12101-0001
 
            # invalid ZIP
            98765-
            ''')
 
    prints::
 
        # traditional ZIP code
        12345
        ['12345']
 
        # ZIP+4 form
        12101-0001
        ['12101-0001']
 
        # invalid ZIP
        98765-
             ^
        FAIL: Expected end of text (at char 5), (line:1, col:6)
    cs.tt|ƒj|dd|jj|_||_d|_dS)NFrÙT)rÏr:rÒr¾rìrbrð)rÐr¾r\rÑrrrÒés
zOptional.__init__Tc    Cs|z|jj|||dd\}}WnVttfk
rr|j|jk    rj|jjr`t|jgƒ}|j||jj<qn|jg}ng}YnX||fSr™)r¾rr>r2rbÚ_Optional__optionalNotMatchedrërA)rÐr½rÌr
r0rrrrñïs  
 
zOptional.parseImplcCs4t|dƒr|jS|jdkr.dt|jƒd|_|jS)Nr!rzr}r”rßrrrrÝýs
 
 
zOptional.__str__)T)
rrrrër¢r£rÒrñrÝr×rrrÑrr:Âs
$
cs,eZdZdZd    ‡fdd„    Zd
dd„Z‡ZS) rGaø    Token for skipping over all undefined text until the matched
    expression is found.
 
    Parameters:
     - expr - target expression marking the end of the data to be skipped
     - include - (default= ``False``) if True, the target expression is also parsed
          (the skipped text and target expression are returned as a 2-element list).
     - ignore - (default= ``None``) used to define grammars (typically quoted strings and
          comments) that might contain false matches to the target expression
     - failOn - (default= ``None``) define expressions that are not allowed to be
          included in the skipped test; if found before the target expression is found,
          the SkipTo is not a match
 
    Example::
 
        report = '''
            Outstanding Issues Report - 1 Jan 2000
 
               # | Severity | Description                               |  Days Open
            -----+----------+-------------------------------------------+-----------
             101 | Critical | Intermittent system crash                 |          6
              94 | Cosmetic | Spelling error on Login ('log|n')         |         14
              79 | Minor    | System slow when running too many reports |         47
            '''
        integer = Word(nums)
        SEP = Suppress('|')
        # use SkipTo to simply match everything up until the next SEP
        # - ignore quoted strings, so that a '|' character inside a quoted string does not match
        # - parse action will call token.strip() for each matched token, i.e., the description body
        string_data = SkipTo(SEP, ignore=quotedString)
        string_data.setParseAction(tokenMap(str.strip))
        ticket_expr = (integer("issue_num") + SEP
                      + string_data("sev") + SEP
                      + string_data("desc") + SEP
                      + integer("days_open"))
 
        for tkt in ticket_expr.searchString(report):
            print tkt.dump()
 
    prints::
 
        ['101', 'Critical', 'Intermittent system crash', '6']
        - days_open: 6
        - desc: Intermittent system crash
        - issue_num: 101
        - sev: Critical
        ['94', 'Cosmetic', "Spelling error on Login ('log|n')", '14']
        - days_open: 14
        - desc: Spelling error on Login ('log|n')
        - issue_num: 94
        - sev: Cosmetic
        ['79', 'Minor', 'System slow when running too many reports', '47']
        - days_open: 47
        - desc: System slow when running too many reports
        - issue_num: 79
        - sev: Minor
    FNcs`tt|ƒ |¡||_d|_d|_||_d|_t|t    ƒrF| 
|¡|_ n||_ dt |j ƒ|_dS)NTFzNo match found for )rÏrGrÒÚ
ignoreExprrðrõÚ includeMatchrìrr/rãÚfailOnr¨r¾rö)rÐrmÚincluderŸr¦rÑrrrÒ@s
zSkipTo.__init__Tc    Cs&|}t|ƒ}|j}|jj}|jdk    r,|jjnd}|jdk    rB|jjnd}    |}
|
|krÒ|dk    rf|||
ƒrfqâ|    dk    r˜z|    ||
ƒ}
Wqntk
r”Yq˜YqnXqnz|||
dddWqâtt    fk
rÌ|
d7}
YqJXqâqJt|||j
|ƒ‚|
}|||…} t | ƒ} |j r||||dd\}} | | 7} || fS)NF)r
r r¬rg) rÛr¾rr¦r7r¤r6r<r>r2rörAr¥)rÐr½rÌr
rÀr#r¾Ú
expr_parseÚself_failOn_canParseNextÚself_ignoreExpr_tryParseÚtmplocÚskiptextÚ
skipresultrörrrrñMs:
  zSkipTo.parseImpl)FNN)TrÛrrrÑrrGs9 csneZdZdZd‡fdd„    Zdd„Zdd„Zd    d
„Zd d „Zdd d„Z    dd„Z
‡fdd„Z d‡fdd„    Z ‡Z S)r-a_Forward declaration of an expression to be defined later -
    used for recursive grammars, such as algebraic infix notation.
    When the expression is known, it is assigned to the ``Forward``
    variable using the '<<' operator.
 
    Note: take care when assigning to ``Forward`` not to overlook
    precedence of operators.
 
    Specifically, '|' has a lower precedence than '<<', so that::
 
        fwdExpr << a | b | c
 
    will actually be evaluated as::
 
        (fwdExpr << a) | b | c
 
    thereby leaving b and c out as parseable alternatives.  It is recommended that you
    explicitly group the values inserted into the ``Forward``::
 
        fwdExpr << (a | b | c)
 
    Converting to use the '<<=' operator instead will avoid this problem.
 
    See :class:`ParseResults.pprint` for an example of a recursive
    parser created using ``Forward``.
    Ncstt|ƒj|dddSrØ)rÏr-rÒrxrÑrrrҗszForward.__init__cCsjt|tƒr| |¡}||_d|_|jj|_|jj|_| |jj¡|jj    |_    |jj
|_
|j   |jj ¡|Sr©) rr/rãr¾rêrõrðrrîrírìròrgrxrrrÚ
__lshift__šs
 
 
 
 
 
zForward.__lshift__cCs||>Sr©rrxrrrÚ __ilshift__§szForward.__ilshift__cCs
d|_|Sr¯r›rßrrrrœªszForward.leaveWhitespacecCs$|js d|_|jdk    r |j ¡|Sr)rôr¾rarßrrrra®s
 
 
zForward.streamlinecCsJ|dkr g}||kr<|dd…|g}|jdk    r<|j |¡| g¡dSr©r‹rŒrrrr§µs
 zForward.validatecCslt|dƒr|jS|jdk    r |jSd|_d}z&|jdk    rJt|jƒdd…}nd}W5|jjd||_X|jS)Nr!z: ...rÎz: ièÚNone)rQr!rêrÙrr¾r¨)rÐÚ    retStringrrrrÝ¿s
 
 
zForward.__str__cs.|jdk    rtt|ƒ ¡Stƒ}||K}|SdSr©)r¾rÏr-rlr‰rÑrrrlÓs
 
z Forward.copyFcs@tjr.|jdkr.tjd d|t|ƒj¡ddtt    |ƒ 
||¡S)NzR{0}: setting results name {0!r} on {1} expression that has no contained expressionrr“rz) rrr¾r~rrørérrÏr-rrrÑrrrÛs
ýüzForward._setResultsName)N)N)F)rrrrërÒr®r¯rœrar§rÝrlrr×rrrÑrr-|s 
 
 cs"eZdZdZd‡fdd„    Z‡ZS)rLzW
    Abstract subclass of :class:`ParseExpression`, for converting parsed results.
    Fcstt|ƒ |¡d|_dSr¯)rÏrLrÒrìrŠrÑrrrÒêszTokenConverter.__init__)FrÚrrrÑrrLæscs6eZdZdZd
‡fdd„    Z‡fdd„Zdd    „Z‡ZS) r(aÕConverter to concatenate all matching tokens to a single string.
    By default, the matching patterns must also be contiguous in the
    input string; this can be disabled by specifying
    ``'adjacent=False'`` in the constructor.
 
    Example::
 
        real = Word(nums) + '.' + Word(nums)
        print(real.parseString('3.1416')) # -> ['3', '.', '1416']
        # will also erroneously match the following
        print(real.parseString('3. 1416')) # -> ['3', '.', '1416']
 
        real = Combine(Word(nums) + '.' + Word(nums))
        print(real.parseString('3.1416')) # -> ['3.1416']
        # no match when there are internal spaces
        print(real.parseString('3. 1416')) # -> Exception: Expected W:(0123...)
    r»Tcs8tt|ƒ |¡|r| ¡||_d|_||_d|_dSr)rÏr(rÒrœÚadjacentríÚ
joinStringrù)rÐr¾r³r²rÑrrrÒszCombine.__init__cs(|jrt ||¡ntt|ƒ |¡|Sr©)r²rCrŸrÏr(rxrÑrrrŸ
szCombine.ignorecCsP| ¡}|dd…=|td | |j¡¡g|jd7}|jrH| ¡rH|gS|SdS)Nr»)r#)rlrArâr~r³r÷rër[)rÐr½rÌr'ÚretToksrrrr(s 
"zCombine.postParse)r»T)rrrrërÒrŸr(r×rrrÑrr(îs
cs(eZdZdZ‡fdd„Zdd„Z‡ZS)r/aConverter to return the matched tokens as a list - useful for
    returning tokens of :class:`ZeroOrMore` and :class:`OneOrMore` expressions.
 
    Example::
 
        ident = Word(alphas)
        num = Word(nums)
        term = ident | num
        func = ident + Optional(delimitedList(term))
        print(func.parseString("fn a, b, 100"))  # -> ['fn', 'a', 'b', '100']
 
        func = ident + Group(Optional(delimitedList(term)))
        print(func.parseString("fn a, b, 100"))  # -> ['fn', ['a', 'b', '100']]
    cstt|ƒ |¡d|_dSr)rÏr/rÒrìrrÑrrrÒ*szGroup.__init__cCs|gSr©rr&rrrr(.szGroup.postParse©rrrrërÒr(r×rrrÑrr/s cs(eZdZdZ‡fdd„Zdd„Z‡ZS)r)a?Converter to return a repetitive expression as a list, but also
    as a dictionary. Each element can also be referenced using the first
    token in the expression as its key. Useful for tabular report
    scraping when the first column can be used as a item key.
 
    Example::
 
        data_word = Word(alphas)
        label = data_word + FollowedBy(':')
        attr_expr = Group(label + Suppress(':') + OneOrMore(data_word).setParseAction(' '.join))
 
        text = "shape: SQUARE posn: upper left color: light blue texture: burlap"
        attr_expr = (label + Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join))
 
        # print attributes as plain groups
        print(OneOrMore(attr_expr).parseString(text).dump())
 
        # instead of OneOrMore(expr), parse using Dict(OneOrMore(Group(expr))) - Dict will auto-assign names
        result = Dict(OneOrMore(Group(attr_expr))).parseString(text)
        print(result.dump())
 
        # access named fields as dict entries, or output as dict
        print(result['shape'])
        print(result.asDict())
 
    prints::
 
        ['shape', 'SQUARE', 'posn', 'upper left', 'color', 'light blue', 'texture', 'burlap']
        [['shape', 'SQUARE'], ['posn', 'upper left'], ['color', 'light blue'], ['texture', 'burlap']]
        - color: light blue
        - posn: upper left
        - shape: SQUARE
        - texture: burlap
        SQUARE
        {'color': 'light blue', 'posn': 'upper left', 'texture': 'burlap', 'shape': 'SQUARE'}
 
    See more examples at :class:`ParseResults` of accessing fields by results name.
    cstt|ƒ |¡d|_dSr)rÏr)rÒrìrrÑrrrÒXsz Dict.__init__cCsît|ƒD]Ð\}}t|ƒdkrq|d}t|tƒr@t|dƒ ¡}t|ƒdkr\td|ƒ||<qt|ƒdkrŠt|dtƒsŠt|d|ƒ||<q| ¡}|d=t|ƒdks¶t|tƒrÆ|     ¡rÆt||ƒ||<qt|d|ƒ||<q|j
ræ|gS|SdS)Nrr¬r»r•) rürÛrr˜r¨rãrrArlr[rë)rÐr½rÌr'rÚtokÚikeyÚ    dictvaluerrrr(\s$ 
 zDict.postParserµrrrÑrr)1s& c@s eZdZdZdd„Zdd„ZdS)rJa[Converter for ignoring the results of a parsed expression.
 
    Example::
 
        source = "a, b, c,d"
        wd = Word(alphas)
        wd_list1 = wd + ZeroOrMore(',' + wd)
        print(wd_list1.parseString(source))
 
        # often, delimiters that are useful during parsing are just in the
        # way afterward - use Suppress to keep them out of the parsed output
        wd_list2 = wd + ZeroOrMore(Suppress(',') + wd)
        print(wd_list2.parseString(source))
 
    prints::
 
        ['a', ',', 'b', ',', 'c', ',', 'd']
        ['a', 'b', 'c', 'd']
 
    (See also :class:`delimitedList`.)
    cCsgSr©rr&rrrr(‹szSuppress.postParsecCs|Sr©rrßrrrršŽszSuppress.suppressN)rrrrër(ršrrrrrJusc@s(eZdZdZdd„Zdd„Zdd„ZdS)    r9zDWrapper for parse actions, to ensure they are only called once.
    cCst|ƒ|_d|_dSr¯)rÈrÚcalled)rÐÚ
methodCallrrrrҕs
zOnlyOnce.__init__cCs.|js| |||¡}d|_|St||dƒ‚dS)NTr»)r¹rr>)rÐr¯rÂršr÷rrrr™˜s
zOnlyOnce.__call__cCs
d|_dSr¯)r¹rßrrrÚresetžszOnlyOnce.resetN)rrrrërÒr™r»rrrrr9’scs:tˆƒ‰‡fdd„}z ˆj|_Wntk
r4YnX|S)aqDecorator for debugging parse actions.
 
    When the parse action is called, this decorator will print
    ``">> entering method-name(line:<current_source_line>, <parse_location>, <matched_tokens>)"``.
    When the parse action completes, the decorator will print
    ``"<<"`` followed by the returned value, or any exception that the parse action raised.
 
    Example::
 
        wd = Word(alphas)
 
        @traceParseAction
        def remove_duplicate_chars(tokens):
            return ''.join(sorted(set(''.join(tokens))))
 
        wds = OneOrMore(wd).setParseAction(remove_duplicate_chars)
        print(wds.parseString("slkdjs sld sldd sdlf sdljf"))
 
    prints::
 
        >>entering remove_duplicate_chars(line: 'slkdjs sld sldd sdlf sdljf', 0, (['slkdjs', 'sld', 'sldd', 'sdlf', 'sdljf'], {}))
        <<leaving remove_duplicate_chars (ret: 'dfjkls')
        ['dfjkls']
    c
s´ˆj}|dd…\}}}t|ƒdkr8|djjd|}tj d|t||ƒ||f¡z ˆ|Ž}Wn8tk
rš}ztj d||f¡‚W5d}~XYnXtj d||f¡|S)NrÇr“rÚ.z">>entering %s(line: '%s', %d, %r)
z<<leaving %s (exception: %s)
z<<leaving %s (ret: %r)
)rrÛrÙr¢Ústderrr½rgr°)ÚpaArgsÚthisFuncr¯rÂršr§r©r­rrÚz»s  ztraceParseAction.<locals>.z)rÈrr×)r­rÁrrÀrr‚¡s  ú,cCs`t|ƒdt|ƒdt|ƒd}|rBt|t||ƒƒ |¡S|tt|ƒ|ƒ |¡SdS)aÎHelper to define a delimited list of expressions - the delimiter
    defaults to ','. By default, the list elements and delimiters can
    have intervening whitespace, and comments, but this can be
    overridden by passing ``combine=True`` in the constructor. If
    ``combine`` is set to ``True``, the matching tokens are
    returned as a single token string, with the delimiters included;
    otherwise, the matching tokens are returned as a list of tokens,
    with the delimiters suppressed.
 
    Example::
 
        delimitedList(Word(alphas)).parseString("aa,bb,cc") # -> ['aa', 'bb', 'cc']
        delimitedList(Word(hexnums), delim=':', combine=True).parseString("AA:BB:CC:DD:EE") # -> ['AA:BB:CC:DD:EE']
    z [rîr¡N)r¨r(rQrrJ)r¾ÚdelimÚcombineÚdlNamerrrr`Ñs$csjtƒ‰‡‡fdd„}|dkr0ttƒ dd„¡}n| ¡}| d¡|j|dd|ˆ d    tˆƒd
¡S) a>Helper to define a counted list of expressions.
 
    This helper defines a pattern of the form::
 
        integer expr expr expr...
 
    where the leading integer tells how many expr expressions follow.
    The matched tokens returns the array of expr tokens as a list - the
    leading count token is suppressed.
 
    If ``intExpr`` is specified, it should be a pyparsing expression
    that produces an integer value.
 
    Example::
 
        countedArray(Word(alphas)).parseString('2 ab cd ef')  # -> ['ab', 'cd']
 
        # in this parser, the leading integer value is given in binary,
        # '10' indicating that 2 values are in the array
        binaryConstant = Word('01').setParseAction(lambda t: int(t[0], 2))
        countedArray(Word(alphas), intExpr=binaryConstant).parseString('10 ab cd ef')  # -> ['ab', 'cd']
    cs.|d}ˆ|r ttˆg|ƒƒp&ttƒ>gSr)r/r$rc)r¯rÂršrˆ©Ú    arrayExprr¾rrÚcountFieldParseActionþs"z+countedArray.<locals>.countFieldParseActionNcSs t|dƒSr)r˜r™rrrr›rœzcountedArray.<locals>.<lambda>ÚarrayLenT©rúz(len) rÎ)r-rNrrr¤rlrrr¨)r¾ÚintExprrÈrrÆrr\æs
cCs6g}|D](}t|tƒr&| t|ƒ¡q| |¡q|Sr©)rr*rgrrr÷)ÚLr§rrrrrr
s 
 rrcs6tƒ‰‡fdd„}|j|ddˆ dt|ƒ¡ˆS)a4Helper to define an expression that is indirectly defined from
    the tokens matched in a previous expression, that is, it looks for
    a 'repeat' of a previous expression.  For example::
 
        first = Word(nums)
        second = matchPreviousLiteral(first)
        matchExpr = first + ":" + second
 
    will match ``"1:1"``, but not ``"1:2"``.  Because this
    matches a previous literal, will also match the leading
    ``"1:1"`` in ``"1:10"``. If this is not desired, use
    :class:`matchPreviousExpr`. Do *not* use with packrat parsing
    enabled.
    csP|rBt|ƒdkrˆ|d>qLt| ¡ƒ}ˆtdd„|Dƒƒ>n
ˆtƒ>dS)Nr¬rcss|]}t|ƒVqdSr©)r3©rÚttrrrr«*szDmatchPreviousLiteral.<locals>.copyTokenToRepeater.<locals>.<genexpr>)rÛrrr"r$r+)r¯rÂršÚtflat©ÚreprrÚcopyTokenToRepeater#s   z1matchPreviousLiteral.<locals>.copyTokenToRepeaterTrÊú(prev) )r-rrr¨)r¾rÒrrÐrros
 
csFtƒ‰| ¡}ˆ|K‰‡fdd„}|j|ddˆ dt|ƒ¡ˆS)aTHelper to define an expression that is indirectly defined from
    the tokens matched in a previous expression, that is, it looks for
    a 'repeat' of a previous expression.  For example::
 
        first = Word(nums)
        second = matchPreviousExpr(first)
        matchExpr = first + ":" + second
 
    will match ``"1:1"``, but not ``"1:2"``.  Because this
    matches by expressions, will *not* match the leading ``"1:1"``
    in ``"1:10"``; the expressions are evaluated first, and then
    compared, so ``"1"`` is compared with ``"10"``. Do *not* use
    with packrat parsing enabled.
    cs*t| ¡ƒ‰‡fdd„}ˆj|dddS)Ncs$t| ¡ƒ}|ˆkr tdddƒ‚dS)Nr»r)rrr"r>)r¯rÂršÚ theseTokens©Ú matchTokensrrÚmustMatchTheseTokensEs zLmatchPreviousExpr.<locals>.copyTokenToRepeater.<locals>.mustMatchTheseTokensTrÊ)rrr"r¤)r¯rÂršr×rÐrÕrrÒCs  z.matchPreviousExpr.<locals>.copyTokenToRepeaterTrÊrÓ)r-rlrrr¨)r¾Úe2rÒrrÐrrn1s cCs:dD]}| |t|¡}q| dd¡}| dd¡}t|ƒS)Nz\^-[]rôr¹r5r8)r²Ú_bslashr¨)r¯r¿rrrrNs
  rc söt|tƒrtjddd|r:dd„}dd„}|r4tnt‰ndd„}dd„}|rRtnt‰g}t|tƒrn| ¡}n$t|t    ƒr‚t
|ƒ}ntjd    t dd|sœt ƒS|s.d
}|t |ƒd kr.||}t||d d …ƒD]N\}    }
||
|ƒrú|||    d =q¦qÔ|||
ƒrÔ|||    d =| ||
¡q¦qÔ|d 7}q¦|sÔ|sÔ|rÔzlt |ƒt d  |¡ƒkr„tdd  dd„|Dƒ¡ƒ d |¡¡WStd dd„|Dƒ¡ƒ d |¡¡WSWn&tk
rÒtjdt ddYnXt‡fdd„|Dƒƒ d |¡¡S)aƒHelper to quickly define a set of alternative Literals, and makes
    sure to do longest-first testing when there is a conflict,
    regardless of the input order, but returns
    a :class:`MatchFirst` for best performance.
 
    Parameters:
 
     - strs - a string of space-delimited literals, or a collection of
       string literals
     - caseless - (default= ``False``) - treat all literals as
       caseless
     - useRegex - (default= ``True``) - as an optimization, will
       generate a Regex object; otherwise, will generate
       a :class:`MatchFirst` object (if ``caseless=True`` or ``asKeyword=True``, or if
       creating a :class:`Regex` raises an exception)
     - asKeyword - (default=``False``) - enforce Keyword-style matching on the
       generated expressions
 
    Example::
 
        comp_oper = oneOf("< = > <= >= !=")
        var = Word(alphas)
        number = Word(nums)
        term = var | number
        comparison_expr = term + comp_oper + term
        print(comparison_expr.searchString("B = 12  AA=23 B<=AA AA>12"))
 
    prints::
 
        [['B', '=', '12'], ['AA', '=', '23'], ['B', '<=', 'AA'], ['AA', '>', '12']]
    z_More than one string argument passed to oneOf, pass choices as a list or space-delimited stringr•rzcSs| ¡| ¡kSr©)rç©roÚbrrrr›{rœzoneOf.<locals>.<lambda>cSs| ¡ | ¡¡Sr©)rçrrÚrrrr›|rœcSs||kSr©rrÚrrrr›rœcSs
| |¡Sr©rrÚrrrr›€rœz6Invalid argument to oneOf, expected string or iterablerr¬Nr»rcss|]}t|ƒVqdSr©)r©rÚsymrrrr«£szoneOf.<locals>.<genexpr>rsú|css|]}t |¡VqdSr©)r’rrÜrrrr«¥sz7Exception creating Regex for oneOf, building MatchFirstc3s|]}ˆ|ƒVqdSr©rrÜ©ÚparseElementClassrrr««s)rr/r~rr%r&r0r3r°r
r*r€r6rÛrürcrârFrr°r5) ÚstrsræÚuseRegexrÚisequalÚmasksÚsymbolsrÚcurrCrmrrßrrsVs\ 
ÿ 
 
 
 
ÿ
 
 
**ÿ cCsttt||ƒƒƒS)aéHelper to easily and clearly define a dictionary by specifying
    the respective patterns for the key and value.  Takes care of
    defining the :class:`Dict`, :class:`ZeroOrMore`, and
    :class:`Group` tokens in the proper order.  The key pattern
    can include delimiting markers or punctuation, as long as they are
    suppressed, thereby leaving the significant key text.  The value
    pattern can include named results, so that the :class:`Dict` results
    can include named token fields.
 
    Example::
 
        text = "shape: SQUARE posn: upper left color: light blue texture: burlap"
        attr_expr = (label + Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join))
        print(OneOrMore(attr_expr).parseString(text).dump())
 
        attr_label = label
        attr_value = Suppress(':') + OneOrMore(data_word, stopOn=label).setParseAction(' '.join)
 
        # similar to Dict, but simpler call format
        result = dictOf(attr_label, attr_value).parseString(text)
        print(result.dump())
        print(result['shape'])
        print(result.shape)  # object attribute access works too
        print(result.asDict())
 
    prints::
 
        [['shape', 'SQUARE'], ['posn', 'upper left'], ['color', 'light blue'], ['texture', 'burlap']]
        - color: light blue
        - posn: upper left
        - shape: SQUARE
        - texture: burlap
        SQUARE
        SQUARE
        {'color': 'light blue', 'shape': 'SQUARE', 'posn': 'upper left', 'texture': 'burlap'}
    )r)r8r/)rarDrrrra­s%cCs^tƒ dd„¡}| ¡}d|_|dƒ||dƒ}|r@dd„}ndd„}| |¡|j|_|S)    a—Helper to return the original, untokenized text for a given
    expression.  Useful to restore the parsed fields of an HTML start
    tag into the raw tag text itself, or to revert separate tokens with
    intervening whitespace back to the original matching input text. By
    default, returns astring containing the original parsed text.
 
    If the optional ``asString`` argument is passed as
    ``False``, then the return value is
    a :class:`ParseResults` containing any results names that
    were originally matched, and a single token containing the original
    matched text from the input string.  So if the expression passed to
    :class:`originalTextFor` contains expressions with defined
    results names, you must set ``asString`` to ``False`` if you
    want to preserve those results name values.
 
    Example::
 
        src = "this is test <b> bold <i>text</i> </b> normal text "
        for tag in ("b", "i"):
            opener, closer = makeHTMLTags(tag)
            patt = originalTextFor(opener + SkipTo(closer) + closer)
            print(patt.searchString(src)[0])
 
    prints::
 
        ['<b> bold <i>text</i> </b>']
        ['<i>text</i>']
    cSs|Sr©r)r¯rÌršrrrr›ñrœz!originalTextFor.<locals>.<lambda>FÚ_original_startÚ _original_endcSs||j|j…Sr©)rçrèrÁrrrr›örœcSs&|| d¡| d¡…g|dd…<dS)Nrçrè)r`rÁrrrÚ extractTextøsz$originalTextFor.<locals>.extractText)r+r¤rlrùrò)r¾ÚasStringÚ    locMarkerÚ endlocMarkerÚ    matchExprrérrrr‡Ôs
 
cCst|ƒ dd„¡S)zkHelper to undo pyparsing's default grouping of And expressions,
    even if all but one are non-empty.
    cSs|dSrrr™rrrr›rœzungroup.<locals>.<lambda>)rLr)r¾rrrrˆþscCs4tƒ dd„¡}t|dƒ|dƒ| ¡ ¡dƒƒS)a±Helper to decorate a returned token with its starting and ending
    locations in the input string.
 
    This helper adds the following results names:
 
     - locn_start = location where matched expression begins
     - locn_end = location where matched expression ends
     - value = the actual parsed results
 
    Be careful if the input text contains ``<TAB>`` characters, you
    may want to call :class:`ParserElement.parseWithTabs`
 
    Example::
 
        wd = Word(alphas)
        for match in locatedExpr(wd).searchString("ljsdf123lksdjjf123lkkjj1222"):
            print(match)
 
    prints::
 
        [[0, 'ljsdf', 5]]
        [[8, 'lksdjjf', 15]]
        [[18, 'lkkjj', 23]]
    cSs|Sr©rrÁrrrr›rœzlocatedExpr.<locals>.<lambda>Ú
locn_startrDÚlocn_end)r+r¤r/rlrœ)r¾ÚlocatorrrrrŠsz\[]-*.$+^?()~ ©r
cCs |ddSr;rrÁrrrr›(rœr›z\\0?[xX][0-9a-fA-F]+cCstt|d d¡dƒƒS)Nrz\0xrí)Úunichrr˜r¾rÁrrrr›)rœz    \\0[0-7]+cCstt|ddd…dƒƒS)Nrr¬é)ròr˜rÁrrrr›*rœz\]rVrzrïÚnegateÚbodyr}csFdd„‰z"d ‡fdd„t |¡jDƒ¡WStk
r@YdSXdS)aHelper to easily define string ranges for use in Word
    construction. Borrows syntax from regexp '[]' string range
    definitions::
 
        srange("[0-9]")   -> "0123456789"
        srange("[a-z]")   -> "abcdefghijklmnopqrstuvwxyz"
        srange("[a-z$_]") -> "abcdefghijklmnopqrstuvwxyz$_"
 
    The input string must be enclosed in []'s, and the returned string
    is the expanded character set joined into a single string. The
    values enclosed in the []'s may be:
 
     - a single character
     - an escaped character with a leading backslash (such as ``\-``
       or ``\]``)
     - an escaped hex character with a leading ``'\x'``
       (``\x21``, which is a ``'!'`` character) (``\0x##``
       is also supported for backwards compatibility)
     - an escaped octal character with a leading ``'\0'``
       (``\041``, which is a ``'!'`` character)
     - a range of any of the above, separated by a dash (``'a-z'``,
       etc.)
     - any combination of the above (``'aeiouy'``,
       ``'a-zA-Z0-9_$'``, etc.)
    cSs<t|tƒs|Sd dd„tt|dƒt|dƒdƒDƒ¡S)Nr»css|]}t|ƒVqdSr©©ròr¾rrrr«Isz+srange.<locals>.<lambda>.<locals>.<genexpr>rr¬)rrArâr<Úord)Úprrrr›Irœzsrange.<locals>.<lambda>r»c3s|]}ˆ|ƒVqdSr©r)rÚpart©Ú    _expandedrrr«Kszsrange.<locals>.<genexpr>N)râÚ_reBracketExprrfrõr°rrrúrr/s
"cs‡fdd„}|S)zoHelper method for defining parse actions that require matching at
    a specific column in the input text.
    cs"t||ƒˆkrt||dˆƒ‚dS)Nzmatched token not at column %drH)r·ÚlocnrÂr‡rrÚ    verifyColSsz!matchOnlyAtCol.<locals>.verifyColr)rˆrþrr‡rrmOs cs ‡fdd„S)aµHelper method for common parse actions that simply return
    a literal value.  Especially useful when used with
    :class:`transformString<ParserElement.transformString>` ().
 
    Example::
 
        num = Word(nums).setParseAction(lambda toks: int(toks[0]))
        na = oneOf("N/A NA").setParseAction(replaceWith(math.nan))
        term = na | num
 
        OneOrMore(term).parseString("324 234 N/A 234") # -> [324, 234, nan, 234]
    csˆgSr©rrÁ©ÚreplStrrrr›erœzreplaceWith.<locals>.<lambda>rrÿrrÿrr|Xs cCs|ddd…S)aHelper parse action for removing quotation marks from parsed
    quoted strings.
 
    Example::
 
        # by default, quotation marks are included in parsed results
        quotedString.parseString("'Now is the Winter of our Discontent'") # -> ["'Now is the Winter of our Discontent'"]
 
        # use removeQuotes to strip quotation marks from parsed results
        quotedString.setParseAction(removeQuotes)
        quotedString.parseString("'Now is the Winter of our Discontent'") # -> ["Now is the Winter of our Discontent"]
    rr¬r–rrÁrrrrzgs csN‡‡fdd„}ztˆdtˆdƒjƒ}Wntk
rBtˆƒ}YnX||_|S)aLHelper to define a parse action by mapping a function to all
    elements of a ParseResults list. If any additional args are passed,
    they are forwarded to the given function as additional arguments
    after the token, as in
    ``hex_integer = Word(hexnums).setParseAction(tokenMap(int, 16))``,
    which will convert the parsed data to an integer using base 16.
 
    Example (compare the last to example in :class:`ParserElement.transformString`::
 
        hex_ints = OneOrMore(Word(hexnums)).setParseAction(tokenMap(int, 16))
        hex_ints.runTests('''
            00 11 22 aa FF 0a 0d 1a
            ''')
 
        upperword = Word(alphas).setParseAction(tokenMap(str.upper))
        OneOrMore(upperword).runTests('''
            my kingdom for a horse
            ''')
 
        wd = Word(alphas).setParseAction(tokenMap(str.title))
        OneOrMore(wd).setParseAction(' '.join).runTests('''
            now is the winter of our discontent made glorious summer by this sun of york
            ''')
 
    prints::
 
        00 11 22 aa FF 0a 0d 1a
        [0, 17, 34, 170, 255, 10, 13, 26]
 
        my kingdom for a horse
        ['MY', 'KINGDOM', 'FOR', 'A', 'HORSE']
 
        now is the winter of our discontent made glorious summer by this sun of york
        ['Now Is The Winter Of Our Discontent Made Glorious Summer By This Sun Of York']
    cs‡‡fdd„|DƒS)Ncsg|]}ˆ|fˆžŽ‘qSrr)rÚtokn©rÏrÅrrr›sz(tokenMap.<locals>.pa.<locals>.<listcomp>rrÁrrrrǚsztokenMap.<locals>.parrÙ)rÛrr°rŸ)rÅrÏrÇrÞrrrrvs$
ÿcCs t|ƒ ¡Sr©©r¨rçr™rrrr›¦rœcCs t|ƒ ¡Sr©©r¨Úlowerr™rrrr›ªrœrrŽcs~t|tƒr|‰t|| d}n|j‰tttdƒ}|rŽt ¡     t
¡}||dƒt t t |tdƒ|ƒƒƒtddgddƒ     d    d
„¡|}nlt ¡     t
¡ttd d B}||dƒt t t |     t¡ttdƒ|ƒƒƒƒtddgddƒ     d d
„¡|}ttdƒ|d dd}| dˆ¡| ‡fdd
„¡|dd ˆ dd¡ ¡ ¡¡ƒ dˆ¡}ˆ|_ˆ|_t|ƒƒ|_||fS)zRInternal helper to construct opening and closing tag expressions, given a tag namerìz_-:Útagú=ú/F©r\rccSs |ddkS©NrrrrÁrrrr›¾rœz_makeTags.<locals>.<lambda>rŽrøcSs |ddkSr
rrÁrrrr›Ærœr)r²z<%s>c    s*| dd ˆ dd¡ ¡ ¡¡| ¡¡S)Nrñr»ú:rî)r:râr²Útitler°rlr™©Úresnamerrr›Ìrœrr»r rîz</%s>)rr/r0r!rNrTrSr^rlr¤rzr)rQr/rJr:ryrvrbr(Ú_Lrrrâr²r r°rrGÚtag_body)ÚtagStrÚxmlÚ suppress_LTÚ suppress_GTÚ tagAttrNameÚ tagAttrValueÚopenTagÚcloseTagrr rÚ    _makeTags®sH
ÿþýüÿÿþüû, rcCs
t|dƒS)aKHelper to construct opening and closing tag expressions for HTML,
    given a tag name. Matches tags in either upper or lower case,
    attributes with namespaces and with quoted or unquoted values.
 
    Example::
 
        text = '<td>More info at the <a href="https://github.com/pyparsing/pyparsing/wiki">pyparsing</a> wiki page</td>'
        # makeHTMLTags returns pyparsing expressions for the opening and
        # closing tags as a 2-tuple
        a, a_end = makeHTMLTags("A")
        link_expr = a + SkipTo(a_end)("link_text") + a_end
 
        for link in link_expr.searchString(text):
            # attributes in the <A> tag (like "href" shown here) are
            # also accessible as named results
            print(link.link_text, '->', link.href)
 
    prints::
 
        pyparsing -> https://github.com/pyparsing/pyparsing/wiki
    F©r©rrrrrkÓscCs
t|dƒS)z»Helper to construct opening and closing tag expressions for XML,
    given a tag name. Matches tags only in the given upper/lower case.
 
    Example: similar to :class:`makeHTMLTags`
    Trrrrrrlëscs8|r|dd…‰n| ¡‰dd„ˆDƒ‰‡fdd„}|S)a7Helper to create a validating parse action to be used with start
    tags created with :class:`makeXMLTags` or
    :class:`makeHTMLTags`. Use ``withAttribute`` to qualify
    a starting tag with a required attribute value, to avoid false
    matches on common tags such as ``<TD>`` or ``<DIV>``.
 
    Call ``withAttribute`` with a series of attribute names and
    values. Specify the list of filter attributes names and values as:
 
     - keyword arguments, as in ``(align="right")``, or
     - as an explicit dict with ``**`` operator, when an attribute
       name is also a Python reserved word, as in ``**{"class":"Customer", "align":"right"}``
     - a list of name-value tuples, as in ``(("ns1:class", "Customer"), ("ns2:align", "right"))``
 
    For attribute names with a namespace prefix, you must use the second
    form.  Attribute names are matched insensitive to upper/lower case.
 
    If just testing for ``class`` (with or without a namespace), use
    :class:`withClass`.
 
    To verify that the attribute exists, but without specifying a value,
    pass ``withAttribute.ANY_VALUE`` as the value.
 
    Example::
 
        html = '''
            <div>
            Some text
            <div type="grid">1 4 0 1 0</div>
            <div type="graph">1,3 2,3 1,1</div>
            <div>this has no type</div>
            </div>
 
        '''
        div,div_end = makeHTMLTags("div")
 
        # only match div tag having a type attribute with value "grid"
        div_grid = div().setParseAction(withAttribute(type="grid"))
        grid_expr = div_grid + SkipTo(div | div_end)("body")
        for grid_header in grid_expr.searchString(html):
            print(grid_header.body)
 
        # construct a match with any div tag having a type attribute, regardless of the value
        div_any_type = div().setParseAction(withAttribute(type=withAttribute.ANY_VALUE))
        div_expr = div_any_type + SkipTo(div | div_end)("body")
        for div_header in div_expr.searchString(html):
            print(div_header.body)
 
    prints::
 
        1 4 0 1 0
 
        1 4 0 1 0
        1,3 2,3 1,1
    NcSsg|]\}}||f‘qSrrr†rrrr/sz!withAttribute.<locals>.<listcomp>csZˆD]P\}}||kr$t||d|ƒ‚|tjkr|||krt||d||||fƒ‚qdS)Nzno matching attribute z+attribute '%s' has value '%s', must be '%s')r>r…Ú    ANY_VALUE)r¯rÂr0ÚattrNameÚ    attrValue©ÚattrsrrrÇ0s  ÿzwithAttribute.<locals>.pa)r?)rÏÚattrDictrÇrrrr…ós 8 cCs|r d|nd}tf||iŽS)aÉSimplified version of :class:`withAttribute` when
    matching on a div class - made difficult because ``class`` is
    a reserved word in Python.
 
    Example::
 
        html = '''
            <div>
            Some text
            <div class="grid">1 4 0 1 0</div>
            <div class="graph">1,3 2,3 1,1</div>
            <div>this &lt;div&gt; has no class</div>
            </div>
 
        '''
        div,div_end = makeHTMLTags("div")
        div_grid = div().setParseAction(withClass("grid"))
 
        grid_expr = div_grid + SkipTo(div | div_end)("body")
        for grid_header in grid_expr.searchString(html):
            print(grid_header.body)
 
        div_any_type = div().setParseAction(withClass(withAttribute.ANY_VALUE))
        div_expr = div_any_type + SkipTo(div | div_end)("body")
        for div_header in div_expr.searchString(html):
            print(div_header.body)
 
    prints::
 
        1 4 0 1 0
 
        1 4 0 1 0
        1,3 2,3 1,1
    z%s:classÚclass)r…)Ú    classnameÚ    namespaceÚ    classattrrrrr‹:s#ú(r(cCs°Gdd„dtƒ}tƒ}||||B}t|ƒD]r\}}|ddd…\}    }
} } |
dkr`d|    nd|    } |
dkr”|    dks„t|    ƒd    krŒtd
ƒ‚|    \}}tƒ | ¡}| tjkrt|
d krÒ|||    ƒt|t    |    ƒƒ}n |
d    kr*|    dk    r |||    |ƒt|t    |    |ƒƒ}n|||ƒt|t    |ƒƒ}nH|
dkrj||||||ƒt|t    ||||ƒƒ}ntd ƒ‚nì| tj
krX|
d krºt |    t ƒsžt |    ƒ}    ||    j |ƒt|    |ƒ}nœ|
d    kr|    dk    rô|||    |ƒt|t    |    |ƒƒ}n|||ƒt|t    |ƒƒ}nD|
dkrN||||||ƒt|||||ƒ}ntd ƒ‚ntd ƒ‚| rŒt | ttfƒr‚|j| Žn
| | ¡|| | ¡|BK}|}q.||K}|S)al
Helper method for constructing grammars of expressions made up of
    operators working in a precedence hierarchy.  Operators may be unary
    or binary, left- or right-associative.  Parse actions can also be
    attached to operator expressions. The generated parser will also
    recognize the use of parentheses to override operator precedences
    (see example below).
 
    Note: if you define a deep operator list, you may see performance
    issues when using infixNotation. See
    :class:`ParserElement.enablePackrat` for a mechanism to potentially
    improve your parser performance.
 
    Parameters:
     - baseExpr - expression representing the most basic element for the
       nested
     - opList - list of tuples, one for each operator precedence level
       in the expression grammar; each tuple is of the form ``(opExpr,
       numTerms, rightLeftAssoc, parseAction)``, where:
 
       - opExpr is the pyparsing expression for the operator; may also
         be a string, which will be converted to a Literal; if numTerms
         is 3, opExpr is a tuple of two expressions, for the two
         operators separating the 3 terms
       - numTerms is the number of terms for this operator (must be 1,
         2, or 3)
       - rightLeftAssoc is the indicator whether the operator is right
         or left associative, using the pyparsing-defined constants
         ``opAssoc.RIGHT`` and ``opAssoc.LEFT``.
       - parseAction is the parse action to be associated with
         expressions matching this operator expression (the parse action
         tuple member may be omitted); if the parse action is passed
         a tuple or list of functions, this is equivalent to calling
         ``setParseAction(*fn)``
         (:class:`ParserElement.setParseAction`)
     - lpar - expression for matching left-parentheses
       (default= ``Suppress('(')``)
     - rpar - expression for matching right-parentheses
       (default= ``Suppress(')')``)
 
    Example::
 
        # simple example of four-function arithmetic with ints and
        # variable names
        integer = pyparsing_common.signed_integer
        varname = pyparsing_common.identifier
 
        arith_expr = infixNotation(integer | varname,
            [
            ('-', 1, opAssoc.RIGHT),
            (oneOf('* /'), 2, opAssoc.LEFT),
            (oneOf('+ -'), 2, opAssoc.LEFT),
            ])
 
        arith_expr.runTests('''
            5+3*6
            (5+3)*6
            -2--11
            ''', fullDump=False)
 
    prints::
 
        5+3*6
        [[5, '+', [3, '*', 6]]]
 
        (5+3)*6
        [[[5, '+', 3], '*', 6]]
 
        -2--11
        [[['-', 2], '-', ['-', 11]]]
    c@seZdZddd„ZdS)zinfixNotation.<locals>._FBTcSs|j ||¡|gfSr©)r¾r6r%rrrrñ­sz$infixNotation.<locals>._FB.parseImplN)TrãrrrrÚ_FB¬sr'r©Nr r“z%s termz    %s%s termr•z@if numterms=3, opExpr must be a tuple or list of two expressionsr¬z6operator must be unary (1), binary (2), or ternary (3)z2operator must indicate right or left associativity)r,r-rürÛrŒrrtÚLEFTr/r8ÚRIGHTrr:r¾r‹r*r¤)ÚbaseExprÚopListÚlparÚrparr'r§ÚlastExprrÚoperDefÚopExprÚarityÚrightLeftAssocrÇÚtermNameÚopExpr1ÚopExpr2ÚthisExprrírrrr‰ds`Hÿ  
 
&
ÿ
 
 
 
&
ÿ
 
z4"(?:[^"\n\r\\]|(?:"")|(?:\\(?:[^x]|x[0-9a-fA-F]+)))*ú"z string enclosed in double quotesz4'(?:[^'\n\r\\]|(?:'')|(?:\\(?:[^x]|x[0-9a-fA-F]+)))*ú'z string enclosed in single quotesz*quotedString using single or double quotesÚuzunicode string literalcCsž||krtdƒ‚|dkr*t|tƒr"t|tƒr"t|ƒdkr¨t|ƒdkr¨|dk    r‚tt|t||tjddƒƒ     dd„¡}n$t
  ¡t||tjƒ     dd„¡}nx|dk    rìtt|t |ƒt |ƒttjddƒƒ     dd„¡}n4ttt |ƒt |ƒttjddƒƒ     d    d„¡}ntd
ƒ‚t ƒ}|dk    rd|tt|ƒt||B|Bƒt|ƒƒK}n$|tt|ƒt||Bƒt|ƒƒK}| d ||f¡|S) a—    Helper method for defining nested lists enclosed in opening and
    closing delimiters ("(" and ")" are the default).
 
    Parameters:
     - opener - opening character for a nested list
       (default= ``"("``); can also be a pyparsing expression
     - closer - closing character for a nested list
       (default= ``")"``); can also be a pyparsing expression
     - content - expression for items within the nested lists
       (default= ``None``)
     - ignoreExpr - expression for ignoring opening and closing
       delimiters (default= :class:`quotedString`)
 
    If an expression is not provided for the content argument, the
    nested expression will capture all whitespace-delimited content
    between delimiters as a list of separate values.
 
    Use the ``ignoreExpr`` argument to define expressions that may
    contain opening or closing characters that should not be treated as
    opening or closing characters for nesting, such as quotedString or
    a comment expression.  Specify multiple expressions using an
    :class:`Or` or :class:`MatchFirst`. The default is
    :class:`quotedString`, but if no expressions are to be ignored, then
    pass ``None`` for this argument.
 
    Example::
 
        data_type = oneOf("void int short long char float double")
        decl_data_type = Combine(data_type + Optional(Word('*')))
        ident = Word(alphas+'_', alphanums+'_')
        number = pyparsing_common.number
        arg = Group(decl_data_type + ident)
        LPAR, RPAR = map(Suppress, "()")
 
        code_body = nestedExpr('{', '}', ignoreExpr=(quotedString | cStyleComment))
 
        c_function = (decl_data_type("type")
                      + ident("name")
                      + LPAR + Optional(delimitedList(arg), [])("args") + RPAR
                      + code_body("body"))
        c_function.ignore(cStyleComment)
 
        source_code = '''
            int is_odd(int x) {
                return (x%2);
            }
 
            int dec_to_hex(char hchar) {
                if (hchar >= '0' && hchar <= '9') {
                    return (ord(hchar)-ord('0'));
                } else {
                    return (10+ord(hchar)-ord('A'));
                }
            }
        '''
        for func in c_function.searchString(source_code):
            print("%(name)s (%(type)s) args: %(args)s" % func)
 
 
    prints::
 
        is_odd (int) args: [['int', 'x']]
        dec_to_hex (int) args: [['char', 'hchar']]
    z.opening and closing strings cannot be the sameNr¬rñcSs |d ¡Sr©rãr™rrrr›;rœznestedExpr.<locals>.<lambda>cSs |d ¡Srr:r™rrrr›@rœcSs |d ¡Srr:r™rrrr›GrœcSs |d ¡Srr:r™rrrr›LrœzOopening and closing arguments must be strings if no content expression is givenznested %s%s expression)rŒrr/rÛr(r8r'rCrßr¤rcrlr3r-r/rJrQr)ÚopenerÚcloserÚcontentr¤r§rrrrpïs`A
ÿþþÿû
ÿþýÿþ ýü ÿ þý
*$c s&ˆdd…‰‡‡fdd„‰‡fdd„}‡fdd„}‡fdd    „}ttƒ d
¡ ¡tƒd }tƒtƒ |¡ d ¡}tƒ |¡ d ¡}tƒ |¡ d¡}    |rÌtt    |ƒ|t|t|ƒt    |ƒtƒd |    ƒ}
n.tt    |ƒt|t|ƒt    |ƒtƒd |    ƒ}
|
 
‡fdd„¡|  t tƒ¡|
 d¡S)aæHelper method for defining space-delimited indentation blocks,
    such as those used to define block statements in Python source code.
 
    Parameters:
 
     - blockStatementExpr - expression defining syntax of statement that
       is repeated within the indented block
     - indentStack - list created by caller to manage indentation stack
       (multiple statementWithIndentedBlock expressions within a single
       grammar should share a common indentStack)
     - indent - boolean indicating whether block must be indented beyond
       the current level; set to False for block of left-most
       statements (default= ``True``)
 
    A valid block must contain at least one ``blockStatement``.
 
    Example::
 
        data = '''
        def A(z):
          A1
          B = 100
          G = A2
          A2
          A3
        B
        def BB(a,b,c):
          BB1
          def BBA():
            bba1
            bba2
            bba3
        C
        D
        def spam(x,y):
             def eggs(z):
                 pass
        '''
 
 
        indentStack = [1]
        stmt = Forward()
 
        identifier = Word(alphas, alphanums)
        funcDecl = ("def" + identifier + Group("(" + Optional(delimitedList(identifier)) + ")") + ":")
        func_body = indentedBlock(stmt, indentStack)
        funcDef = Group(funcDecl + func_body)
 
        rvalue = Forward()
        funcCall = Group(identifier + "(" + Optional(delimitedList(rvalue)) + ")")
        rvalue << (funcCall | identifier | Word(nums))
        assignment = Group(identifier + "=" + rvalue)
        stmt << (funcDef | assignment | identifier)
 
        module_body = OneOrMore(stmt)
 
        parseTree = module_body.parseString(data)
        parseTree.pprint()
 
    prints::
 
        [['def',
          'A',
          ['(', 'z', ')'],
          ':',
          [['A1'], [['B', '=', '100']], [['G', '=', 'A2']], ['A2'], ['A3']]],
         'B',
         ['def',
          'BB',
          ['(', 'a', 'b', 'c', ')'],
          ':',
          [['BB1'], [['def', 'BBA', ['(', ')'], ':', [['bba1'], ['bba2'], ['bba3']]]]]],
         'C',
         'D',
         ['def',
          'spam',
          ['(', 'x', 'y', ')'],
          ':',
          [[['def', 'eggs', ['(', 'z', ')'], ':', [['pass']]]]]]]
    Ncsˆˆdd…<dSr©rr)Ú backup_stackÚ indentStackrrÚ reset_stackªsz"indentedBlock.<locals>.reset_stackcsN|t|ƒkrdSt||ƒ}|ˆdkrJ|ˆdkr>t||dƒ‚t||dƒ‚dS)Nr–zillegal nestingznot a peer entry)rÛrYr>©r¯rÂršÚcurCol©r?rrÚcheckPeerIndent­s 
   z&indentedBlock.<locals>.checkPeerIndentcs2t||ƒ}|ˆdkr"ˆ |¡n t||dƒ‚dS)Nr–znot a subentry)rYr÷r>rArCrrÚcheckSubIndentµs
  z%indentedBlock.<locals>.checkSubIndentcsJ|t|ƒkrdSt||ƒ}ˆr&|ˆks2t||dƒ‚|ˆdkrFˆ ¡dS)Nznot an unindentr–)rÛrYr>r`rArCrrÚ checkUnindent¼s 
   z$indentedBlock.<locals>.checkUnindentz     r ÚINDENTr»ÚUNINDENTcsˆƒSr©r)rorÛr¿r)r@rrr›ÑrœzindentedBlock.<locals>.<lambda>zindented block) r8r1rršrHr+r¤rr/r:rrŸrÙ) ÚblockStatementExprr?r“rDrErFr§rGÚPEERÚUNDENTÚsmExprr)r>r?r@rr†Ws2Q    ÿþýÿþz#[\0xc0-\0xd6\0xd8-\0xf6\0xf8-\0xff]z[\0xa1-\0xbf\0xd7\0xf7]z_:zany tagzgt lt amp nbsp quot aposz><& "'z &(?P<entity>rÞz);zcommon HTML entitycCs t |j¡S)zRHelper parser action to replace common HTML entities with their special characters)Ú_htmlEntityMaprþÚentityr™rrrr{Ûsz/\*(?:[^*]|\*(?!/))*z*/zC style commentz<!--[\s\S]*?-->z HTML commentz.*z rest of linez//(?:\\\n|[^\n])*z
// commentzC++ style commentz#.*zPython style commentrøú     Ú    commaItemr    c@s¨eZdZdZeeƒZeeƒZe    e
ƒ  d¡  e¡Z e    eƒ  d¡  eedƒ¡Zedƒ  d¡  e¡Zeƒ  e¡deƒ  e¡  d¡Ze d    d
„¡eeeed ƒ ¡eƒB  d ¡Ze e¡ed ƒ  d¡  e¡Zedƒ  d¡  e¡ZeeBeB ¡Zedƒ  d¡  e¡Ze    ededƒ  d¡Zedƒ  d¡Z edƒ  d¡Z!e!de!d  d¡Z"ee!de!dƒdee!de!dƒ  d¡Z#e# $dd
„¡d e   d!¡Z%e&e"e%Be#B  d"¡ƒ  d"¡Z'ed#ƒ  d$¡Z(e)d=d&d'„ƒZ*e)d>d)d*„ƒZ+ed+ƒ  d,¡Z,ed-ƒ  d.¡Z-ed/ƒ  d0¡Z.e/ ¡e0 ¡BZ1e)d1d2„ƒZ2e&e3e4d3ƒe5ƒe    e6d3d4ee7d5ƒƒƒƒ ¡  d6¡Z8e9ee: ;¡e8Bd7d8ƒ  d9¡Z<e)ed:d
„ƒƒZ=e)ed;d
„ƒƒZ>d<S)?rŽa Here are some common low-level expressions that may be useful in
    jump-starting parser development:
 
     - numeric forms (:class:`integers<integer>`, :class:`reals<real>`,
       :class:`scientific notation<sci_real>`)
     - common :class:`programming identifiers<identifier>`
     - network addresses (:class:`MAC<mac_address>`,
       :class:`IPv4<ipv4_address>`, :class:`IPv6<ipv6_address>`)
     - ISO8601 :class:`dates<iso8601_date>` and
       :class:`datetime<iso8601_datetime>`
     - :class:`UUID<uuid>`
     - :class:`comma-separated list<comma_separated_list>`
 
    Parse actions:
 
     - :class:`convertToInteger`
     - :class:`convertToFloat`
     - :class:`convertToDate`
     - :class:`convertToDatetime`
     - :class:`stripHTMLTags`
     - :class:`upcaseTokens`
     - :class:`downcaseTokens`
 
    Example::
 
        pyparsing_common.number.runTests('''
            # any int or real number, returned as the appropriate type
            100
            -100
            +100
            3.14159
            6.02e23
            1e-12
            ''')
 
        pyparsing_common.fnumber.runTests('''
            # any int or real number, returned as float
            100
            -100
            +100
            3.14159
            6.02e23
            1e-12
            ''')
 
        pyparsing_common.hex_integer.runTests('''
            # hex numbers
            100
            FF
            ''')
 
        pyparsing_common.fraction.runTests('''
            # fractions
            1/2
            -3/4
            ''')
 
        pyparsing_common.mixed_integer.runTests('''
            # mixed fractions
            1
            1/2
            -3/4
            1-3/4
            ''')
 
        import uuid
        pyparsing_common.uuid.setParseAction(tokenMap(uuid.UUID))
        pyparsing_common.uuid.runTests('''
            # uuid
            12345678-1234-5678-1234-567812345678
            ''')
 
    prints::
 
        # any int or real number, returned as the appropriate type
        100
        [100]
 
        -100
        [-100]
 
        +100
        [100]
 
        3.14159
        [3.14159]
 
        6.02e23
        [6.02e+23]
 
        1e-12
        [1e-12]
 
        # any int or real number, returned as float
        100
        [100.0]
 
        -100
        [-100.0]
 
        +100
        [100.0]
 
        3.14159
        [3.14159]
 
        6.02e23
        [6.02e+23]
 
        1e-12
        [1e-12]
 
        # hex numbers
        100
        [256]
 
        FF
        [255]
 
        # fractions
        1/2
        [0.5]
 
        -3/4
        [-0.75]
 
        # mixed fractions
        1
        [1]
 
        1/2
        [0.5]
 
        -3/4
        [-0.75]
 
        1-3/4
        [1.75]
 
        # uuid
        12345678-1234-5678-1234-567812345678
        [UUID('12345678-1234-5678-1234-567812345678')]
    Úintegerz hex integerríz[+-]?\d+zsigned integerrÚfractioncCs|d|dS)Nrr–rr™rrrr›¤rœzpyparsing_common.<lambda>rVz"fraction or mixed integer-fractionz[+-]?(?:\d+\.\d*|\.\d+)z real numberz@[+-]?(?:\d+(?:[eE][+-]?\d+)|(?:\d+\.\d*|\.\d+)(?:[eE][+-]?\d+)?)z$real number with scientific notationz[+-]?\d+\.?\d*([eE][+-]?\d+)?ÚfnumberrŽÚ
identifierzK(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})(\.(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})){3}z IPv4 addressz[0-9a-fA-F]{1,4}Ú hex_integerr ézfull IPv6 address)rrÒz::zshort IPv6 addresscCstdd„|DƒƒdkS)Ncss|]}tj |¡rdVqdSrŠ)rŽÚ
_ipv6_partrlrÍrrrr«Äs z,pyparsing_common.<lambda>.<locals>.<genexpr>ró)r~r™rrrr›Ärœz::ffff:zmixed IPv6 addressz IPv6 addressz:[0-9a-fA-F]{2}([:.-])[0-9a-fA-F]{2}(?:\1[0-9a-fA-F]{2}){4}z MAC addressú%Y-%m-%dcs‡fdd„}|S)aÝ
        Helper to create a parse action for converting parsed date string to Python datetime.date
 
        Params -
         - fmt - format to be passed to datetime.strptime (default= ``"%Y-%m-%d"``)
 
        Example::
 
            date_expr = pyparsing_common.iso8601_date.copy()
            date_expr.setParseAction(pyparsing_common.convertToDate())
            print(date_expr.parseString("1999-12-31"))
 
        prints::
 
            [datetime.date(1999, 12, 31)]
        c
sNzt |dˆ¡ ¡WStk
rH}zt||t|ƒƒ‚W5d}~XYnXdSr)rÚstrptimeÚdaterŒr>rŸ©r¯rÂršÚve©ÚfmtrrÚcvt_fnÞsz.pyparsing_common.convertToDate.<locals>.cvt_fnr©r^r_rr]rÚ convertToDateÌs zpyparsing_common.convertToDateú%Y-%m-%dT%H:%M:%S.%fcs‡fdd„}|S)aHelper to create a parse action for converting parsed
        datetime string to Python datetime.datetime
 
        Params -
         - fmt - format to be passed to datetime.strptime (default= ``"%Y-%m-%dT%H:%M:%S.%f"``)
 
        Example::
 
            dt_expr = pyparsing_common.iso8601_datetime.copy()
            dt_expr.setParseAction(pyparsing_common.convertToDatetime())
            print(dt_expr.parseString("1999-12-31T23:59:59.999"))
 
        prints::
 
            [datetime.datetime(1999, 12, 31, 23, 59, 59, 999000)]
        c
sJzt |dˆ¡WStk
rD}zt||t|ƒƒ‚W5d}~XYnXdSr)rrYrŒr>rŸr[r]rrr_÷sz2pyparsing_common.convertToDatetime.<locals>.cvt_fnrr`rr]rÚconvertToDatetimeås z"pyparsing_common.convertToDatetimez7(?P<year>\d{4})(?:-(?P<month>\d\d)(?:-(?P<day>\d\d))?)?z ISO8601 datez†(?P<year>\d{4})-(?P<month>\d\d)-(?P<day>\d\d)[T ](?P<hour>\d\d):(?P<minute>\d\d)(:(?P<second>\d\d(\.\d*)?)?)?(?P<tz>Z|[+-]\d\d:?\d\d)?zISO8601 datetimez2[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}ÚUUIDcCstj |d¡S)aParse action to remove HTML tags from web page HTML source
 
        Example::
 
            # strip HTML links from normal text
            text = '<td>More info at the <a href="https://github.com/pyparsing/pyparsing/wiki">pyparsing</a> wiki page</td>'
            td, td_end = makeHTMLTags("TD")
            table_text = td + SkipTo(td_end).setParseAction(pyparsing_common.stripHTMLTags)("body") + td_end
            print(table_text.parseString(text).body)
 
        Prints::
 
            More info at the pyparsing wiki page
        r)rŽÚ_html_stripperr¥)r¯rÂr0rrrÚ stripHTMLTagsszpyparsing_common.stripHTMLTagsrÂrørOrPr»r    zcomma separated listcCs t|ƒ ¡Sr©rr™rrrr›#rœcCs t|ƒ ¡Sr©rr™rrrr›&rœN)rX)rb)?rrrrërr˜ÚconvertToIntegerÚfloatÚconvertToFloatrNrrrr¤rQrdrUrFÚsigned_integerrRrr:ršÚ mixed_integerr~ÚrealÚsci_realraÚnumberrSrTrSrTÚ ipv4_addressrWÚ_full_ipv6_addressÚ_short_ipv6_addressrÚ_mixed_ipv6_addressr(Ú ipv6_addressÚ mac_addressr rarcÚ iso8601_dateÚiso8601_datetimeÚuuidrWrVrerfr8r3r1rvrMÚ _commasepitemr`ryrlÚcomma_separated_listr„rbrrrrrŽþsv""
ÿþý  
 ÿ
þ
ý ý
ÿÿþc@seZdZdd„Zdd„ZdS)Ú_lazyclasspropertycCs||_|j|_|j|_dSr©)rÅrërrrrrrÒ+sz_lazyclassproperty.__init__cslˆdkrt|ƒ‰tˆdƒr:t‡fdd„ˆjdd…Dƒƒr@iˆ_|jj}|ˆjkrb| ˆ¡ˆj|<ˆj|S)NÚ_internc3s |]}ˆjt|dgƒkVqdS)r{N)r{rÛ)rÚ
superclassrärrr«3sÿz-_lazyclassproperty.__get__.<locals>.<genexpr>r¬)rérQr¦Ú__mro__r{rÅr)rÐr¦rÓÚattrnamerrärÚ__get__0s ÿ
z_lazyclassproperty.__get__N)rrrrÒrrrrrrz*srzc@sPeZdZdZgZedd„ƒZedd„ƒZedd„ƒZ    edd    „ƒZ
ed
d „ƒZ d S) ra×
    A set of Unicode characters, for language-specific strings for
    ``alphas``, ``nums``, ``alphanums``, and ``printables``.
    A unicode_set is defined by a list of ranges in the Unicode character
    set, in a class attribute ``_ranges``, such as::
 
        _ranges = [(0x0020, 0x007e), (0x00a0, 0x00ff),]
 
    A unicode set can also be defined using multiple inheritance of other unicode sets::
 
        class CJK(Chinese, Japanese, Korean):
            pass
    cCsZg}|jD]8}|tkrqD|jD] }| t|d|ddƒ¡q q
dd„tt|ƒƒDƒS)Nrr–r¬cSsg|] }t|ƒ‘qSrrör¾rrrrTsz5unicode_set._get_chars_for_ranges.<locals>.<listcomp>)r}rÚ_rangesrgr<r¤rû)rÓr§ÚccÚrrrrrÚ_get_chars_for_rangesLs
 
 z!unicode_set._get_chars_for_rangescCsd ttj| ¡ƒ¡S)z+all non-whitespace characters in this ranger»)rârržrGrƒrärrrrvVszunicode_set.printablescCsd ttj| ¡ƒ¡S)z'all alphabetic characters in this ranger»)râÚfilterržÚisalpharƒrärrrrT[szunicode_set.alphascCsd ttj| ¡ƒ¡S)z*all numeric digit characters in this ranger»)râr„ržÚisdigitrƒrärrrrr`szunicode_set.numscCs |j|jS)z)all alphanumeric characters in this range)rTrrrärrrrSeszunicode_set.alphanumsN) rrrrër€rìrƒrzrvrTrrrSrrrrr<s 
    
 
 
c@sðeZdZdZdejfgZGdd„deƒZGdd„deƒZ    Gdd„deƒZ
Gd    d
„d
eƒZ Gd d „d eƒZ Gd d„deƒZ Gdd„deƒZGdd„deƒZGdd„de eeƒZGdd„deƒZGdd„deƒZGdd„deƒZGdd„deƒZdS)rzF
    A namespace class for defining common language unicode_sets.
    é c@seZdZdZddgZdS)zpyparsing_unicode.Latin1z/Unicode set for Latin-1 Unicode Character Range)r‡é~)é éÿN©rrrrër€rrrrÚLatin1qsrŒc@seZdZdZdgZdS)zpyparsing_unicode.LatinAz/Unicode set for Latin-A Unicode Character Range)éiNr‹rrrrÚLatinAusrŽc@seZdZdZdgZdS)zpyparsing_unicode.LatinBz/Unicode set for Latin-B Unicode Character Range)i€iONr‹rrrrÚLatinBysrc@s6eZdZdZdddddddd    d
d d d dddddgZdS)zpyparsing_unicode.Greekz.Unicode set for Greek Unicode Character Ranges)ipiÿ)ii)ii)i iE)iHiM)iPiW)iY)i[)i])i_i})i€i´)i¶iÄ)iÆiÓ)iÖiÛ)iÝiï)iòiô)iöiþNr‹rrrrÚGreek}s&ýrc@seZdZdZdgZdS)zpyparsing_unicode.Cyrillicz0Unicode set for Cyrillic Unicode Character Range)iiÿNr‹rrrrÚCyrillic…sr‘c@seZdZdZddgZdS)zpyparsing_unicode.Chinesez/Unicode set for Chinese Unicode Character Range)éNiÿŸ©i0i?0Nr‹rrrrÚChinese‰sr”c@sDeZdZdZgZGdd„deƒZGdd„deƒZGdd„deƒZdS)    zpyparsing_unicode.Japanesez`Unicode set for Japanese Unicode Character Range, combining Kanji, Hiragana, and Katakana rangesc@seZdZdZddgZdS)z pyparsing_unicode.Japanese.Kanjiz-Unicode set for Kanji Unicode Character Range)r’i¿Ÿr“Nr‹rrrrÚKanji‘sr•c@seZdZdZdgZdS)z#pyparsing_unicode.Japanese.Hiraganaz0Unicode set for Hiragana Unicode Character Range)i@0iŸ0Nr‹rrrrÚHiragana•sr–c@seZdZdZdgZdS)z#pyparsing_unicode.Japanese.Katakanaz1Unicode set for Katakana  Unicode Character Range)i 0iÿ0Nr‹rrrrÚKatakana™sr—N)    rrrrër€rr•r–r—rrrrÚJapaneses
r˜c@s eZdZdZddddddgZdS)    zpyparsing_unicode.Koreanz.Unicode set for Korean Unicode Character Range)i¬i¯×)iiÿ)i01i1)i`©i©)i°×iÿ×r“Nr‹rrrrÚKoreansr™c@seZdZdZdS)zpyparsing_unicode.CJKzTUnicode set for combined Chinese, Japanese, and Korean (CJK) Unicode Character RangeNrrrrrÚCJK¡sršc@seZdZdZddgZdS)zpyparsing_unicode.Thaiz,Unicode set for Thai Unicode Character Range)ii:)i?i[Nr‹rrrrÚThai¥sr›c@seZdZdZdddgZdS)zpyparsing_unicode.Arabicz.Unicode set for Arabic Unicode Character Range)ii)iiÿ)iiNr‹rrrrÚArabic©srœc@seZdZdZdgZdS)zpyparsing_unicode.Hebrewz.Unicode set for Hebrew Unicode Character Range)iiÿNr‹rrrrÚHebrew­src@seZdZdZddgZdS)zpyparsing_unicode.Devanagariz2Unicode set for Devanagari Unicode Character Range)i    i    )ià¨iÿ¨Nr‹rrrrÚ
Devanagari±sržN)rrrrër¢Ú
maxunicoder€rrŒrŽrrr‘r”r˜r™ršr›rœrržrrrrrks uالعربيةu中文uкириллицаuΕλληνικάuעִברִיתu    æ—¥æœ¬èªžu漢字u カタカナu ひらがなu    í•œêµ­ì–´u    à¹„ทยuदेवनागरीc@s,eZdZdZGdd„dƒZGdd„dƒZdS)Úpyparsing_testzB
    namespace class for classes useful in writing unit tests
    c@s8eZdZdZdd„Zdd„Zdd„Zdd    „Zd
d „Zd S) z&pyparsing_test.reset_pyparsing_contextax
        Context manager to be used when writing unit tests that modify pyparsing config values:
         - packrat parsing
         - default whitespace characters.
         - default keyword characters
         - literal string auto-conversion class
         - __diag__ settings
 
        Example:
            with reset_pyparsing_context():
                # test that literals used to construct a grammar are automatically suppressed
                ParserElement.inlineLiteralsUsing(Suppress)
 
                term = Word(alphas) | Word(nums)
                group = Group('(' + term[...] + ')')
 
                # assert that the '()' characters are not included in the parsed tokens
                self.assertParseAndCheckLisst(group, "(abc 123 def)", ['abc', '123', 'def'])
 
            # after exiting context manager, literals are converted to Literal expressions again
        cCs
i|_dSr©)Ú _save_contextrßrrrrÒåsz/pyparsing_test.reset_pyparsing_context.__init__cCsftj|jd<tj|jd<tj|jd<tj|jd<tj|jd<dd„tj    Dƒ|jd<d    t
j i|jd
<|S) NÚdefault_whitespaceÚdefault_keyword_charsÚliteral_string_classÚpackrat_enabledÚ packrat_parsecSsi|]}|tt|ƒ“qSr)rÛr)rr!rrrÚ
<dictcomp>ðsz?pyparsing_test.reset_pyparsing_context.save.<locals>.<dictcomp>rrdr#) rCrßr¡r0rårãr^rrÚ
_all_namesr#rdrßrrrÚsaveès  þÿ  ÿ ÿ
z+pyparsing_test.reset_pyparsing_context.savecCsˆtj|jdkr t |jd¡|jdt_t |jd¡|jd ¡D]\}}tt    ||ƒqJ|jdt_
|jdt_ |jdt _ dS)Nr¢r£r¤rr¥r¦r#)rCrßr¡râr0rårår?Úsetattrrr^rr#rd)rÐr!rDrrrÚrestoreøs ÿÿÿ ÿ  z.pyparsing_test.reset_pyparsing_context.restorecCs| ¡Sr©)r©rßrrrÚ    __enter__ sz0pyparsing_test.reset_pyparsing_context.__enter__cGs| ¡Sr©)r«rÖrrrÚ__exit__sz/pyparsing_test.reset_pyparsing_context.__exit__N)    rrrrërÒr©r«r¬r­rrrrÚreset_pyparsing_contextÎs r®c@sJeZdZdZddd„Zddd„Zddd    „Zdd
d „Zee    dfd d „ƒZ
dS)z&pyparsing_test.TestParseResultsAssertszk
        A mixin class to add parse results assertion methods to normal unittest.TestCase classes.
        NcCs<|dk    r|j|| ¡|d|dk    r8|j|| ¡|ddS)zÀ
            Unit test assertion to compare a ParseResults object with an optional expected_list,
            and compare any defined results names with an optional expected_dict.
            N©rÆ)Ú assertEqualr"r„)rÐrÊÚ expected_listÚ expected_dictrÆrrrÚassertParseResultsEqualssz?pyparsing_test.TestParseResultsAsserts.assertParseResultsEqualsTcCs2|j|dd}|rt| ¡ƒ|j|||ddS)z¾
            Convenience wrapper assert to test a parser element and input string, and assert that
            the resulting ParseResults.asList() is equal to the expected_list.
            Tr¶)r±rÆN©rfr¼r¥r³)rÐr¾Ú test_stringr±rÆÚverboserÊrrrÚassertParseAndCheckList!s z>pyparsing_test.TestParseResultsAsserts.assertParseAndCheckListcCs2|j|dd}|rt| ¡ƒ|j|||ddS)z¾
            Convenience wrapper assert to test a parser element and input string, and assert that
            the resulting ParseResults.asDict() is equal to the expected_dict.
            Tr¶)r²rÆNr´)rÐr¾rµr²rÆr¶rÊrrrÚassertParseAndCheckDict-s z>pyparsing_test.TestParseResultsAsserts.assertParseAndCheckDictc
Cs
|\}}|dk    rìdd„t||ƒDƒ}|D]Â\}}}    tdd„|    Dƒdƒ}
tdd„|    Dƒdƒ} | dk    r|j| |
pn|dt|tƒr„|‚W5QRXq(tdd„|    Dƒdƒ} td    d„|    Dƒdƒ} | | fd
krÜ|j|| | |
pÔ|d q(td  |¡ƒq(|j||dk    rþ|nd ddS)aP
            Unit test assertion to evaluate output of ParserElement.runTests(). If a list of
            list-dict tuples is given as the expected_parse_results argument, then these are zipped
            with the report tuples returned by runTests and evaluated using assertParseResultsEquals.
            Finally, asserts that the overall runTests() success value is True.
 
            :param run_tests_report: tuple(bool, [tuple(str, ParseResults or Exception)]) returned from runTests
            :param expected_parse_results (optional): [tuple(str, list, dict, Exception)]
            NcSs"g|]\}}|d|d|f‘qSrqr)rÚrptÚexpectedrrrrHsÿzOpyparsing_test.TestParseResultsAsserts.assertRunTestResults.<locals>.<listcomp>css|]}t|tƒr|VqdSr©)rrŸ©rÚexprrrr«Qs
zNpyparsing_test.TestParseResultsAsserts.assertRunTestResults.<locals>.<genexpr>css&|]}t|tƒrt|tƒr|VqdSr©)rrér‰r°r»rrrr«Ts
 
þ)Úexpected_exceptionrÆcss|]}t|tƒr|VqdSr©)rr*r»rrrr«cs
css|]}t|tƒr|VqdSr©)rr-r»rrrr«fs
r†)r±r²rÆzno validation for {!r}zfailed runTestsr¯)    r±rÚ assertRaisesrr°r³r¼røÚ
assertTrue)rÐÚrun_tests_reportÚexpected_parse_resultsrÆÚrun_test_successÚrun_test_resultsÚmergedrµrÊrºÚfail_msgr½r±r²rrrÚassertRunTestResults9sV þ ÿþúÿ
 ÿ ÿ üÿz;pyparsing_test.TestParseResultsAsserts.assertRunTestResultsc    cs$|j||d dVW5QRXdS)Nr¯)r¾)rÐrÄrÆrrrÚassertRaisesParseExceptionxszApyparsing_test.TestParseResultsAsserts.assertRaisesParseException)NNN)NT)NT)NN) rrrrër³r·r¸rÆrr>rÇrrrrÚTestParseResultsAssertss ÿ
ÿ
ÿ
ÿ
?rÈN)rrrrër®rÈrrrrr ÉsCr Ú__main__ÚselectÚfromrär¼)rÄÚcolumnsrZtablesÚcommandaK
        # '*' as column list and dotted table name
        select * from SYS.XYZZY
 
        # caseless match on "SELECT", and casts back to "select"
        SELECT * from XYZZY, ABC
 
        # list of column names, and mixed case SELECT keyword
        Select AA,BB,CC from Sys.dual
 
        # multiple tables
        Select A, B, C from Sys.dual, Table2
 
        # invalid SELECT keyword - should fail
        Xelect A, B, C from Sys.dual
 
        # incomplete command - should fail
        Select
 
        # invalid column name - should fail
        Select ^^^ frox Sys.dual
 
        z]
        100
        -100
        +100
        3.14159
        6.02e23
        1e-12
        z 
        100
        FF
        z6
        12345678-1234-5678-1234-567812345678
        )NF)r•)rÂF)N)FTF)T)r»)T(rër r!r"r¼Úweakrefrr7rlr¢r~r’rrSr¨rÌrBrÚoperatorrÚ    itertoolsÚ    functoolsrÚ
contextlibrrÚ ImportErrorrÚ_threadr    Ú    threadingÚcollections.abcr
r r r rMZ ordereddictrr#rdrrrrrrþr¯r¨rÚenable_all_warningsÚ__all__r‹Ú version_inforËr‡ÚmaxsizerÍrŸr/Úchrròržr¨r~rÛr¤Úreversedr*rûr¦rrr    rÚZmaxintÚxranger<Ú __builtin__r°Úfnamer÷rÛr×rér,r¸Úascii_uppercaseÚascii_lowercaserTrrrdrSrÙrâÚ    printablervr‘r°r<r>r@rBrErrrAÚregisterrYrjrgr¿rÃrÄrqrÈrCr}rKr+r6r3ràrrãr0r&r%rŒrNrrRrFrDr'rMrDr.r2r1rIrHrPrOr?r$r;r5r*r=r,r4r7r•r8rQr¢r:rGr-rLr(r/r)rJr9r‚r`r\rrrornrrsrar‡rˆrŠrrcrirhrr€r¤Ú _escapedPuncÚ_escapedHexCharÚ_escapedOctCharÚ _singleCharÚ
_charRangerrürrmr|rzrr„rbrrkrlr…rr‹rtr(r)r‰rur^r~ryrƒrpr†rUrwrWrVr-r±rMrWr[r{rXrerœr}r_r]rfrxrarxrZrŽrzrrr˜r•r€r–r—rªrœr”r‘rrr™r›ržr rZ selectTokenZ    fromTokenÚidentZ
columnNameZcolumnNameListZ
columnSpecZ    tableNameZ tableNameListZ    simpleSQLrÌrnrSrUrwrdrrrrÚ<module>s*ÿH        
í  
 ?]
 
H
 
 D+!
'N E 
 KFym{VO#K,:#Dvj-D0  $     W' *     :
 
    
 
 
0þ%
 
 
E&ÿÿh~
 
 (
 
ÿÿÿ þ ./Jÿþ6  ,