1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498
|
package PPR;
use 5.010;
use if $] < 5.018004, re => 'eval';
BEGIN {
if ($] >= 5.020 && $] <= 5.021) {
say {STDERR} <<" END_WARNING"
Warning: This program is running under Perl $^V and uses the PPR module.
Due to an unresolved issue with compilation of large regexes
in this version of Perl, your code is likely to compile
extremely slowly (i.e. it may take more than a minute).
PPR is being loaded at ${\join ' line ', (caller(2))[1,2]}.
END_WARNING
}
}
use warnings;
our $VERSION = '0.001010';
use utf8;
use List::Util qw<min max>;
# Class for $PPR::ERROR objects...
{ package PPR::ERROR;
use overload q{""} => 'source', q{0+} => 'line', fallback => 1;
sub new {
my ($class, %obj) = @_;
return bless \%obj, $class;
}
sub prefix { return shift->{prefix} }
sub source { return shift->{source} }
sub line { my $self = shift;
my $offset = $self->{line} // shift // 1;
return $offset + $self->{prefix} =~ tr/\n//;
}
sub origin { my $self = shift;
my $line = shift // 0;
my $file = shift // "";
return bless { %{$self}, line => $line, file => $file }, ref($self);
}
sub diagnostic { my $self = shift;
my $line = defined $self->{line}
? $self->{line} + $self->{prefix} =~ tr/\n//
: 0;
my $file = $self->{file} // q{};
return q{} if eval "no strict;\n"
. "#line $line $file\n"
. "sub{ $self->{source} }";
my $diagnostic = $@;
$diagnostic =~ s{ \s*+ \bat \s++ \( eval \s++ \d++ \) \s++ line \s++ 0,
| \s*+ \( eval \s++ \d++ \)
| \s++ \Z
| \s++ \bExecution \s++ of \s++ .*? \s++ aborted
\s++ due \s++ to \s++ compilation \s++ errors\.
}{}gx;
return $diagnostic;
}
}
# Define the grammar...
our $GRAMMAR = qr{
(?(DEFINE)
(?<PerlEntireDocument>
\A
(?&PerlDocument)
(?:
\Z
|
(?(?{ !defined $PPR::ERROR })
(?>(?&PerlOWSOrEND)) (?{pos()}) ([^\n]++)
(?{ $PPR::ERROR = PPR::ERROR->new(source => "$^N", prefix => substr($_, 0, $^R) ) })
(?!)
)
)
) # End of rule (?<PerlEntireDocument>)
(?<PerlDocument>
\x{FEFF}?+ # Optional BOM marker
(?&PerlStatementSequence)
(?&PerlOWSOrEND)
) # End of rule (?<PerlDocument>)
(?<PerlStatementSequence>
(?>(?&PerlPodSequence))
(?:
(?&PerlStatement)
(?&PerlPodSequence)
)*+
) # End of rule (?<PerlStatementSequence>)
(?<PerlStatement>
(?>
(?>(?&PerlPodSequence))
(?: (?>(?&PerlLabel)) (?&PerlOWSOrEND) )?+
(?>(?&PerlPodSequence))
(?>
(?&PerlKeyword)
|
# Inlined (?&PerlSubroutineDeclaration)
(?>
(?: (?> my | our | state ) \b (?>(?&PerlOWS)) )?+
sub \b (?>(?&PerlOWS))
(?>(?&PerlOldQualifiedIdentifier)) (?&PerlOWS)
|
AUTOLOAD (?&PerlOWS)
|
DESTROY (?&PerlOWS)
)
(?:
# Perl pre 5.028
(?:
(?>
(?&PerlSignature) # Parameter list
|
\( [^)]*+ \) # Prototype (
)
(?&PerlOWS)
)?+
(?: (?>(?&PerlAttributes)) (?&PerlOWS) )?+
|
# Perl post 5.028
(?: (?>(?&PerlAttributes)) (?&PerlOWS) )?+
(?: (?>(?&PerlSignature)) (?&PerlOWS) )?+ # Parameter list
)
(?> ; | (?&PerlBlock) )
# End of inlining
|
# Inlined (?&PerlMethodDeclaration)
method \b (?>(?&PerlOWS))
(?>(?&PerlQualifiedIdentifier)) (?&PerlOWS)
(?: (?>(?&PerlAttributes)) (?&PerlOWS) )?+
(?: (?>(?&PerlSignature)) (?&PerlOWS) )?+ # Parameter list
(?> ; | (?&PerlBlock) )
# End of inlining
|
# Inlined (?&PerlUseStatement)
(?: use | no ) (?>(?&PerlNWS))
(?>
(?&PerlVersionNumber)
|
(?>(?&PerlQualifiedIdentifier))
(?: (?>(?&PerlNWS)) (?&PerlVersionNumber)
(?! (?>(?&PerlOWS)) (?> (?&PerlInfixBinaryOperator) | (?&PerlComma) | \? ) )
)?+
(?: (?>(?&PerlNWS)) (?&PerlPodSequence) )?+
(?: (?>(?&PerlOWS)) (?&PerlExpression) )?+
)
(?>(?&PerlOWSOrEND)) (?> ; | (?= \} | \z ))
# End of inlining
|
# Inlined (?&PerlPackageDeclaration)
package
(?>(?&PerlNWS)) (?>(?&PerlQualifiedIdentifier))
(?: (?>(?&PerlNWS)) (?&PerlVersionNumber) )?+
(?>(?&PerlOWSOrEND)) (?> ; | (?&PerlBlock) | (?= \} | \z ))
# End of inlining
|
# Inlined (?&PerlClassDeclaration)
class
(?>(?&PerlNWS)) (?>(?&PerlQualifiedIdentifier))
(?: (?>(?&PerlNWS)) (?&PerlVersionNumber)
| (?>(?&PerlOWS)) : (?>(?&PerlOWS)) isa (?= \( ) (?&PPR_quotelike_body)
)?+
(?>(?&PerlOWSOrEND)) (?> ; | (?&PerlBlock) | (?= \} | \z ))
# End of inlining
|
# Inlined (?&PerlFieldDeclaration)
field \b
(?:
(?>(?&PerlOWS)) \$
(?>(?&PerlOWS)) (?&PerlIdentifier)
(?:
(?>(?&PerlOWS)) :
(?>(?&PerlOWS)) param
(?:
(?= \( ) (?&PPR_quotelike_body) # )
)?+
)?+
|
(?>(?&PerlOWS)) [\@%]
(?>(?&PerlOWS)) (?&PerlIdentifier)
)
(?:
(?>(?&PerlOWS)) (?: //= | \|\|= | = )
(?>(?&PerlOWS)) (?&PerlConditionalExpression)
)?+
(?>(?&PerlOWSOrEND)) (?> ; | (?= \} | \z ))
# End of inlining
|
(?&PerlControlBlock)
|
(?&PerlFormat)
|
(?>(?&PerlExpression)) (?>(?&PerlOWS))
(?&PerlStatementModifier)?+ (?>(?&PerlOWSOrEND))
(?> ; | (?= \} | \z ))
|
(?&PerlBlock)
|
;
)
| # A yada-yada...
\.\.\. (?>(?&PerlOWSOrEND))
(?> ; | (?= \} | \z ))
| # Just a label...
(?>(?&PerlLabel)) (?>(?&PerlOWSOrEND))
(?> ; | (?= \} | \z ))
| # Just an empty statement...
(?>(?&PerlOWS)) ;
| # An error (report it, if it's the first)...
(?(?{ !defined $PPR::ERROR })
(?> (?&PerlOWS) )
(?! (?: \} | \z ) )
(?{ pos() })
( (?&PerlExpression) (?&PerlOWS) [^\n]++ | [^;\}]++ )
(?{ $PPR::ERROR //= PPR::ERROR->new(source => $^N, prefix => substr($_, 0, $^R) ) })
(?!)
)
)
) # End of rule (?<PerlStatement>)
(?<PerlSubroutineDeclaration>
(?>
(?: (?> my | our | state ) \b (?>(?&PerlOWS)) )?+
sub \b (?>(?&PerlOWS))
(?>(?&PerlOldQualifiedIdentifier)) (?&PerlOWS)
|
AUTOLOAD (?&PerlOWS)
|
DESTROY (?&PerlOWS)
)
(?:
# Perl pre 5.028
(?:
(?>
(?&PerlSignature) # Parameter list
|
\( [^)]*+ \) # Prototype (
)
(?&PerlOWS)
)?+
(?: (?>(?&PerlAttributes)) (?&PerlOWS) )?+
|
# Perl post 5.028
(?: (?>(?&PerlAttributes)) (?&PerlOWS) )?+
(?: (?>(?&PerlSignature)) (?&PerlOWS) )?+ # Parameter list
)
(?> ; | (?&PerlBlock) )
) # End of rule (?<PerlSubroutineDeclaration>)
(?<PerlMethodDeclaration>
method \b (?>(?&PerlOWS))
(?>(?&PerlQualifiedIdentifier)) (?&PerlOWS)
(?: (?>(?&PerlAttributes)) (?&PerlOWS) )?+
(?: (?>(?&PerlSignature)) (?&PerlOWS) )?+ # Parameter list
(?> ; | (?&PerlBlock) )
) # End of rule (?<PerlMethodDeclaration>)
(?<PerlSignature>
\(
(?>(?&PerlOWS))
(?&PerlParameterDeclaration)*+
\)
) # End of rule (?<PerlSignature>)
(?<PerlParameterDeclaration>
(?:
\$ (?>(?&PerlOWS))
(?:
(?: = | //= | \|\|= ) (?>(?&PerlOWS))
(?&PerlConditionalExpression)?+ (?>(?&PerlOWS))
)?+
|
(?&PerlVariableScalar) (?>(?&PerlOWS))
(?:
(?: = | //= | \|\|= ) (?>(?&PerlOWS))
(?&PerlConditionalExpression) (?>(?&PerlOWS))
)?+
|
(?&PerlVariableArray) (?>(?&PerlOWS))
|
(?&PerlVariableHash) (?>(?&PerlOWS))
)
(?: , (?>(?&PerlOWS)) | (?= \) ) ) # (
) # End of rule (?<PerlParameterDeclaration>)
(?<PerlUseStatement>
(?: use | no ) (?>(?&PerlNWS))
(?>
(?&PerlVersionNumber)
|
(?>(?&PerlQualifiedIdentifier))
(?: (?>(?&PerlNWS)) (?&PerlVersionNumber)
(?! (?>(?&PerlOWS)) (?> (?&PerlInfixBinaryOperator) | (?&PerlComma) | \? ) )
)?+
(?: (?>(?&PerlNWS)) (?&PerlPodSequence) )?+
(?: (?>(?&PerlOWS)) (?&PerlExpression) )?+
)
(?>(?&PerlOWSOrEND)) (?> ; | (?= \} | \z ))
) # End of rule (?<PerlUseStatement>)
(?<PerlReturnExpression>
return \b (?: (?>(?&PerlOWS)) (?&PerlExpression) )?+
) # End of rule (?<PerlReturnExpression>)
(?<PerlReturnStatement>
return \b (?: (?>(?&PerlOWS)) (?&PerlExpression) )?+
(?>(?&PerlOWSOrEND)) (?> ; | (?= \} | \z ))
) # End of rule (?<PerlReturnStatement>)
(?<PerlPackageDeclaration>
package
(?>(?&PerlNWS)) (?>(?&PerlQualifiedIdentifier))
(?: (?>(?&PerlNWS)) (?&PerlVersionNumber) )?+
(?>(?&PerlOWSOrEND)) (?> ; | (?&PerlBlock) | (?= \} | \z ))
) # End of rule (?<PerlPackageDeclaration>)
(?<PerlClassDeclaration>
class
(?>(?&PerlNWS)) (?>(?&PerlQualifiedIdentifier))
(?: (?>(?&PerlNWS)) (?&PerlVersionNumber)
| (?>(?&PerlOWS)) : (?>(?&PerlOWS)) isa (?= \( ) (?&PPR_quotelike_body)
)?+
(?>(?&PerlOWSOrEND)) (?> ; | (?&PerlBlock) | (?= \} | \z ))
) # End of rule (?<PerlPackageDeclaration>)
(?<PerlExpression>
(?>(?&PerlLowPrecedenceNotExpression))
(?: (?>(?&PerlOWS)) (?>(?&PerlLowPrecedenceInfixOperator))
(?>(?&PerlOWS)) (?&PerlLowPrecedenceNotExpression) )*+
) # End of rule (?<PerlExpression>)
(?<PerlLowPrecedenceNotExpression>
(?: not \b (?&PerlOWS) )*+ (?&PerlCommaList)
) # End of rule (?<PerlLowPrecedenceNotExpression>)
(?<PerlCommaList>
(?>(?&PerlAssignment)) (?>(?&PerlOWS))
(?:
(?: (?>(?&PerlComma)) (?&PerlOWS) )++
(?>(?&PerlAssignment)) (?>(?&PerlOWS))
)*+
(?: (?>(?&PerlComma)) (?&PerlOWSOrEND) )*+
) # End of rule (?<PerlCommaList>)
(?<PerlAssignment>
(?>(?&PerlConditionalExpression))
(?:
(?>(?&PerlOWS)) (?>(?&PerlAssignmentOperator))
(?>(?&PerlOWS)) (?&PerlConditionalExpression)
)*+
) # End of rule (?<PerlAssignment>)
(?<PerlScalarExpression>
(?<PerlConditionalExpression>
(?>(?&PerlBinaryExpression))
(?:
(?>(?&PerlOWS)) \? (?>(?&PerlOWS)) (?>(?&PerlAssignment))
(?>(?&PerlOWS)) : (?>(?&PerlOWS)) (?&PerlConditionalExpression)
)?+
) # End of rule (?<PerlConditionalExpression>)
) # End of rule (?<PerlScalarExpression>)
(?<PerlBinaryExpression>
(?>(?&PerlPrefixPostfixTerm))
(?: (?>(?&PerlOWS)) (?>(?&PerlInfixBinaryOperator))
(?>(?&PerlOWS)) (?&PerlPrefixPostfixTerm) )*+
) # End of rule (?<PerlBinaryExpression>)
(?<PerlPrefixPostfixTerm>
(?: (?>(?&PerlPrefixUnaryOperator)) (?&PerlOWS) )*+
(?>(?&PerlTerm))
(?: (?>(?&PerlOWS)) (?&PerlPostfixUnaryOperator) )?+
) # End of rule (?<PerlPrefixPostfixTerm>)
(?<PerlLvalue>
(?>
\\?+ [\$\@%] (?>(?&PerlOWS)) (?&PerlIdentifier)
|
\( (?>(?&PerlOWS))
(?> \\?+ [\$\@%] (?>(?&PerlOWS)) (?&PerlIdentifier) | undef ) (?>(?&PerlOWS))
(?:
(?>(?&PerlComma)) (?>(?&PerlOWS))
(?> \\?+ [\$\@%] (?>(?&PerlOWS)) (?&PerlIdentifier) | undef ) (?>(?&PerlOWS))
)*+
(?: (?>(?&PerlComma)) (?&PerlOWS) )?+
\)
)
) # End of rule (?<PerlLvalue>)
(?<PerlTerm>
(?>
# Inlined (?&PerlReturnExpression)
return \b (?: (?>(?&PerlOWS)) (?&PerlExpression) )?+
# End of inlining
# The remaining alternatives can all take postfix dereferencers...
| (?:
(?= \$ ) (?&PerlScalarAccess)
|
(?= \@ ) (?&PerlArrayAccess)
|
(?= % ) (?&PerlHashAccess)
|
(?&PerlAnonymousSubroutine)
|
(?&PerlAnonymousMethod)
|
(?>(?&PerlNullaryBuiltinFunction)) (?! (?>(?&PerlOWS)) \( )
|
# Inlined (?&PerlDoBlock) | (?&PerlEvalBlock)
(?> do | eval ) (?>(?&PerlOWS)) (?&PerlBlock)
# End of inlining
|
(?&PerlCall)
|
# Inlined (?&PerlVariableDeclaration)
(?> my | our | state ) \b (?>(?&PerlOWS))
(?: (?&PerlQualifiedIdentifier) (?&PerlOWS) )?+
(?>(?&PerlLvalue)) (?>(?&PerlOWSOrEND))
(?&PerlAttributes)?+
# End of inlining
|
(?&PerlTypeglob)
|
(?>(?&PerlParenthesesList))
# Can optionally do a [...] lookup straight after the parens,
# followed by any number of other look-ups
(?:
(?>(?&PerlOWS)) (?&PerlArrayIndexer)
(?:
(?>(?&PerlOWS))
(?>
(?&PerlArrayIndexer)
| (?&PerlHashIndexer)
| (?&PerlParenthesesList)
)
)*+
)?+
|
(?&PerlAnonymousArray)
|
(?&PerlAnonymousHash)
|
(?&PerlDiamondOperator)
|
(?&PerlContextualMatch)
|
(?&PerlQuotelikeS)
|
(?&PerlQuotelikeTR)
|
(?&PerlQuotelikeQX)
|
(?&PerlLiteral)
)
(?: (?&PerlTermPostfixDereference) )?+
)
) # End of rule (?<PerlTerm>)
(?<PerlTermPostfixDereference>
# Must have at least one arrowed dereference...
(?:
(?>(?&PerlOWS)) -> (?>(?&PerlOWS))
(?>
# A series of simple brackets can omit interstitial arrows...
(?> (?&PerlParenthesesList) | (?&PerlArrayIndexer) | (?&PerlHashIndexer) )
(?:
(?>(?&PerlOWS))
(?> (?&PerlParenthesesList) | (?&PerlArrayIndexer) | (?&PerlHashIndexer) )
)*+
| # A method call...
(?> (?&PerlQualifiedIdentifier) | (?! \$\#\* ) (?&PerlVariableScalar) )
(?: (?>(?&PerlOWS)) (?&PerlParenthesesList) )?+
| # An array or hash slice or k/v slice
# (provided it's not subsequently dereferenced)
[\@%] (?> (?>(?&PerlArrayIndexer)) | (?>(?&PerlHashIndexer)) )
(?! (?>(?&PerlOWS)) -> (?>(?&PerlOWS)) [\@%]?+ [\[\{] )
| # An array max-index lookup...
\$\#\*
| # A scalar-, glob-, or subroutine dereference...
[\$*&] \*
| # An array dereference (provided it's not subsequently dereferenced)...
\@\*
(?! (?>(?&PerlOWS)) -> (?>(?&PerlOWS)) [\[\@] )
| # A hash dereference (provided it's not subsequently dereferenced)...
\%\*
(?! (?>(?&PerlOWS)) -> (?>(?&PerlOWS)) [\{%] )
| # A glob lookup...
\* (?&PerlHashIndexer)
)
)++
) # End of rule (?<PerlTermPostfixDereference>)
(?<PerlControlBlock>
(?> # Conditionals...
(?> if | unless ) \b (?>(?&PerlOWS))
(?>(?&PerlParenthesesList)) (?>(?&PerlOWS))
(?>(?&PerlBlock))
(?:
(?>(?&PerlOWS))
(?>(?&PerlPodSequence))
elsif \b (?>(?&PerlOWS))
(?>(?&PerlParenthesesList)) (?>(?&PerlOWS))
(?&PerlBlock)
)*+
(?:
(?>(?&PerlOWS))
(?>(?&PerlPodSequence))
else \b (?>(?&PerlOWS))
(?&PerlBlock)
)?+
| # Loops...
(?>
for(?:each)?+ \b
(?>(?&PerlOWS))
(?:
(?> # Explicitly aliased iterator variable...
(?> \\ (?>(?&PerlOWS)) (?> my | our | state )
| (?> my | our | state ) (?>(?&PerlOWS)) \\
)
(?>(?&PerlOWS))
(?> (?&PerlVariableScalar)
| (?&PerlVariableArray)
| (?&PerlVariableHash)
)
|
# List of scalar iterator variables...
my (?>(?&PerlOWS))
\( (?>(?&PerlOWS))
(?>(?&PerlVariableScalar)) (?>(?&PerlOWS))
(?: , (?>(?&PerlOWS))
(?>(?&PerlVariableScalar)) (?>(?&PerlOWS))
)*+
(?: , (?>(?&PerlOWS)) )?+
\)
|
# Implicitly aliased iterator variable...
(?> (?: my | our | state ) (?>(?&PerlOWS)) )?+
(?&PerlVariableScalar)
)?+
(?>(?&PerlOWS))
(?> (?&PerlParenthesesList) | (?&PerlQuotelikeQW) )
|
(?&PPR_three_part_list)
)
|
(?> while | until) \b (?>(?&PerlOWS))
(?&PerlParenthesesList)
)
(?>(?&PerlOWS))
(?>(?&PerlBlock))
(?:
(?>(?&PerlOWS)) continue
(?>(?&PerlOWS)) (?&PerlBlock)
)?+
| # Phasers...
(?> BEGIN | END | CHECK | INIT | UNITCHECK | ADJUST ) \b (?>(?&PerlOWS))
(?&PerlBlock)
| # Try/catch/finallys...
(?>(?&PerlTryCatchFinallyBlock))
| # Defers...
defer (?>(?&PerlOWS))
(?&PerlBlock)
| # Switches...
(?> given | when ) \b (?>(?&PerlOWS))
(?>(?&PerlParenthesesList)) (?>(?&PerlOWS))
(?&PerlBlock)
|
default (?>(?&PerlOWS))
(?&PerlBlock)
)
) # End of rule (?<PerlControlBlock>)
(?<PerlFormat>
format
(?: (?>(?&PerlNWS)) (?&PerlQualifiedIdentifier) )?+
(?>(?&PerlOWS)) = [^\n]*+
(?&PPR_newline_and_heredoc)
(?:
(?! \. \n )
[^\n\$\@]*+
(?:
(?>
(?= \$ (?! \s ) ) (?&PerlScalarAccessNoSpace)
|
(?= \@ (?! \s ) ) (?&PerlArrayAccessNoSpace)
)
[^\n\$\@]*+
)*+
(?&PPR_newline_and_heredoc)
)*+
\. (?&PerlEndOfLine)
) # End of rule (?<PerlFormat>)
(?<PerlStatementModifier>
(?> if | for(?:each)?+ | while | unless | until | when )
\b
(?>(?&PerlOWS))
(?&PerlExpression)
) # End of rule (?<PerlStatementModifier>)
(?<PerlBlock>
\{ (?>(?&PerlStatementSequence)) \}
) # End of rule (?<PerlBlock>)
(?<PerlCall>
(?>
[&] (?>(?&PerlOWS))
(?> (?&PerlBlock)
| (?&PerlVariableScalar)
| (?&PerlQualifiedIdentifier)
) (?>(?&PerlOWS))
(?:
\( (?>(?&PerlOWS))
(?: (?>(?&PerlExpression)) (?&PerlOWS) )?+
\)
)?+
|
- (?>(?&PPR_filetest_name)) (?>(?&PerlOWS))
(?&PerlPrefixPostfixTerm)?+
|
(?>(?&PerlBuiltinFunction)) (?>(?&PerlOWS))
(?>
\( (?>(?&PerlOWS))
(?>
(?= (?>(?&PPR_non_reserved_identifier))
(?>(?&PerlOWS))
(?! \( | (?&PerlComma) )
)
(?&PerlCall)
|
(?>(?&PerlBlock)) (?>(?&PerlOWS))
(?&PerlExpression)?+
|
(?>(?&PPR_indirect_obj)) (?>(?&PerlNWS))
(?&PerlExpression)
|
(?&PerlExpression)?+
) (?>(?&PerlOWS))
\)
|
(?>
(?=
(?>(?&PPR_non_reserved_identifier))
(?>(?&PerlOWS))
(?! \( | (?&PerlComma) )
)
(?&PerlCall)
|
(?>(?&PerlBlock)) (?>(?&PerlOWS))
(?&PerlCommaList)?+
|
(?>(?&PPR_indirect_obj)) (?>(?&PerlNWS))
(?&PerlCommaList)
|
(?&PerlCommaList)?+
)
)
|
(?>(?&PPR_non_reserved_identifier)) (?>(?&PerlOWS))
(?>
\( (?>(?&PerlOWS))
(?: (?>(?&PerlExpression)) (?&PerlOWS) )?+
\)
|
(?>
(?=
(?>(?&PPR_non_reserved_identifier))
(?>(?&PerlOWS))
(?! \( | (?&PerlComma) )
)
(?&PerlCall)
|
(?>(?&PerlBlock)) (?>(?&PerlOWS))
(?&PerlCommaList)?+
|
(?>(?&PPR_indirect_obj)) (?&PerlNWS)
(?&PerlCommaList)
|
(?&PerlCommaList)?+
)
)
)
) # End of rule (?<PerlCall>)
(?<PerlVariableDeclaration>
(?> my | our | state ) \b (?>(?&PerlOWS))
(?: (?&PerlQualifiedIdentifier) (?&PerlOWS) )?+
(?>(?&PerlLvalue)) (?>(?&PerlOWS))
(?&PerlAttributes)?+
) # End of rule (?<PerlVariableDeclaration>)
(?<PerlFieldDeclaration>
field \b
(?>(?&PerlOWS)) [\$\@%]
(?>(?&PerlOWS)) (?&PerlIdentifier)
(?:
(?>(?&PerlOWS)) :
(?>(?&PerlOWS)) param
(?:
(?= \( ) (?&PPR_quotelike_body) # )
)?+
)?+
(?:
(?>(?&PerlOWS)) (?: //= | \|\|= | = )
(?>(?&PerlOWS)) (?&PerlConditionalExpression)
)?+
(?>(?&PerlOWSOrEND)) (?> ; | (?= \} | \z ))
) # End of rule (?<PerlFieldDeclaration>)
(?<PerlDoBlock>
do (?>(?&PerlOWS)) (?&PerlBlock)
) # End of rule (?<PerlDoBlock>)
(?<PerlEvalBlock>
eval (?>(?&PerlOWS)) (?&PerlBlock)
) # End of rule (?<PerlEvalBlock>)
(?<PerlTryCatchFinallyBlock>
try \b (?>(?&PerlOWS))
(?>(?&PerlBlock))
(?>(?&PerlOWS))
catch \b (?>(?&PerlOWS))
\( (?>(?&PerlVariableScalar)) \) (?>(?&PerlOWS))
(?>(?&PerlBlock))
(?:
(?>(?&PerlOWS))
finally \b (?>(?&PerlOWS))
(?>(?&PerlBlock))
)?+
) # End of rule (?<PerlTryCatchFinallyBlock>)
(?<PerlAttributes>
:
(?>(?&PerlOWS))
(?>(?&PerlIdentifier))
(?:
(?= \( ) (?&PPR_quotelike_body)
)?+
(?:
(?> (?>(?&PerlOWS)) : (?&PerlOWS) | (?&PerlNWS) )
(?>(?&PerlIdentifier))
(?:
(?= \( ) (?&PPR_quotelike_body)
)?+
)*+
) # End of rule (?<PerlAttributes>)
(?<PerlList>
(?> (?&PerlParenthesesList) | (?&PerlCommaList) )
) # End of rule (?<PerlList>)
(?<PerlParenthesesList>
\( (?>(?&PerlOWS)) (?: (?>(?&PerlExpression)) (?&PerlOWS) )?+ \)
) # End of rule (?<PerlParenthesesList>)
(?<PerlAnonymousArray>
\[ (?>(?&PerlOWS)) (?: (?>(?&PerlExpression)) (?&PerlOWS) )?+ \]
) # End of rule (?<PerlAnonymousArray>)
(?<PerlAnonymousHash>
\{ (?>(?&PerlOWS)) (?: (?>(?&PerlExpression)) (?&PerlOWS) )?+ \}
) # End of rule (?<PerlAnonymousHash>)
(?<PerlArrayIndexer>
\[ (?>(?&PerlOWS))
(?>(?&PerlExpression)) (?>(?&PerlOWS))
\]
) # End of rule (?<PerlArrayIndexer>)
(?<PerlHashIndexer>
\{ (?>(?&PerlOWS))
(?: -?+ (?&PerlIdentifier) | (?&PerlExpression) ) # (Note: MUST allow backtracking here)
(?>(?&PerlOWS))
\}
) # End of rule (?<PerlHashIndexer>)
(?<PerlDiamondOperator>
<<>> # Perl 5.22 "double diamond"
|
< (?! < )
(?>(?&PPR_balanced_angles))
>
(?=
(?>(?&PerlOWSOrEND))
(?> \z | [,;\}\])?] | => | : (?! :) # (
| (?&PerlInfixBinaryOperator) | (?&PerlLowPrecedenceInfixOperator)
| (?= \w) (?> for(?:each)?+ | while | if | unless | until | when )
)
)
) # End of rule (?<PerlDiamondOperator>)
(?<PerlComma>
(?> , | => )
) # End of rule (?<PerlComma>)
(?<PerlPrefixUnaryOperator>
(?> \+\+ | -- | [!\\+~] | - (?! (?&PPR_filetest_name) \b ) )
) # End of rule (?<PerlPrefixUnaryOperator>)
(?<PerlPostfixUnaryOperator>
(?> \+\+ | -- )
) # End of rule (?<PerlPostfixUnaryOperator>)
(?<PerlInfixBinaryOperator>
(?> [=!][~=]
| cmp
| <= >?+
| >=
| [lg][te]
| eq
| ne
| [+] (?! [+=] )
| - (?! [-=] )
| [.]{2,3}+
| [.%x] (?! [=] )
| [&|^][.] (?! [=] )
| [<>*&|/]{1,2}+ (?! [=] )
| \^ (?! [=] )
| ~~
| isa
)
) # End of rule (?<PerlInfixBinaryOperator>)
(?<PerlAssignmentOperator>
(?: [<>*&|/]{2}
| [-+.*/%x]
| [&|^][.]?+
)?+
=
(?! > )
) # End of rule (?<PerlAssignmentOperator>)
(?<PerlLowPrecedenceInfixOperator>
(?> or | and | xor )
) # End of rule (?<PerlLowPrecedenceInfixOperator>)
(?<PerlAnonymousSubroutine>
sub \b
(?>(?&PerlOWS))
(?:
# Perl pre 5.028
(?:
(?>
(?&PerlSignature) # Parameter list
|
\( [^)]*+ \) # Prototype (
)
(?&PerlOWS)
)?+
(?: (?>(?&PerlAttributes)) (?&PerlOWS) )?+
|
# Perl post 5.028
(?: (?>(?&PerlAttributes)) (?&PerlOWS) )?+
(?: (?>(?&PerlSignature)) (?&PerlOWS) )?+ # Parameter list
)
(?&PerlBlock)
) # End of rule (?<PerlAnonymousSubroutine>)
(?<PerlAnonymousMethod>
method \b
(?>(?&PerlOWS))
(?: (?>(?&PerlAttributes)) (?&PerlOWS) )?+
(?: (?>(?&PerlSignature)) (?&PerlOWS) )?+ # Parameter list
(?&PerlBlock)
) # End of rule (?<PerlAnonymousMethod>)
(?<PerlVariable>
(?= [\$\@%] )
(?>
(?&PerlScalarAccess)
| (?&PerlHashAccess)
| (?&PerlArrayAccess)
)
(?> (?&PerlTermPostfixDereference) )?+
) # End of rule (?<PerlVariable>)
(?<PerlTypeglob>
\*
(?>
\d++
|
\^ [][A-Z^_?\\]
|
\{ \^ [A-Z_] \w*+ \}
|
(?>(?&PerlOldQualifiedIdentifier)) (?: :: )?+
|
(?&PerlVariableScalar)
|
[][!"#\$%&'()*+,./:;<=>?\@\^`|~-]
|
(?&PerlBlock)
)
# Optional arrowless access(es) to begin (but can't start with a parens)...
(?:
(?! (?>(?&PerlOWS)) \( )
(?:
(?>(?&PerlOWS))
(?: (?&PerlArrayIndexer) | (?&PerlHashIndexer) | (?&PerlParenthesesList) )
)++
)?+
# Note: subsequent arrowed postdereferences that would follow here
# are handled at the <PerlTerm> level
) # End of rule (?<PerlTypeglob>)
(?<PerlArrayAccess>
(?>(?&PerlVariableArray))
# Optional arrowless access(es) to begin (but can't start with a parens)...
(?:
(?! (?>(?&PerlOWS)) \( )
(?:
(?>(?&PerlOWS))
(?: (?&PerlArrayIndexer) | (?&PerlHashIndexer) | (?&PerlParenthesesList) )
)++
)?+
# Note: subsequent arrowed postdereferences that would follow here
# are handled at the <PerlTerm> level
) # End of rule (?<PerlArrayAccess>)
(?<PerlArrayAccessNoSpace>
(?>(?&PerlVariableArrayNoSpace))
# Optional arrowless access(es) to begin
(?: (?&PerlArrayIndexer) | (?&PerlHashIndexer) )*+
# Then any number of optional arrowed accesses
# (this is an inlined subset of (?&PerlTermPostfixDereference))...
(?:
->
(?>
# A series of simple brackets can omit interstitial arrows...
(?: (?&PerlArrayIndexer)
| (?&PerlHashIndexer)
)++
| # An array or hash slice...
\@ (?> (?>(?&PerlArrayIndexer)) | (?>(?&PerlHashIndexer)) )
)
)*+
# Followed by at most one of these terminal arrowed dereferences...
(?:
->
(?>
# An array or scalar deref...
[\@\$] \*
| # An array count deref...
\$ \# \*
)
)?+
) # End of rule (?<PerlArrayAccessNoSpace>)
(?<PerlArrayAccessNoSpaceNoArrow>
(?>(?&PerlVariableArray))
(?:
(?: (?&PerlArrayIndexer) | (?&PerlHashIndexer) )
)*+
) # End of rule (?<PerlArrayAccessNoSpaceNoArrow>)
(?<PerlHashAccess>
(?>(?&PerlVariableHash))
# Optional arrowless access(es) to begin (but can't start with a parens)...
(?:
(?! (?>(?&PerlOWS)) \( )
(?:
(?>(?&PerlOWS))
(?: (?&PerlArrayIndexer) | (?&PerlHashIndexer) | (?&PerlParenthesesList) )
)++
)?+
) # End of rule (?<PerlHashAccess>)
(?<PerlScalarAccess>
(?>(?&PerlVariableScalar))
# Optional arrowless access(es) to begin (but can't start with a parens)...
(?:
(?! (?>(?&PerlOWS)) \( )
(?:
(?>(?&PerlOWS))
(?: (?&PerlArrayIndexer) | (?&PerlHashIndexer) | (?&PerlParenthesesList) )
)++
)?+
# Note: subsequent arrowed postdereferences that would follow here
# are handled at the <PerlTerm> level
) # End of rule (?<PerlScalarAccess>)
(?<PerlScalarAccessNoSpace>
(?>(?&PerlVariableScalarNoSpace))
# Optional arrowless access(es) to begin...
(?: (?&PerlArrayIndexer) | (?&PerlHashIndexer) )*+
# Then any nuber of arrowed accesses
# (this is an inlined subset of (?&PerlTermPostfixDereference))...
(?:
->
(?>
# A series of simple brackets can omit interstitial arrows...
(?: (?&PerlArrayIndexer)
| (?&PerlHashIndexer)
)++
| # An array or hash slice...
\@ (?> (?>(?&PerlArrayIndexer)) | (?>(?&PerlHashIndexer)) )
)
)*+
# Followed by at most one of these terminal arrowed dereferences...
(?:
->
(?>
# An array or scalar deref...
[\@\$] \*
| # An array count deref...
\$ \# \*
)
)?+
) # End of rule (?<PerlScalarAccessNoSpace>)
(?<PerlScalarAccessNoSpaceNoArrow>
(?>(?&PerlVariableScalarNoSpace))
# Optional arrowless access(es) (but parens can't be first)...
(?:
(?! \( )
(?:
(?> (?&PerlArrayIndexer) | (?&PerlHashIndexer) | (?&PerlParenthesesList) )
)++
)?+
) # End of rule (?<PerlScalarAccessNoSpaceNoArrow>)
(?<PerlVariableScalar>
\$\$
(?! [\$\{\w] )
|
(?:
\$
(?:
[#]
(?= (?> [\$^\w\{:+] | - (?! > ) ) )
)?+
(?&PerlOWS)
)++
(?>
\d++
|
\^ [][A-Z^_?\\]
|
\{ \^ [A-Z_] \w*+ \}
|
(?>(?&PerlOldQualifiedIdentifier)) (?: :: )?+
|
:: (?&PerlBlock)
|
[][!"#\$%&'()*+,.\\/:;<=>?\@\^`|~-]
|
\{ [!"#\$%&'()*+,.\\/:;<=>?\@\^`|~-] \}
|
\{ \w++ \}
|
(?&PerlBlock)
)
|
\$\#
) # End of rule (?<PerlVariableScalar>)
(?<PerlVariableScalarNoSpace>
\$\$
(?! [\$\{\w] )
|
(?:
\$
(?:
[#]
(?= (?> [\$^\w\{:+] | - (?! > ) ) )
)?+
)++
(?>
\d++
|
\^ [][A-Z^_?\\]
|
\{ \^ [A-Z_] \w*+ \}
|
(?>(?&PerlOldQualifiedIdentifier)) (?: :: )?+
|
:: (?&PerlBlock)
|
[][!"#\$%&'()*+,.\\/:;<=>?\@\^`|~-]
|
\{ \w++ \}
|
(?&PerlBlock)
)
|
\$\#
) # End of rule (?<PerlVariableScalarNoSpace>)
(?<PerlVariableArray>
\@ (?>(?&PerlOWS))
(?: \$ (?&PerlOWS) )*+
(?>
\d++
|
\^ [][A-Z^_?\\]
|
\{ \^ [A-Z_] \w*+ \}
|
(?>(?&PerlOldQualifiedIdentifier)) (?: :: )?+
|
:: (?&PerlBlock)
|
[][!"#\$%&'()*+,.\\/:;<=>?\@\^`|~-]
|
(?&PerlBlock)
)
) # End of rule (?<PerlVariableArray>)
(?<PerlVariableArrayNoSpace>
\@
(?: \$ )*+
(?>
\d++
|
\^ [][A-Z^_?\\]
|
\{ \^ [A-Z_] \w*+ \}
|
(?>(?&PerlOldQualifiedIdentifier)) (?: :: )?+
|
:: (?&PerlBlock)
|
[][!"#\$%&'()*+,.\\/:;<=>?\@\^`|~-]
|
(?&PerlBlock)
)
) # End of rule (?<PerlVariableArrayNoSpace>)
(?<PerlVariableHash>
% (?>(?&PerlOWS))
(?: \$ (?&PerlOWS) )*+
(?>
\d++
|
\^ [][A-Z^_?\\]
|
\{ \^ [A-Z_] \w*+ \}
|
(?>(?&PerlOldQualifiedIdentifier)) (?: :: )?+
|
:: (?&PerlBlock)?+
|
[][!"#\$%&'()*+,.\\/:;<=>?\@\^`|~-]
|
(?&PerlBlock)
)
) # End of rule (?<PerlVariableHash>)
(?<PerlLabel>
(?! (?> [msy] | q[wrxq]?+ | tr ) \b )
(?>(?&PerlIdentifier))
: (?! : )
) # End of rule (?<PerlLabel>)
(?<PerlLiteral>
(?> (?&PerlString)
| (?&PerlQuotelikeQR)
| (?&PerlQuotelikeQW)
| (?&PerlNumber)
| (?&PerlBareword)
)
) # End of rule (?<PerlLiteral>)
(?<PerlString>
(?>
# Inlined (?&PerlQuotelikeQ)
' [^'\\]*+ (?: \\. [^'\\]*+ )*+ '
|
q \b
(?> (?= [#] ) | (?! (?>(?&PerlOWS)) => ) )
(?&PPR_quotelike_body)
# End of inlining
|
# Inlined (?&PerlQuotelikeQQ)
" [^"\\]*+ (?: \\. [^"\\]*+ )*+ "
|
qq \b
(?> (?= [#] ) | (?! (?>(?&PerlOWS)) => ) )
(?&PPR_quotelike_body_always_interpolated)
# End of inlining
|
(?&PerlHeredoc)
|
(?&PerlVString)
)
) # End of rule (?<PerlString>)
(?<PerlQuotelike>
(?> (?&PerlString)
| (?&PerlQuotelikeQR)
| (?&PerlQuotelikeQW)
| (?&PerlQuotelikeQX)
| (?&PerlContextualMatch)
| (?&PerlQuotelikeS)
| (?&PerlQuotelikeTR)
)
) # End of rule (?<PerlQuotelike>)
(?<PerlHeredoc>
# Match the introducer...
<<
(?<_heredoc_indented> [~]?+ )
# Match the terminator specification...
(?>
\\?+ (?<_heredoc_terminator> (?&PerlIdentifier) )
|
(?>(?&PerlOWS))
(?>
" (?<_heredoc_terminator> [^"\\]*+ (?: \\. [^"\\]*+ )*+ ) " #"
|
(?<PPR_HD_nointerp> ' )
(?<_heredoc_terminator> [^'\\]*+ (?: \\. [^'\\]*+ )*+ ) ' #'
|
` (?<_heredoc_terminator> [^`\\]*+ (?: \\. [^`\\]*+ )*+ ) ` #`
)
|
(?<_heredoc_terminator> )
)
# Do we need to reset the heredoc cache???
(?{
if ( ($PPR::_heredoc_origin // q{}) ne $_ ) {
%PPR::_heredoc_skip = ();
%PPR::_heredoc_parsed_to = ();
$PPR::_heredoc_origin = $_;
}
})
# Do we need to cache content lookahead for this heredoc???
(?(?{ my $need_to_lookahead = !$PPR::_heredoc_parsed_to{+pos()};
$PPR::_heredoc_parsed_to{+pos()} = 1;
$need_to_lookahead;
})
# Lookahead to detect and remember trailing contents of heredoc
(?=
[^\n]*+ \n # Go to the end of the current line
(?{ +pos() }) # Remember the start of the contents
(??{ $PPR::_heredoc_skip{+pos()} // q{} }) # Skip earlier heredoc contents
(?> # The heredoc contents consist of...
(?:
(?!
(?(?{ $+{_heredoc_indented} }) \h*+ ) # An indent (if it was a <<~)
\g{_heredoc_terminator} # The terminator
(?: \n | \z ) # At an end-of-line
)
(?(<PPR_HD_nointerp>)
[^\n]*+ \n
|
[^\n\$\@]*+
(?:
(?>
(?{ local $PPR::_heredoc_EOL_start = $^R })
(?= \$ ) (?&PerlScalarAccess)
(?{ $PPR::_heredoc_EOL_start })
|
(?{ local $PPR::_heredoc_EOL_start = $^R })
(?= \@ ) (?&PerlArrayAccess)
(?{ $PPR::_heredoc_EOL_start })
)
[^\n\$\@]*+
)*+
\n (??{ $PPR::_heredoc_skip{+pos()} // q{} })
)
)*+
(?(?{ $+{_heredoc_indented} }) \h*+ ) # An indent (if it was a <<~)
\g{_heredoc_terminator} # The specified terminator
(?: \n | \z ) # Followed by EOL
)
# Then memoize the skip for when it's subsequently needed by PerlOWS or PerlNWS...
(?{
# Split .{N} repetition into multiple repetitions to avoid the 32766 limit...
$PPR::_heredoc_skip{$^R} = '(?s:'
. ( '.{32766}' x int((pos() - $^R) / 32766) )
. '.{' . (pos() - $^R) % 32766 . '})';
})
)
)
) # End of rule (?<PerlHeredoc>)
(?<PerlQuotelikeQ>
(?>
' [^'\\]*+ (?: \\. [^'\\]*+ )*+ '
|
\b q \b
(?> (?= [#] ) | (?! (?>(?&PerlOWS)) => ) )
(?&PPR_quotelike_body)
)
) # End of rule (?<PerlQuotelikeQ>)
(?<PerlQuotelikeQQ>
(?>
" [^"\\]*+ (?: \\. [^"\\]*+ )*+ "
|
\b qq \b
(?> (?= [#] ) | (?! (?>(?&PerlOWS)) => ) )
(?&PPR_quotelike_body_always_interpolated)
)
) # End of rule (?<PerlQuotelikeQQ>)
(?<PerlQuotelikeQW>
(?>
qw \b
(?> (?= [#] ) | (?! (?>(?&PerlOWS)) => ) )
(?&PPR_quotelike_body)
)
) # End of rule (?<PerlQuotelikeQW>)
(?<PerlQuotelikeQX>
(?>
` [^`]*+ (?: \\. [^`]*+ )*+ `
|
qx
(?>
(?= (?>(?&PerlOWS)) ' )
(?&PPR_quotelike_body)
|
\b (?> (?= [#] ) | (?! (?>(?&PerlOWS)) => ) )
(?&PPR_quotelike_body_interpolated)
)
)
) # End of rule (?<PerlQuotelikeQX>)
(?<PerlQuotelikeS>
(?<PerlSubstitution>
s \b
(?> (?= [#] ) | (?! (?>(?&PerlOWS)) => ) )
(?>
# Hashed syntax...
(?= [#] )
(?>(?&PPR_regex_body_interpolated_unclosed))
(?&PPR_quotelike_s_e_check)
(?>(?&PPR_quotelike_body_interpolated))
|
# Bracketed syntax...
(?= (?>(?&PerlOWS))
(?: [\[(<\{] # )
| (\X) (??{ exists $PPR::_QLD_CLOSE_FOR{$^N} ? '' : '(?!)' })
)
)
(?>(?&PPR_regex_body_interpolated))
(?>(?&PerlOWS))
(?&PPR_quotelike_s_e_check)
(?>(?&PPR_quotelike_body_interpolated))
|
# Single-quoted syntax...
(?= (?>(?&PerlOWS)) ' )
(?>(?&PPR_regex_body_unclosed))
(?&PPR_quotelike_s_e_check)
(?>(?&PPR_quotelike_body_interpolated))
|
# Delimited syntax...
(?>(?&PPR_regex_body_interpolated_unclosed))
(?&PPR_quotelike_s_e_check)
(?>(?&PPR_quotelike_body_interpolated))
)
[msixpodualgcern]*+
) # End of rule (?<PerlSubstitution>)
) # End of rule (?<PerlQuotelikeS>)
(?<PerlQuotelikeTR>
(?<PerlTransliteration>
(?> tr | y ) \b
(?! (?>(?&PerlOWS)) => )
(?>
# Hashed syntax...
(?= [#] )
(?>(?&PPR_quotelike_body_interpolated_unclosed))
(?&PPR_quotelike_body_interpolated)
|
# Bracketed syntax...
(?= (?>(?&PerlOWS))
(?: [\[(<\{\«] # )]
| (\X) (??{ exists $PPR::_QLD_CLOSE_FOR{$^N} ? '' : '(?!)' })
)
)
(?>(?&PPR_quotelike_body_interpolated))
(?>(?&PerlOWS))
(?&PPR_quotelike_body_interpolated)
|
# Delimited syntax...
(?>(?&PPR_quotelike_body_interpolated_unclosed))
(?&PPR_quotelike_body_interpolated)
)
[cdsr]*+
) # End of rule (?<PerlTransliteration>)
) # End of rule (?<PerlQuotelikeTR>)
(?<PerlContextualQuotelikeM>
(?<PerlContextualMatch>
(?<PerlQuotelikeM>
(?<PerlMatch>
(?>
\/\/
|
(?>
m (?= [#] )
|
m \b
(?! (?>(?&PerlOWS)) => )
|
(?= \/ [^/] )
)
(?&PPR_regex_body_interpolated)
)
[msixpodualgcn]*+
) # End of rule (?<PerlMatch>)
) # End of rule (?<PerlQuotelikeM>)
(?=
(?>(?&PerlOWS))
(?> \z | [,;\}\])?] | => | : (?! :)
| (?&PerlInfixBinaryOperator) | (?&PerlLowPrecedenceInfixOperator)
| (?= \w) (?> for(?:each)?+ | while | if | unless | until | when )
)
)
) # End of rule (?<PerlContextualMatch>)
) # End of rule (?<PerlContextualQuotelikeM>)
(?<PerlQuotelikeQR>
qr \b
(?> (?= [#] ) | (?! (?>(?&PerlOWS)) => ) )
(?>(?&PPR_regex_body_interpolated))
[msixpodualn]*+
) # End of rule (?<PerlQuotelikeQR>)
(?<PerlRegex>
(?>
(?&PerlMatch)
|
(?&PerlQuotelikeQR)
)
) # End of rule (?<PerlRegex>)
(?<PerlContextualRegex>
(?>
(?&PerlContextualMatch)
|
(?&PerlQuotelikeQR)
)
) # End of rule (?<PerlContextualRegex>)
(?<PerlBuiltinFunction>
# Optimized to match any Perl builtin name, without backtracking...
(?=[^\W\d]) # Skip if possible
(?>
s(?>e(?>t(?>(?>(?>(?>hos|ne)t|gr)en|s(?>erven|ockop))t|p(?>r(?>iority|otoent)|went|grp))|m(?>ctl|get|op)|ek(?>dir)?|lect|nd)|y(?>s(?>write|call|open|read|seek|tem)|mlink)|h(?>m(?>write|read|ctl|get)|utdown|ift)|o(?>cket(?>pair)?|rt)|p(?>li(?>ce|t)|rintf)|(?>cala|ubst)r|t(?>at|udy)|leep|rand|qrt|ay|in)
| g(?>et(?>p(?>r(?>oto(?>byn(?>umber|ame)|ent)|iority)|w(?>ent|nam|uid)|eername|grp|pid)|s(?>erv(?>by(?>name|port)|ent)|ock(?>name|opt))|host(?>by(?>addr|name)|ent)|net(?>by(?>addr|name)|ent)|gr(?>ent|gid|nam)|login|c)|mtime|lob|oto|rep)
| r(?>e(?>ad(?>lin[ek]|pipe|dir)?|(?>quir|vers|nam)e|winddir|turn|set|cv|do|f)|index|mdir|and)
| c(?>h(?>o(?>m?p|wn)|r(?>oot)?|dir|mod)|o(?>n(?>tinue|nect)|s)|lose(?>dir)?|aller|rypt)
| e(?>nd(?>(?>hos|ne)t|p(?>roto|w)|serv|gr)ent|x(?>i(?>sts|t)|ec|p)|ach|val(?>bytes)?+|of)
| l(?>o(?>c(?>al(?>time)?|k)|g)|i(?>sten|nk)|(?>sta|as)t|c(?>first)?|ength)
| u(?>n(?>(?>lin|pac)k|shift|def|tie)|c(?>first)?|mask|time)
| p(?>r(?>ototype|intf?)|ack(?>age)?|o[ps]|ipe|ush)
| d(?>bm(?>close|open)|e(?>fined|lete)|ump|ie|o)
| f(?>or(?>m(?>line|at)|k)|ileno|cntl|c|lock)
| t(?>i(?>mes?|ed?)|ell(?>dir)?|runcate)
| w(?>a(?>it(?>pid)?|ntarray|rn)|rite)
| m(?>sg(?>ctl|get|rcv|snd)|kdir|ap)
| b(?>in(?>mode|d)|less|reak)
| i(?>n(?>dex|t)|mport|octl)
| a(?>ccept|larm|tan2|bs)
| o(?>pen(?>dir)?|ct|rd)
| v(?>alues|ec)
| k(?>eys|ill)
| quotemeta
| join
| next
| hex
| _
)
\b
) # End of rule (?<PerlBuiltinFunction>)
(?<PerlNullaryBuiltinFunction>
# Optimized to match any Perl builtin name, without backtracking...
(?= [^\W\d] ) # Skip if possible
(?>
get(?:(?:(?:hos|ne)t|serv|gr)ent|p(?:(?:roto|w)ent|pid)|login)
| end(?:(?:hos|ne)t|p(?:roto|w)|serv|gr)ent
| wa(?:ntarray|it)
| times?
| fork
| _
)
\b
) # End of rule (?<PerlNullaryBuiltinFunction>)
(?<PerlVersionNumber>
(?>
(?&PerlVString)
|
(?>(?&PPR_digit_seq))
(?: \. (?&PPR_digit_seq)?+ )*+
)
) # End of rule (?<PerlVersionNumber>)
(?<PerlVString>
v (?>(?&PPR_digit_seq)) (?: \. (?&PPR_digit_seq) )*+
) # End of rule (?<PerlVString>)
(?<PerlNumber>
[+-]?+
(?>
0 (?> x (?&PPR_x_digit_seq)
| b (?&PPR_b_digit_seq)
| o? (?&PPR_o_digit_seq)
)
|
(?>
(?>(?&PPR_digit_seq))
(?: \. (?&PPR_digit_seq)?+ )?+
|
\. (?&PPR_digit_seq)
)
(?: [eE] [+-]?+ (?&PPR_digit_seq) )?+
)
) # End of rule (?<PerlNumber>)
(?<PerlOldQualifiedIdentifier>
(?> (?> :: | ' ) \w++ | [^\W\d]\w*+ ) (?: (?> :: | ' ) \w++ )*+
) # End of rule (?<PerlOldQualifiedIdentifier>)
(?<PerlQualifiedIdentifier>
(?> :: \w++ | [^\W\d]\w*+ ) (?: (?> :: | ' ) \w++ )*+
) # End of rule (?<PerlQualifiedIdentifier>)
(?<PerlIdentifier>
[^\W\d]\w*+
) # End of rule (?<PerlIdentifier>)
(?<PerlBareword>
(?! (?> (?= \w )
(?> for(?:each)?+ | while | if | unless | until | use | no
| given | when | sub | return | my | our | state
| try | catch | finally | defer
)
| (?&PPR_named_op)
| __ (?> END | DATA ) __ \b
) \b
(?! (?>(?&PerlOWS)) => )
)
(?! (?> q[qwrx]?+ | [mys] | tr ) \b
(?> (?= [#] ) | (?! (?>(?&PerlOWS)) => ) )
)
(?: :: )?+
[^\W\d]\w*+
(?: (?: :: | ' ) [^\W\d]\w*+ )*+
(?: :: )?+
(?! \( ) # )
|
:: (?! \w | \{ )
) # End of rule (?<PerlBareword>)
(?<PerlKeyword>
(?!) # None, by default, but can be overridden in a composing regex
) # End of rule (?<PerlKeyword>)
(?<PerlPodSequence>
(?>(?&PerlOWS)) (?: (?>(?&PerlPod)) (?&PerlOWS) )*+
) # End of rule (?<PerlPodSequence>)
(?<PerlPod>
^ = [^\W\d]\w*+ # A line starting with =<identifier>
.*? # Up to the first...
(?>
^ = cut \b [^\n]*+ $ # ...line starting with =cut
| # or
\z # ...EOF
)
) # End of rule (?<PerlPod>)
##### Whitespace matching (part of API) #################################
(?<PerlOWSOrEND>
(?:
\h++
|
(?&PPR_newline_and_heredoc)
|
# Inlined (?&PerlComment)
[#] [^\n]*+
# End of inlining
|
__ (?> END | DATA ) __ \b .*+ \z
)*+
) # End of rule (?<PerlOWSOrEnd>)
(?<PerlOWS>
(?:
\h++
|
(?&PPR_newline_and_heredoc)
|
# Inlined (?&PerlComment)
[#] [^\n]*+
# End of inlining
)*+
) # End of rule (?<PerlOWS>)
(?<PerlNWS>
(?:
\h++
|
(?&PPR_newline_and_heredoc)
|
# Inlined (?&PerlComment)
[#] [^\n]*+
# End of inlining
)++
) # End of rule (?<PerlNWS>)
(?<PerlComment>
[#] [^\n]*+
) # End of rule (?<PerlComment>)
(?<PerlEndOfLine>
\n
) # End of rule (?<PerlEndOfLine>)
###### Internal components (not part of API) ##########################
(?<PPR_named_op>
(?> cmp
| [lg][te]
| eq
| ne
| and
| or
| xor
)
) # End of rule (?<PPR_named_op>)
(?<PPR_non_reserved_identifier>
(?! (?>
for(?:each)?+ | while | if | unless | until | given | when | default
| sub | format | use | no | my | our | state
| try | catch | finally | defer
| (?&PPR_named_op)
| [msy] | q[wrxq]?+ | tr
| __ (?> END | DATA ) __
)
\b
)
(?>(?&PerlQualifiedIdentifier))
(?! :: )
) # End of rule (?<PPR_non_reserved_identifier>)
(?<PPR_three_part_list>
\( (?>(?&PerlOWS)) (?: (?>(?&PerlExpression)) (?&PerlOWS) )??
; (?>(?&PerlOWS)) (?: (?>(?&PerlExpression)) (?&PerlOWS) )??
; (?>(?&PerlOWS)) (?: (?>(?&PerlExpression)) (?&PerlOWS) )??
\)
) # End of rule (?<PPR_three_part_list>)
(?<PPR_indirect_obj>
(?&PerlBareword)
|
(?>(?&PerlVariableScalar))
(?! (?>(?&PerlOWS)) (?> [<\[\{] | -> ) )
) # End of rule (?<PPR_indirect_obj>)
(?<PPR_quotelike_body>
(?>(?&PPR_quotelike_body_unclosed))
\S # (Note: Don't have to test that this matches; the preceding subrule already did that)
) # End of rule (?<PPR_quotelike_body>)
(?<PPR_balanced_parens>
[^)(\\\n]*+
(?:
(?>
\\.
|
\( (?>(?&PPR_balanced_parens)) \)
|
(?&PPR_newline_and_heredoc)
)
[^)(\\\n]*+
)*+
) # End of rule (?<PPR_balanced_parens>)
(?<PPR_balanced_curlies>
[^\}\{\\\n]*+
(?:
(?>
\\.
|
\{ (?>(?&PPR_balanced_curlies)) \}
|
(?&PPR_newline_and_heredoc)
)
[^\}\{\\\n]*+
)*+
) # End of rule (?<PPR_balanced_curlies>)
(?<PPR_balanced_squares>
[^][\\\n]*+
(?:
(?>
\\.
|
\[ (?&PPR_balanced_squares) \]
|
(?&PPR_newline_and_heredoc)
)
[^][\\\n]*+
)*+
) # End of rule (?<PPR_balanced_squares>)
(?<PPR_balanced_angles>
[^><\\\n]*+
(?:
(?>
\\.
|
< (?>(?&PPR_balanced_angles)) >
|
(?&PPR_newline_and_heredoc)
)
[^><\\\n]*+
)*+
) # End of rule (?<PPR_balanced_angles>)
(?<PPR_balanced_unicode_delims>
(??{$PPR::_qld_not_special})
(?:
(?>
\\.
|
(??{$PPR::_qld_open})
(?>(?&PPR_balanced_unicode_delims))
(??{$PPR::_qld_close})
|
(?&PPR_newline_and_heredoc)
)
(??{$PPR::_qld_not_special})
)*+
) # End of rule (?<PPR_balanced_unicode_delims>)
(?<PPR_regex_body_unclosed>
(?>
[#]
[^#\\\n]*+
(?:
(?: \\. | (?&PPR_newline_and_heredoc) )
[^#\\\n]*+
)*+
(?= [#] )
|
(?>(?&PerlOWS))
(?>
\{ (?>(?&PPR_balanced_curlies)) (?= \} )
|
\[ (?>(?&PPR_balanced_squares)) (?= \] )
|
\( (?>
\?{1,2}+ (?= \{ )
(?>(?&PerlBlock))
|
(?! \?{1,2}+ \{ )
(?>(?&PPR_balanced_parens))
) (?= \) )
|
< (?>(?&PPR_balanced_angles)) (?= > )
|
(\X) (??{ exists $PPR::_QLD_CLOSE_FOR{$^N} ? '' : '(?!)' })
(?{ local $PPR::_qld_open = $^N;
local $PPR::_qld_close = $PPR::_QLD_CLOSE_FOR{$PPR::_qld_open};
local $PPR::_qld_not_special
= "[^$PPR::_qld_open$PPR::_qld_close\\\\\\n]*+";
local $PPR::_qld_not_special_or_sigil
= "[^$PPR::_qld_open$PPR::_qld_close\\\\\\n\\\$\\\@]*+";
local $PPR::_qld_not_special_in_regex_var
= "[^$PPR::_qld_open$PPR::_qld_close\\s(|)]";
})
(?>(?&PPR_balanced_unicode_delims_regex_interpolated))
(?= (??{$PPR::_qld_close}) )
|
\\
[^\\\n]*+
(
(?&PPR_newline_and_heredoc)
[^\\\n]*+
)*+
(?= \\ )
|
/
[^\\/\n]*+
(?:
(?: \\. | (?&PPR_newline_and_heredoc) )
[^\\/\n]*+
)*+
(?= / )
|
(?<PPR_qldel> \S )
(?:
\\.
|
(?&PPR_newline_and_heredoc)
|
(?! \g{PPR_qldel} ) .
)*+
(?= \g{PPR_qldel} )
)
)
) # End of rule (?<PPR_regex_body_unclosed>)
(?<PPR_quotelike_body_unclosed>
(?>
[#]
[^#\\\n]*+
(?:
(?: \\. | (?&PPR_newline_and_heredoc) )
[^#\\\n]*+
)*+
(?= [#] )
|
(?>(?&PerlOWS))
(?>
\{ (?>(?&PPR_balanced_curlies)) (?= \} )
|
\[ (?>(?&PPR_balanced_squares)) (?= \] )
|
\( (?>(?&PPR_balanced_parens)) (?= \) )
|
< (?>(?&PPR_balanced_angles)) (?= > )
|
(\X) (??{ exists $PPR::_QLD_CLOSE_FOR{$^N} ? '' : '(?!)' })
(?{ local $PPR::_qld_open = $^N;
local $PPR::_qld_close = $PPR::_QLD_CLOSE_FOR{$PPR::_qld_open};
local $PPR::_qld_not_special
= "[^$PPR::_qld_open$PPR::_qld_close\\\\\\n]*+";
local $PPR::_qld_not_special_or_sigil
= "[^$PPR::_qld_open$PPR::_qld_close\\\\\\n\\\$\\\@]*+";
local $PPR::_qld_not_special_in_regex_var
= "[^$PPR::_qld_open$PPR::_qld_close\\s(|)]";
})
(?>(?&PPR_balanced_unicode_delims))
(?= (??{$PPR::_qld_close}) )
|
\\
[^\\\n]*+
(
(?&PPR_newline_and_heredoc)
[^\\\n]*+
)*+
(?= \\ )
|
/
[^\\/\n]*+
(?:
(?: \\. | (?&PPR_newline_and_heredoc) )
[^\\/\n]*+
)*+
(?= / )
|
(?<PPR_qldel> \S )
(?:
\\.
|
(?&PPR_newline_and_heredoc)
|
(?! \g{PPR_qldel} ) .
)*+
(?= \g{PPR_qldel} )
)
)
) # End of rule (?<PPR_quotelike_body_unclosed>)
(?<PPR_quotelike_body_always_interpolated>
(?>(?&PPR_quotelike_body_always_interpolated_unclosed))
\S # (Note: Don't have to test that this matches; the preceding subrule already did that)
) # End of rule (?<PPR_quotelike_body_always_interpolated>)
(?<PPR_quotelike_body_interpolated>
(?>(?&PPR_quotelike_body_interpolated_unclosed))
\S # (Note: Don't have to test that this matches; the preceding subrule already did that)
) # End of rule (?<PPR_quotelike_body_interpolated>)
(?<PPR_regex_body_interpolated>
(?>(?&PPR_regex_body_interpolated_unclosed))
\S # (Note: Don't have to test that this matches; the preceding subrule already did that)
) # End of rule (?<PPR_regex_body_interpolated>)
(?<PPR_balanced_parens_regex_interpolated>
[^)(\\\n\$\@]*+
(?:
(?>
\\.
|
\( (?>(?&PPR_balanced_parens_regex_interpolated)) \)
|
(?&PPR_newline_and_heredoc)
|
(?= \$ (?! [\s(|)] ) ) (?&PerlScalarAccessNoSpace)
|
(?= \@ (?! [\s(|)] ) ) (?&PerlArrayAccessNoSpace)
|
[\$\@]
)
[^)(\\\n\$\@]*+
)*+
) # End of rule (?<PPR_balanced_parens_regex_interpolated>)
(?<PPR_balanced_curlies_regex_interpolated>
[^\}\{\\\n\$\@]*+
(?:
(?>
\\.
|
\{ (?>(?&PPR_balanced_curlies_regex_interpolated)) \}
|
(?&PPR_newline_and_heredoc)
|
(?= \$ (?! [\s\}(|)] ) ) (?&PerlScalarAccessNoSpace)
|
(?= \@ (?! [\s\}(|)] ) ) (?&PerlArrayAccessNoSpace)
|
[\$\@]
)
[^\}\{\\\n\$\@]*+
)*+
) # End of rule (?<PPR_balanced_curlies_regex_interpolated>)
(?<PPR_balanced_squares_regex_interpolated>
[^][\\\n\$\@]*+
(?:
(?>
\\.
|
\[ (?>(?&PPR_balanced_squares_regex_interpolated)) \]
|
(?&PPR_newline_and_heredoc)
|
(?= \$ (?! [\s\](|)] ) ) (?&PerlScalarAccessNoSpace)
|
(?= \@ (?! [\s\](|)] ) ) (?&PerlArrayAccessNoSpace)
|
[\$\@]
)
[^][\\\n\$\@]*+
)*+
) # End of rule (?<PPR_balanced_squares_regex_interpolated>)
(?<PPR_balanced_angles_regex_interpolated>
[^><\\\n\$\@]*+
(?:
(?>
\\.
|
< (?>(?&PPR_balanced_angles_regex_interpolated)) >
|
(?&PPR_newline_and_heredoc)
|
(?= \$ (?! [\s>(|)] ) ) (?&PerlScalarAccessNoSpace)
|
(?= \@ (?! [\s>(|)] ) ) (?&PerlArrayAccessNoSpace)
|
[\$\@]
)
[^><\\\n\$\@]*+
)*+
) # End of rule (?<PPR_balanced_angles_regex_interpolated>)
(?<PPR_balanced_unicode_delims_regex_interpolated>
(??{$PPR::_qld_not_special_or_sigil})
(?:
(?>
\\.
|
(??{ $PPR::_qld_open })
(?>(?&PPR_balanced_unicode_delims_regex_interpolated))
(??{ $PPR::_qld_close })
|
(?&PPR_newline_and_heredoc)
|
(?= \$ (??{ $PPR::_qld_not_special_in_regex_var }) )
(?&PerlScalarAccessNoSpace)
|
(?= \$ (??{ $PPR::_qld_not_special_in_regex_var }) )
(?&PerlArrayAccessNoSpace)
|
[\$\@]
)
(??{$PPR::_qld_not_special_or_sigil})
)*+
) # End of rule (?<PPR_balanced_unicode_delims_regex_interpolated>)
(?<PPR_balanced_parens_interpolated>
[^)(\\\n\$\@]*+
(?:
(?>
\\.
|
\( (?>(?&PPR_balanced_parens_interpolated)) \)
|
(?&PPR_newline_and_heredoc)
|
(?= \$ (?! [\s\)] ) ) (?&PerlScalarAccessNoSpace)
|
(?= \@ (?! [\s\)] ) ) (?&PerlArrayAccessNoSpace)
|
[\$\@]
)
[^)(\\\n\$\@]*+
)*+
) # End of rule (?<PPR_balanced_parens_interpolated>)
(?<PPR_balanced_curlies_interpolated>
[^\}\{\\\n\$\@]*+
(?:
(?>
\\.
|
\{ (?>(?&PPR_balanced_curlies_interpolated)) \}
|
(?&PPR_newline_and_heredoc)
|
(?= \$ (?! [\s\}] ) ) (?&PerlScalarAccessNoSpace)
|
(?= \@ (?! [\s\}] ) ) (?&PerlArrayAccessNoSpace)
|
[\$\@]
)
[^\}\{\\\n\$\@]*+
)*+
) # End of rule (?<PPR_balanced_curlies_interpolated>)
(?<PPR_balanced_squares_interpolated>
[^][\\\n\$\@]*+
(?:
(?>
\\.
|
\[ (?>(?&PPR_balanced_squares_interpolated)) \]
|
(?&PPR_newline_and_heredoc)
|
(?= \$ (?! [\s\]] ) ) (?&PerlScalarAccessNoSpace)
|
(?= \@ (?! [\s\]] ) ) (?&PerlArrayAccessNoSpace)
|
[\$\@]
)
[^][\\\n\$\@]*+
)*+
) # End of rule (?<PPR_balanced_squares_interpolated>)
(?<PPR_balanced_unicode_delims_interpolated>
(??{$PPR::_qld_not_special_or_sigil})
(?:
(?>
\\.
|
(??{$PPR::_qld_open})
(?>(?&PPR_balanced_unicode_delims_interpolated))
(??{$PPR::_qld_close})
|
(?&PPR_newline_and_heredoc)
|
(?= \$ (?! \s | (??{$PPR::_qld_close}) ) ) (?&PerlScalarAccessNoSpace)
|
(?= \@ (?! \s | (??{$PPR::_qld_close}) ) ) (?&PerlArrayAccessNoSpace)
|
[\$\@]
)
(??{$PPR::_qld_not_special_or_sigil})
)*+
) # End of rule (?<PPR_balanced_unicode_delims_interpolated>)
(?<PPR_balanced_angles_interpolated>
[^><\\\n\$\@]*+
(?:
(?>
\\.
|
< (?>(?&PPR_balanced_angles_interpolated)) >
|
(?&PPR_newline_and_heredoc)
|
(?= \$ (?! [\s>] ) ) (?&PerlScalarAccessNoSpace)
|
(?= \@ (?! [\s>] ) ) (?&PerlArrayAccessNoSpace)
|
[\$\@]
)
[^><\\\n\$\@]*+
)*+
) # End of rule (?<PPR_balanced_angles_interpolated>)
(?<PPR_regex_body_interpolated_unclosed>
# Start by working out where it actually ends (ignoring interpolations)...
(?=
(?>
[#]
[^#\\\n\$\@]*+
(?:
(?>
\\.
|
(?&PPR_newline_and_heredoc)
|
(?= \$ (?! [\s#|()] ) ) (?&PerlScalarAccessNoSpace)
|
(?= \@ (?! [\s#|()] ) ) (?&PerlArrayAccessNoSpace)
|
[\$\@]
)
[^#\\\n\$\@]*+
)*+
(?= [#] )
|
(?>(?&PerlOWS))
(?>
\{ (?>(?&PPR_balanced_curlies_regex_interpolated)) (?= \} )
|
\[ (?>(?&PPR_balanced_squares_regex_interpolated)) (?= \] )
|
\( (?>(?&PPR_balanced_parens_regex_interpolated)) (?= \) )
|
< (?>(?&PPR_balanced_angles_regex_interpolated)) (?= > )
|
(\X) (??{ exists $PPR::_QLD_CLOSE_FOR{$^N} ? '' : '(?!)' })
(?{ local $PPR::_qld_open = $^N;
local $PPR::_qld_close = $PPR::_QLD_CLOSE_FOR{$PPR::_qld_open};
local $PPR::_qld_not_special
= "[^$PPR::_qld_open$PPR::_qld_close\\\\\\n]*+";
local $PPR::_qld_not_special_or_sigil
= "[^$PPR::_qld_open$PPR::_qld_close\\\\\\n\\\$\\\@]*+";
local $PPR::_qld_not_special_in_regex_var
= "[^$PPR::_qld_open$PPR::_qld_close\\s(|)]";
})
(?>(?&PPR_balanced_unicode_delims_regex_interpolated))
(?= (??{$PPR::_qld_close}) )
|
'
[^'\n]*+
(?:
(?> (?&PPR_newline_and_heredoc))
[^'\n]*+
)*+
(?= ' )
|
\\
[^\\\n\$\@]*+
(?:
(?>
(?&PPR_newline_and_heredoc)
|
(?= \$ (?! [\s\\|()] ) ) (?&PerlScalarAccessNoSpace)
|
(?= \@ (?! [\s\\|()] ) ) (?&PerlArrayAccessNoSpace)
|
[\$\@]
)
[^\\\n\$\@]*+
)*+
(?= \\ )
|
/
[^\\/\n\$\@]*+
(?:
(?>
\\.
|
(?&PPR_newline_and_heredoc)
|
(?= \$ (?! [\s/|()] ) ) (?&PerlScalarAccessNoSpace)
|
(?= \@ (?! [\s/|()] ) ) (?&PerlArrayAccessNoSpace)
|
[\$\@]
)
[^\\/\n\$\@]*+
)*+
(?= / )
|
-
(?:
\\.
|
(?&PPR_newline_and_heredoc)
|
(?:
(?= \$ (?! [\s|()-] ) ) (?&PerlScalarAccessNoSpaceNoArrow)
|
(?= \@ (?! [\s|()-] ) ) (?&PerlArrayAccessNoSpaceNoArrow)
|
[^-]
)
)*+
(?= - )
|
(?<PPR_qldel> \S )
(?:
\\.
|
(?&PPR_newline_and_heredoc)
|
(?! \g{PPR_qldel} )
(?:
(?= \$ (?! \g{PPR_qldel} | [\s|()] ) ) (?&PerlScalarAccessNoSpace)
|
(?= \@ (?! \g{PPR_qldel} | [\s|()] ) ) (?&PerlArrayAccessNoSpace)
|
.
)
)*+
(?= \g{PPR_qldel} )
)
)
)
(?&PPR_regex_body_unclosed)
) # End of rule (?<PPR_regex_body_interpolated_unclosed>)
(?<PPR_quotelike_body_always_interpolated_unclosed>
# Start by working out where it actually ends (ignoring interpolations)...
(?=
(?>
[#]
[^#\\\n\$\@]*+
(?:
(?>
\\.
|
(?&PPR_newline_and_heredoc)
|
(?= \$ (?! [\s#] ) ) (?&PerlScalarAccessNoSpace)
|
(?= \@ (?! [\s#] ) ) (?&PerlArrayAccessNoSpace)
|
[\$\@]
)
[^#\\\n\$\@]*+
)*+
(?= [#] )
|
(?>(?&PerlOWS))
(?>
\{ (?>(?&PPR_balanced_curlies_interpolated)) (?= \} )
|
\[ (?>(?&PPR_balanced_squares_interpolated)) (?= \] )
|
\( (?>(?&PPR_balanced_parens_interpolated)) (?= \) )
|
< (?>(?&PPR_balanced_angles_interpolated)) (?= > )
|
(\X) (??{ exists $PPR::_QLD_CLOSE_FOR{$^N} ? '' : '(?!)' })
(?{ local $PPR::_qld_open = $^N;
local $PPR::_qld_close = $PPR::_QLD_CLOSE_FOR{$PPR::_qld_open};
local $PPR::_qld_not_special
= "[^$PPR::_qld_open$PPR::_qld_close\\\\\\n]*+";
local $PPR::_qld_not_special_or_sigil
= "[^$PPR::_qld_open$PPR::_qld_close\\\\\\n\\\$\\\@]*+";
local $PPR::_qld_not_special_in_regex_var
= "[^$PPR::_qld_open$PPR::_qld_close\\s(|)]";
})
(?>(?&PPR_balanced_unicode_delims_interpolated))
(?= (??{$PPR::_qld_close}) )
|
\\
[^\\\n\$\@]*+
(?:
(?>
(?&PPR_newline_and_heredoc)
|
(?= \$ (?! [\s\\] ) ) (?&PerlScalarAccessNoSpace)
|
(?= \@ (?! [\s\\] ) ) (?&PerlArrayAccessNoSpace)
|
[\$\@]
)
[^\\\n\$\@]*+
)*+
(?= \\ )
|
/
[^\\/\n\$\@]*+
(?:
(?>
\\.
|
(?&PPR_newline_and_heredoc)
|
(?= \$ (?! [\s/] ) ) (?&PerlScalarAccessNoSpace)
|
(?= \@ (?! [\s/] ) ) (?&PerlArrayAccessNoSpace)
|
[\$\@]
)
[^\\/\n\$\@]*+
)*+
(?= / )
|
-
(?:
\\.
|
(?&PPR_newline_and_heredoc)
|
(?:
(?= \$ (?! [\s-] ) ) (?&PerlScalarAccessNoSpaceNoArrow)
|
(?= \@ (?! [\s-] ) ) (?&PerlArrayAccessNoSpaceNoArrow)
|
[^-]
)
)*+
(?= - )
|
(?<PPR_qldel> \S )
(?:
\\.
|
(?&PPR_newline_and_heredoc)
|
(?! \g{PPR_qldel} )
(?:
(?= \$ (?! \g{PPR_qldel} | \s ) ) (?&PerlScalarAccessNoSpace)
|
(?= \@ (?! \g{PPR_qldel} | \s ) ) (?&PerlArrayAccessNoSpace)
|
.
)
)*+
(?= \g{PPR_qldel} )
)
)
)
(?&PPR_quotelike_body_unclosed)
) # End of rule (?<PPR_quotelike_body_always_interpolated_unclosed>)
(?<PPR_quotelike_body_interpolated_unclosed>
# Start by working out where it actually ends (ignoring interpolations)...
(?=
(?>
[#]
[^#\\\n\$\@]*+
(?:
(?>
\\.
|
(?&PPR_newline_and_heredoc)
|
(?= \$ (?! [\s#] ) ) (?&PerlScalarAccessNoSpace)
|
(?= \@ (?! [\s#] ) ) (?&PerlArrayAccessNoSpace)
|
[\$\@]
)
[^#\\\n\$\@]*+
)*+
(?= [#] )
|
(?>(?&PerlOWS))
(?>
\{ (?>(?&PPR_balanced_curlies_interpolated)) (?= \} )
|
\[ (?>(?&PPR_balanced_squares_interpolated)) (?= \] )
|
\( (?>(?&PPR_balanced_parens_interpolated)) (?= \) )
|
< (?>(?&PPR_balanced_angles_interpolated)) (?= > )
|
(\X) (??{ exists $PPR::_QLD_CLOSE_FOR{$^N} ? '' : '(?!)' })
(?{ local $PPR::_qld_open = $^N;
local $PPR::_qld_close = $PPR::_QLD_CLOSE_FOR{$PPR::_qld_open};
local $PPR::_qld_not_special
= "[^$PPR::_qld_open$PPR::_qld_close\\\\\\n]*+";
local $PPR::_qld_not_special_or_sigil
= "[^$PPR::_qld_open$PPR::_qld_close\\\\\\n\\\$\\\@]*+";
local $PPR::_qld_not_special_in_regex_var
= "[^$PPR::_qld_open$PPR::_qld_close\\s(|)]";
})
(?>(?&PPR_balanced_unicode_delims_interpolated))
(?= (??{$PPR::_qld_close}) )
|
'
[^'\n]*+
(?:
(?> (?&PPR_newline_and_heredoc))
[^'\n]*+
)*+
(?= ' )
|
\\
[^\\\n\$\@]*+
(?:
(?>
(?&PPR_newline_and_heredoc)
|
(?= \$ (?! [\s\\] ) ) (?&PerlScalarAccessNoSpace)
|
(?= \@ (?! [\s\\] ) ) (?&PerlArrayAccessNoSpace)
|
[\$\@]
)
[^\\\n\$\@]*+
)*+
(?= \\ )
|
/
[^\\/\n\$\@]*+
(?:
(?>
\\.
|
(?&PPR_newline_and_heredoc)
|
(?= \$ (?! [\s/] ) ) (?&PerlScalarAccessNoSpace)
|
(?= \@ (?! [\s/] ) ) (?&PerlArrayAccessNoSpace)
|
[\$\@]
)
[^\\/\n\$\@]*+
)*+
(?= / )
|
-
(?:
\\.
|
(?&PPR_newline_and_heredoc)
|
(?:
(?= \$ (?! [\s-] ) ) (?&PerlScalarAccessNoSpaceNoArrow)
|
(?= \@ (?! [\s-] ) ) (?&PerlArrayAccessNoSpaceNoArrow)
|
[^-]
)
)*+
(?= - )
|
(?<PPR_qldel> \S )
(?:
\\.
|
(?&PPR_newline_and_heredoc)
|
(?! \g{PPR_qldel} )
(?:
(?= \$ (?! \g{PPR_qldel} | \s ) ) (?&PerlScalarAccessNoSpace)
|
(?= \@ (?! \g{PPR_qldel} | \s ) ) (?&PerlArrayAccessNoSpace)
|
.
)
)*+
(?= \g{PPR_qldel} )
)
)
)
(?&PPR_quotelike_body_unclosed)
) # End of rule (?<PPR_quotelike_body_interpolated_unclosed>)
(?<PPR_quotelike_s_e_check>
(??{ local $PPR::_quotelike_s_end = -1; '' })
(?:
(?=
(?&PPR_quotelike_body_interpolated)
(??{ $PPR::_quotelike_s_end = +pos(); '' })
[msixpodualgcrn]*+ e [msixpodualgcern]*+
)
(?=
\S # Skip the left delimiter
(?(?{ $PPR::_quotelike_s_end >= 0 })
(?>
(??{ +pos() && +pos() < $PPR::_quotelike_s_end ? '' : '(?!)' })
(?>
(?&PerlExpression)
|
\\?+ .
)
)*+
)
)
)?+
) # End of rule (?<PPR_quotelike_s_e_check>)
(?<PPR_quotelike_s_e_check_uninterpolated>
(??{ local $PPR::_quotelike_s_end = -1; '' })
(?:
(?=
(?&PPR_quotelike_body)
(??{ $PPR::_quotelike_s_end = +pos(); '' })
[msixpodualgcrn]*+ e [msixpodualgcern]*+
)
(?=
\S # Skip the left delimiter
(?(?{ $PPR::_quotelike_s_end >= 0 })
(?>
(??{ +pos() && +pos() < $PPR::_quotelike_s_end ? '' : '(?!)' })
(?>
(?&PerlExpression)
|
\\?+ .
)
)*+
)
)
)?+
) # End of rule (?<PPR_quotelike_s_e_check_uninterpolated>)
(?<PPR_filetest_name> [ABCMORSTWXbcdefgkloprstuwxz] )
(?<PPR_digit_seq> \d++ (?: _?+ \d++ )*+ )
(?<PPR_x_digit_seq> [\da-fA-F]++ (?: _?+ [\da-fA-F]++ )*+ )
(?<PPR_o_digit_seq> [0-7]++ (?: _?+ [0-7]++ )*+ )
(?<PPR_b_digit_seq> [0-1]++ (?: _?+ [0-1]++ )*+ )
(?<PPR_newline_and_heredoc>
\n (??{ ($PPR::_heredoc_origin // q{}) eq ($_//q{}) ? ($PPR::_heredoc_skip{+pos()} // q{}) : q{} })
) # End of rule (?<PPR_newline_and_heredoc>)
)
# END OF GRAMMAR
}xms;
BEGIN {
%PPR::_QLD_CLOSE_FOR = (
# "\x{0028}" => "\x{0029}", # LEFT/RIGHT PARENTHESIS
# "\x{003C}" => "\x{003E}", # LESS-THAN/GREATER-THAN SIGN
# "\x{005B}" => "\x{005D}", # LEFT/RIGHT SQUARE BRACKET
# "\x{007B}" => "\x{007D}", # LEFT/RIGHT CURLY BRACKET
"\x{00AB}" => "\x{00BB}", # LEFT/RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
"\x{00BB}" => "\x{00AB}", # RIGHT/LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
"\x{0706}" => "\x{0707}", # SYRIAC COLON SKEWED LEFT/RIGHT
"\x{0F3A}" => "\x{0F3B}", # TIBETAN MARK GUG RTAGS GYON, TIBETAN MARK GUG RTAGS GYAS
"\x{0F3C}" => "\x{0F3D}", # TIBETAN MARK ANG KHANG GYON, TIBETAN MARK ANG KHANG GYAS
"\x{169B}" => "\x{169C}", # OGHAM FEATHER MARK, OGHAM REVERSED FEATHER MARK
"\x{2018}" => "\x{2019}", # LEFT/RIGHT SINGLE QUOTATION MARK
"\x{2019}" => "\x{2018}", # RIGHT/LEFT SINGLE QUOTATION MARK
"\x{201C}" => "\x{201D}", # LEFT/RIGHT DOUBLE QUOTATION MARK
"\x{201D}" => "\x{201C}", # RIGHT/LEFT DOUBLE QUOTATION MARK
"\x{2035}" => "\x{2032}", # REVERSED PRIME, PRIME
"\x{2036}" => "\x{2033}", # REVERSED DOUBLE PRIME, DOUBLE PRIME
"\x{2037}" => "\x{2034}", # REVERSED TRIPLE PRIME, TRIPLE PRIME
"\x{2039}" => "\x{203A}", # SINGLE LEFT/RIGHT-POINTING ANGLE QUOTATION MARK
"\x{203A}" => "\x{2039}", # SINGLE RIGHT/LEFT-POINTING ANGLE QUOTATION MARK
"\x{2045}" => "\x{2046}", # LEFT/RIGHT SQUARE BRACKET WITH QUILL
"\x{204D}" => "\x{204C}", # BLACK RIGHT/LEFTWARDS BULLET
"\x{207D}" => "\x{207E}", # SUPERSCRIPT LEFT/RIGHT PARENTHESIS
"\x{208D}" => "\x{208E}", # SUBSCRIPT LEFT/RIGHT PARENTHESIS
"\x{2192}" => "\x{2190}", # RIGHT/LEFTWARDS ARROW
"\x{219B}" => "\x{219A}", # RIGHT/LEFTWARDS ARROW WITH STROKE
"\x{219D}" => "\x{219C}", # RIGHT/LEFTWARDS WAVE ARROW
"\x{21A0}" => "\x{219E}", # RIGHT/LEFTWARDS TWO HEADED ARROW
"\x{21A3}" => "\x{21A2}", # RIGHT/LEFTWARDS ARROW WITH TAIL
"\x{21A6}" => "\x{21A4}", # RIGHT/LEFTWARDS ARROW FROM BAR
"\x{21AA}" => "\x{21A9}", # RIGHT/LEFTWARDS ARROW WITH HOOK
"\x{21AC}" => "\x{21AB}", # RIGHT/LEFTWARDS ARROW WITH LOOP
"\x{21B1}" => "\x{21B0}", # UPWARDS ARROW WITH TIP RIGHT/LEFTWARDS
"\x{21B3}" => "\x{21B2}", # DOWNWARDS ARROW WITH TIP RIGHT/LEFTWARDS
"\x{21C0}" => "\x{21BC}", # RIGHT/LEFTWARDS HARPOON WITH BARB UPWARDS
"\x{21C1}" => "\x{21BD}", # RIGHT/LEFTWARDS HARPOON WITH BARB DOWNWARDS
"\x{21C9}" => "\x{21C7}", # RIGHT/LEFTWARDS PAIRED ARROWS
"\x{21CF}" => "\x{21CD}", # RIGHT/LEFTWARDS DOUBLE ARROW WITH STROKE
"\x{21D2}" => "\x{21D0}", # RIGHT/LEFTWARDS DOUBLE ARROW
"\x{21DB}" => "\x{21DA}", # RIGHT/LEFTWARDS TRIPLE ARROW
"\x{21DD}" => "\x{21DC}", # RIGHT/LEFTWARDS SQUIGGLE ARROW
"\x{21E2}" => "\x{21E0}", # RIGHT/LEFTWARDS DASHED ARROW
"\x{21E5}" => "\x{21E4}", # RIGHT/LEFTWARDS ARROW TO BAR
"\x{21E8}" => "\x{21E6}", # RIGHT/LEFTWARDS WHITE ARROW
"\x{21F4}" => "\x{2B30}", # RIGHT/LEFT ARROW WITH SMALL CIRCLE
"\x{21F6}" => "\x{2B31}", # THREE RIGHT/LEFTWARDS ARROWS
"\x{21F8}" => "\x{21F7}", # RIGHT/LEFTWARDS ARROW WITH VERTICAL STROKE
"\x{21FB}" => "\x{21FA}", # RIGHT/LEFTWARDS ARROW WITH DOUBLE VERTICAL STROKE
"\x{21FE}" => "\x{21FD}", # RIGHT/LEFTWARDS OPEN-HEADED ARROW
"\x{2208}" => "\x{220B}", # ELEMENT OF, CONTAINS AS MEMBER
"\x{2209}" => "\x{220C}", # NOT AN ELEMENT OF, DOES NOT CONTAIN AS MEMBER
"\x{220A}" => "\x{220D}", # SMALL ELEMENT OF, SMALL CONTAINS AS MEMBER
"\x{2264}" => "\x{2265}", # LESS-THAN/GREATER-THAN OR EQUAL TO
"\x{2266}" => "\x{2267}", # LESS-THAN/GREATER-THAN OVER EQUAL TO
"\x{2268}" => "\x{2269}", # LESS-THAN/GREATER-THAN BUT NOT EQUAL TO
"\x{226A}" => "\x{226B}", # MUCH LESS-THAN/GREATER-THAN
"\x{226E}" => "\x{226F}", # NOT LESS-THAN/GREATER-THAN
"\x{2270}" => "\x{2271}", # NEITHER LESS-THAN/GREATER-THAN NOR EQUAL TO
"\x{2272}" => "\x{2273}", # LESS-THAN/GREATER-THAN OR EQUIVALENT TO
"\x{2274}" => "\x{2275}", # NEITHER LESS-THAN/GREATER-THAN NOR EQUIVALENT TO
"\x{227A}" => "\x{227B}", # PRECEDES/SUCCEEDS
"\x{227C}" => "\x{227D}", # PRECEDES/SUCCEEDS OR EQUAL TO
"\x{227E}" => "\x{227F}", # PRECEDES/SUCCEEDS OR EQUIVALENT TO
"\x{2280}" => "\x{2281}", # DOES NOT PRECEDE/SUCCEED
"\x{2282}" => "\x{2283}", # SUBSET/SUPERSET OF
"\x{2284}" => "\x{2285}", # NOT A SUBSET/SUPERSET OF
"\x{2286}" => "\x{2287}", # SUBSET/SUPERSET OF OR EQUAL TO
"\x{2288}" => "\x{2289}", # NEITHER A SUBSET/SUPERSET OF NOR EQUAL TO
"\x{228A}" => "\x{228B}", # SUBSET/SUPERSET OF WITH NOT EQUAL TO
"\x{22A3}" => "\x{22A2}", # LEFT/RIGHT TACK
"\x{22A6}" => "\x{2ADE}", # ASSERTION, SHORT LEFT TACK
"\x{22A8}" => "\x{2AE4}", # TRUE, VERTICAL BAR DOUBLE LEFT TURNSTILE
"\x{22A9}" => "\x{2AE3}", # FORCES, DOUBLE VERTICAL BAR LEFT TURNSTILE
"\x{22B0}" => "\x{22B1}", # PRECEDES/SUCCEEDS UNDER RELATION
"\x{22D0}" => "\x{22D1}", # DOUBLE SUBSET/SUPERSET
"\x{22D6}" => "\x{22D7}", # LESS-THAN/GREATER-THAN WITH DOT
"\x{22D8}" => "\x{22D9}", # VERY MUCH LESS-THAN/GREATER-THAN
"\x{22DC}" => "\x{22DD}", # EQUAL TO OR LESS-THAN/GREATER-THAN
"\x{22DE}" => "\x{22DF}", # EQUAL TO OR PRECEDES/SUCCEEDS
"\x{22E0}" => "\x{22E1}", # DOES NOT PRECEDE/SUCCEED OR EQUAL
"\x{22E6}" => "\x{22E7}", # LESS-THAN/GREATER-THAN BUT NOT EQUIVALENT TO
"\x{22E8}" => "\x{22E9}", # PRECEDES/SUCCEEDS BUT NOT EQUIVALENT TO
"\x{22F2}" => "\x{22FA}", # ELEMENT OF/CONTAINS WITH LONG HORIZONTAL STROKE
"\x{22F3}" => "\x{22FB}", # ELEMENT OF/CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE
"\x{22F4}" => "\x{22FC}", # SMALL ELEMENT OF/CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE
"\x{22F6}" => "\x{22FD}", # ELEMENT OF/CONTAINS WITH OVERBAR
"\x{22F7}" => "\x{22FE}", # SMALL ELEMENT OF/CONTAINS WITH OVERBAR
"\x{2308}" => "\x{2309}", # LEFT/RIGHT CEILING
"\x{230A}" => "\x{230B}", # LEFT/RIGHT FLOOR
"\x{2326}" => "\x{232B}", # ERASE TO THE RIGHT/LEFT
"\x{2329}" => "\x{232A}", # LEFT/RIGHT-POINTING ANGLE BRACKET
"\x{2348}" => "\x{2347}", # APL FUNCTIONAL SYMBOL QUAD RIGHT/LEFTWARDS ARROW
"\x{23E9}" => "\x{23EA}", # BLACK RIGHT/LEFT-POINTING DOUBLE TRIANGLE
"\x{23ED}" => "\x{23EE}", # BLACK RIGHT/LEFT-POINTING DOUBLE TRIANGLE WITH VERTICAL BAR
"\x{261B}" => "\x{261A}", # BLACK RIGHT/LEFT POINTING INDEX
"\x{261E}" => "\x{261C}", # WHITE RIGHT/LEFT POINTING INDEX
"\x{269E}" => "\x{269F}", # THREE LINES CONVERGING RIGHT/LEFT
"\x{2768}" => "\x{2769}", # MEDIUM LEFT/RIGHT PARENTHESIS ORNAMENT
"\x{276A}" => "\x{276B}", # MEDIUM FLATTENED LEFT/RIGHT PARENTHESIS ORNAMENT
"\x{276C}" => "\x{276D}", # MEDIUM LEFT/RIGHT-POINTING ANGLE BRACKET ORNAMENT
"\x{276E}" => "\x{276F}", # HEAVY LEFT/RIGHT-POINTING ANGLE QUOTATION MARK ORNAMENT
"\x{2770}" => "\x{2771}", # HEAVY LEFT/RIGHT-POINTING ANGLE BRACKET ORNAMENT
"\x{2772}" => "\x{2773}", # LIGHT LEFT/RIGHT TORTOISE SHELL BRACKET ORNAMENT
"\x{2774}" => "\x{2775}", # MEDIUM LEFT/RIGHT CURLY BRACKET ORNAMENT
"\x{27C3}" => "\x{27C4}", # OPEN SUBSET/SUPERSET
"\x{27C5}" => "\x{27C6}", # LEFT/RIGHT S-SHAPED BAG DELIMITER
"\x{27C8}" => "\x{27C9}", # REVERSE SOLIDUS PRECEDING SUBSET, SUPERSET PRECEDING SOLIDUS
"\x{27DE}" => "\x{27DD}", # LONG LEFT/RIGHT TACK
"\x{27E6}" => "\x{27E7}", # MATHEMATICAL LEFT/RIGHT WHITE SQUARE BRACKET
"\x{27E8}" => "\x{27E9}", # MATHEMATICAL LEFT/RIGHT ANGLE BRACKET
"\x{27EA}" => "\x{27EB}", # MATHEMATICAL LEFT/RIGHT DOUBLE ANGLE BRACKET
"\x{27EC}" => "\x{27ED}", # MATHEMATICAL LEFT/RIGHT WHITE TORTOISE SHELL BRACKET
"\x{27EE}" => "\x{27EF}", # MATHEMATICAL LEFT/RIGHT FLATTENED PARENTHESIS
"\x{27F4}" => "\x{2B32}", # RIGHT/LEFT ARROW WITH CIRCLED PLUS
"\x{27F6}" => "\x{27F5}", # LONG RIGHT/LEFTWARDS ARROW
"\x{27F9}" => "\x{27F8}", # LONG RIGHT/LEFTWARDS DOUBLE ARROW
"\x{27FC}" => "\x{27FB}", # LONG RIGHT/LEFTWARDS ARROW FROM BAR
"\x{27FE}" => "\x{27FD}", # LONG RIGHT/LEFTWARDS DOUBLE ARROW FROM BAR
"\x{27FF}" => "\x{2B33}", # LONG RIGHT/LEFTWARDS SQUIGGLE ARROW
"\x{2900}" => "\x{2B34}", # RIGHT/LEFTWARDS TWO-HEADED ARROW WITH VERTICAL STROKE
"\x{2901}" => "\x{2B35}", # RIGHT/LEFTWARDS TWO-HEADED ARROW WITH DOUBLE VERTICAL STROKE
"\x{2903}" => "\x{2902}", # RIGHT/LEFTWARDS DOUBLE ARROW WITH VERTICAL STROKE
"\x{2905}" => "\x{2B36}", # RIGHT/LEFTWARDS TWO-HEADED ARROW FROM BAR
"\x{2907}" => "\x{2906}", # RIGHT/LEFTWARDS DOUBLE ARROW FROM BAR
"\x{290D}" => "\x{290C}", # RIGHT/LEFTWARDS DOUBLE DASH ARROW
"\x{290F}" => "\x{290E}", # RIGHT/LEFTWARDS TRIPLE DASH ARROW
"\x{2910}" => "\x{2B37}", # RIGHT/LEFTWARDS TWO-HEADED TRIPLE DASH ARROW
"\x{2911}" => "\x{2B38}", # RIGHT/LEFTWARDS ARROW WITH DOTTED STEM
"\x{2914}" => "\x{2B39}", # RIGHT/LEFTWARDS ARROW WITH TAIL WITH VERTICAL STROKE
"\x{2915}" => "\x{2B3A}", # RIGHT/LEFTWARDS ARROW WITH TAIL WITH DOUBLE VERTICAL STROKE
"\x{2916}" => "\x{2B3B}", # RIGHT/LEFTWARDS TWO-HEADED ARROW WITH TAIL
"\x{2917}" => "\x{2B3C}", # RIGHT/LEFTWARDS TWO-HEADED ARROW WITH TAIL WITH VERTICAL STROKE
"\x{2918}" => "\x{2B3D}", # RIGHT/LEFTWARDS TWO-HEADED ARROW WITH TAIL WITH DOUBLE VERTICAL STROKE
"\x{291A}" => "\x{2919}", # RIGHT/LEFTWARDS ARROW-TAIL
"\x{291C}" => "\x{291B}", # RIGHT/LEFTWARDS DOUBLE ARROW-TAIL
"\x{291E}" => "\x{291D}", # RIGHT/LEFTWARDS ARROW TO BLACK DIAMOND
"\x{2920}" => "\x{291F}", # RIGHT/LEFTWARDS ARROW FROM BAR TO BLACK DIAMOND
"\x{2933}" => "\x{2B3F}", # WAVE ARROW POINTING DIRECTLY RIGHT/LEFT
"\x{2937}" => "\x{2936}", # ARROW POINTING DOWNWARDS THEN CURVING RIGHT/LEFTWARDS
"\x{2945}" => "\x{2946}", # RIGHT/LEFTWARDS ARROW WITH PLUS BELOW
"\x{2947}" => "\x{2B3E}", # RIGHT/LEFTWARDS ARROW THROUGH X
"\x{2953}" => "\x{2952}", # RIGHT/LEFTWARDS HARPOON WITH BARB UP TO BAR
"\x{2957}" => "\x{2956}", # RIGHT/LEFTWARDS HARPOON WITH BARB DOWN TO BAR
"\x{295B}" => "\x{295A}", # RIGHT/LEFTWARDS HARPOON WITH BARB UP FROM BAR
"\x{295F}" => "\x{295E}", # RIGHT/LEFTWARDS HARPOON WITH BARB DOWN FROM BAR
"\x{2964}" => "\x{2962}", # RIGHT/LEFTWARDS HARPOON WITH BARB UP ABOVE RIGHT/LEFTWARDS HARPOON WITH BARB DOWN
"\x{296C}" => "\x{296A}", # RIGHT/LEFTWARDS HARPOON WITH BARB UP ABOVE LONG DASH
"\x{296D}" => "\x{296B}", # RIGHT/LEFTWARDS HARPOON WITH BARB DOWN BELOW LONG DASH
"\x{2971}" => "\x{2B40}", # EQUALS SIGN ABOVE RIGHT/LEFTWARDS ARROW
"\x{2972}" => "\x{2B41}", # TILDE OPERATOR ABOVE RIGHTWARDS ARROW, REVERSE TILDE OPERATOR ABOVE LEFTWARDS ARROW
"\x{2974}" => "\x{2B4B}", # RIGHTWARDS ARROW ABOVE TILDE OPERATOR, LEFTWARDS ARROW ABOVE REVERSE TILDE OPERATOR
"\x{2975}" => "\x{2B42}", # RIGHTWARDS ARROW ABOVE ALMOST EQUAL TO, LEFTWARDS ARROW ABOVE REVERSE ALMOST EQUAL TO
"\x{2979}" => "\x{297B}", # SUBSET/SUPERSET ABOVE RIGHT/LEFTWARDS ARROW
"\x{2983}" => "\x{2984}", # LEFT/RIGHT WHITE CURLY BRACKET
"\x{2985}" => "\x{2986}", # LEFT/RIGHT WHITE PARENTHESIS
"\x{2987}" => "\x{2988}", # Z NOTATION LEFT/RIGHT IMAGE BRACKET
"\x{2989}" => "\x{298A}", # Z NOTATION LEFT/RIGHT BINDING BRACKET
"\x{298B}" => "\x{298C}", # LEFT/RIGHT SQUARE BRACKET WITH UNDERBAR
"\x{298D}" => "\x{2990}", # LEFT/RIGHT SQUARE BRACKET WITH TICK IN TOP CORNER
"\x{298F}" => "\x{298E}", # LEFT/RIGHT SQUARE BRACKET WITH TICK IN BOTTOM CORNER
"\x{2991}" => "\x{2992}", # LEFT/RIGHT ANGLE BRACKET WITH DOT
"\x{2993}" => "\x{2994}", # LEFT/RIGHT ARC LESS-THAN/GREATER-THAN BRACKET
"\x{2995}" => "\x{2996}", # DOUBLE LEFT/RIGHT ARC GREATER-THAN/LESS-THAN BRACKET
"\x{2997}" => "\x{2998}", # LEFT/RIGHT BLACK TORTOISE SHELL BRACKET
"\x{29A8}" => "\x{29A9}", # MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING UP AND RIGHT/LEFT
"\x{29AA}" => "\x{29AB}", # MEASURED ANGLE WITH OPEN ARM ENDING IN ARROW POINTING DOWN AND RIGHT/LEFT
"\x{29B3}" => "\x{29B4}", # EMPTY SET WITH RIGHT/LEFT ARROW ABOVE
"\x{29C0}" => "\x{29C1}", # CIRCLED LESS-THAN/GREATER-THAN
"\x{29D8}" => "\x{29D9}", # LEFT/RIGHT WIGGLY FENCE
"\x{29DA}" => "\x{29DB}", # LEFT/RIGHT DOUBLE WIGGLY FENCE
"\x{29FC}" => "\x{29FD}", # LEFT/RIGHT-POINTING CURVED ANGLE BRACKET
"\x{2A79}" => "\x{2A7A}", # LESS-THAN/GREATER-THAN WITH CIRCLE INSIDE
"\x{2A7B}" => "\x{2A7C}", # LESS-THAN/GREATER-THAN WITH QUESTION MARK ABOVE
"\x{2A7D}" => "\x{2A7E}", # LESS-THAN/GREATER-THAN OR SLANTED EQUAL TO
"\x{2A7F}" => "\x{2A80}", # LESS-THAN/GREATER-THAN OR SLANTED EQUAL TO WITH DOT INSIDE
"\x{2A81}" => "\x{2A82}", # LESS-THAN/GREATER-THAN OR SLANTED EQUAL TO WITH DOT ABOVE
"\x{2A83}" => "\x{2A84}", # LESS-THAN/GREATER-THAN OR SLANTED EQUAL TO WITH DOT ABOVE RIGHT/LEFT
"\x{2A85}" => "\x{2A86}", # LESS-THAN/GREATER-THAN OR APPROXIMATE
"\x{2A87}" => "\x{2A88}", # LESS-THAN/GREATER-THAN AND SINGLE-LINE NOT EQUAL TO
"\x{2A89}" => "\x{2A8A}", # LESS-THAN/GREATER-THAN AND NOT APPROXIMATE
"\x{2A8D}" => "\x{2A8E}", # LESS-THAN/GREATER-THAN ABOVE SIMILAR OR EQUAL
"\x{2A95}" => "\x{2A96}", # SLANTED EQUAL TO OR LESS-THAN/GREATER-THAN
"\x{2A97}" => "\x{2A98}", # SLANTED EQUAL TO OR LESS-THAN/GREATER-THAN WITH DOT INSIDE
"\x{2A99}" => "\x{2A9A}", # DOUBLE-LINE EQUAL TO OR LESS-THAN/GREATER-THAN
"\x{2A9B}" => "\x{2A9C}", # DOUBLE-LINE SLANTED EQUAL TO OR LESS-THAN/ GREATER-THAN
"\x{2A9D}" => "\x{2A9E}", # SIMILAR OR LESS-THAN/GREATER-THAN
"\x{2A9F}" => "\x{2AA0}", # SIMILAR ABOVE LESS-THAN/GREATER-THAN ABOVE EQUALS SIGN
"\x{2AA1}" => "\x{2AA2}", # DOUBLE NESTED LESS-THAN/GREATER-THAN
"\x{2AA6}" => "\x{2AA7}", # LESS-THAN/GREATER-THAN CLOSED BY CURVE
"\x{2AA8}" => "\x{2AA9}", # LESS-THAN/GREATER-THAN CLOSED BY CURVE ABOVE SLANTED EQUAL
"\x{2AAA}" => "\x{2AAB}", # SMALLER THAN/LARGER THAN
"\x{2AAC}" => "\x{2AAD}", # SMALLER THAN/LARGER THAN OR EQUAL TO
"\x{2AAF}" => "\x{2AB0}", # PRECEDES/SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN
"\x{2AB1}" => "\x{2AB2}", # PRECEDES/SUCCEEDS ABOVE SINGLE-LINE NOT EQUAL TO
"\x{2AB3}" => "\x{2AB4}", # PRECEDES/SUCCEEDS ABOVE EQUALS SIGN
"\x{2AB5}" => "\x{2AB6}", # PRECEDES/SUCCEEDS ABOVE NOT EQUAL TO
"\x{2AB7}" => "\x{2AB8}", # PRECEDES/SUCCEEDS ABOVE ALMOST EQUAL TO
"\x{2AB9}" => "\x{2ABA}", # PRECEDES/SUCCEEDS ABOVE NOT ALMOST EQUAL TO
"\x{2ABB}" => "\x{2ABC}", # DOUBLE PRECEDES/SUCCEEDS
"\x{2ABD}" => "\x{2ABE}", # SUBSET/SUPERSET WITH DOT
"\x{2ABF}" => "\x{2AC0}", # SUBSET/SUPERSET WITH PLUS SIGN BELOW
"\x{2AC1}" => "\x{2AC2}", # SUBSET/SUPERSET WITH MULTIPLICATION SIGN BELOW
"\x{2AC3}" => "\x{2AC4}", # SUBSET/SUPERSET OF OR EQUAL TO WITH DOT ABOVE
"\x{2AC5}" => "\x{2AC6}", # SUBSET/SUPERSET OF ABOVE EQUALS SIGN
"\x{2AC7}" => "\x{2AC8}", # SUBSET/SUPERSET OF ABOVE TILDE OPERATOR
"\x{2AC9}" => "\x{2ACA}", # SUBSET/SUPERSET OF ABOVE ALMOST EQUAL TO
"\x{2ACB}" => "\x{2ACC}", # SUBSET/SUPERSET OF ABOVE NOT EQUAL TO
"\x{2ACF}" => "\x{2AD0}", # CLOSED SUBSET/SUPERSET
"\x{2AD1}" => "\x{2AD2}", # CLOSED SUBSET/SUPERSET OR EQUAL TO
"\x{2AD5}" => "\x{2AD6}", # SUBSET/SUPERSET ABOVE SUBSET/SUPERSET
"\x{2AE5}" => "\x{22AB}", # DOUBLE VERTICAL BAR DOUBLE LEFT/RIGHT TURNSTILE
"\x{2AF7}" => "\x{2AF8}", # TRIPLE NESTED LESS-THAN/GREATER-THAN
"\x{2AF9}" => "\x{2AFA}", # DOUBLE-LINE SLANTED LESS-THAN/GREATER-THAN OR EQUAL TO
"\x{2B46}" => "\x{2B45}", # RIGHT/LEFTWARDS QUADRUPLE ARROW
"\x{2B47}" => "\x{2B49}", # REVERSE TILDE OPERATOR ABOVE RIGHTWARDS ARROW, TILDE OPERATOR ABOVE LEFTWARDS ARROW
"\x{2B48}" => "\x{2B4A}", # RIGHTWARDS ARROW ABOVE REVERSE ALMOST EQUAL TO, LEFTWARDS ARROW ABOVE ALMOST EQUAL TO
"\x{2B4C}" => "\x{2973}", # RIGHTWARDS ARROW ABOVE REVERSE TILDE OPERATOR, LEFTWARDS ARROW ABOVE TILDE OPERATOR
"\x{2B62}" => "\x{2B60}", # RIGHT/LEFTWARDS TRIANGLE-HEADED ARROW
"\x{2B6C}" => "\x{2B6A}", # RIGHT/LEFTWARDS TRIANGLE-HEADED DASHED ARROW
"\x{2B72}" => "\x{2B70}", # RIGHT/LEFTWARDS TRIANGLE-HEADED ARROW TO BAR
"\x{2B7C}" => "\x{2B7A}", # RIGHT/LEFTWARDS TRIANGLE-HEADED ARROW WITH DOUBLE VERTICAL STROKE
"\x{2B86}" => "\x{2B84}", # RIGHT/LEFTWARDS TRIANGLE-HEADED PAIRED ARROWS
"\x{2B8A}" => "\x{2B88}", # RIGHT/LEFTWARDS BLACK CIRCLED WHITE ARROW
"\x{2B95}" => "\x{2B05}", # RIGHT/LEFTWARDS BLACK ARROW
"\x{2B9A}" => "\x{2B98}", # THREE-D TOP-LIGHTED RIGHT/LEFTWARDS EQUILATERAL ARROWHEAD
"\x{2B9E}" => "\x{2B9C}", # BLACK RIGHT/LEFTWARDS EQUILATERAL ARROWHEAD
"\x{2BA1}" => "\x{2BA0}", # DOWNWARDS TRIANGLE-HEADED ARROW WITH LONG TIP RIGHT/LEFTWARDS
"\x{2BA3}" => "\x{2BA2}", # UPWARDS TRIANGLE-HEADED ARROW WITH LONG TIP RIGHT/LEFTWARDS
"\x{2BA9}" => "\x{2BA8}", # BLACK CURVED DOWNWARDS AND RIGHT/LEFTWARDS ARROW
"\x{2BAB}" => "\x{2BAA}", # BLACK CURVED UPWARDS AND RIGHT/LEFTWARDS ARROW
"\x{2BB1}" => "\x{2BB0}", # RIBBON ARROW DOWN RIGHT/LEFT
"\x{2BB3}" => "\x{2BB2}", # RIBBON ARROW UP RIGHT/LEFT
"\x{2BEE}" => "\x{2BEC}", # RIGHT/LEFTWARDS TWO-HEADED ARROW WITH TRIANGLE ARROWHEADS
"\x{2E02}" => "\x{2E03}", # LEFT/RIGHT SUBSTITUTION BRACKET
"\x{2E03}" => "\x{2E02}", # RIGHT/LEFT SUBSTITUTION BRACKET
"\x{2E04}" => "\x{2E05}", # LEFT/RIGHT DOTTED SUBSTITUTION BRACKET
"\x{2E05}" => "\x{2E04}", # RIGHT/LEFT DOTTED SUBSTITUTION BRACKET
"\x{2E09}" => "\x{2E0A}", # LEFT/RIGHT TRANSPOSITION BRACKET
"\x{2E0A}" => "\x{2E09}", # RIGHT/LEFT TRANSPOSITION BRACKET
"\x{2E0C}" => "\x{2E0D}", # LEFT/RIGHT RAISED OMISSION BRACKET
"\x{2E0D}" => "\x{2E0C}", # RIGHT/LEFT RAISED OMISSION BRACKET
"\x{2E11}" => "\x{2E10}", # REVERSED FORKED PARAGRAPHOS, FORKED PARAGRAPHOS
"\x{2E1C}" => "\x{2E1D}", # LEFT/RIGHT LOW PARAPHRASE BRACKET
"\x{2E1D}" => "\x{2E1C}", # RIGHT/LEFT LOW PARAPHRASE BRACKET
"\x{2E20}" => "\x{2E21}", # LEFT/RIGHT VERTICAL BAR WITH QUILL
"\x{2E21}" => "\x{2E20}", # RIGHT/LEFT VERTICAL BAR WITH QUILL
"\x{2E22}" => "\x{2E23}", # TOP LEFT/RIGHT HALF BRACKET
"\x{2E24}" => "\x{2E25}", # BOTTOM LEFT/RIGHT HALF BRACKET
"\x{2E26}" => "\x{2E27}", # LEFT/RIGHT SIDEWAYS U BRACKET
"\x{2E28}" => "\x{2E29}", # LEFT/RIGHT DOUBLE PARENTHESIS
"\x{2E36}" => "\x{2E37}", # DAGGER WITH LEFT/RIGHT GUARD
"\x{2E42}" => "\x{201E}", # DOUBLE LOW-REVERSED-9 QUOTATION MARK, DOUBLE LOW-9 QUOTATION MARK
"\x{2E55}" => "\x{2E56}", # LEFT/RIGHT SQUARE BRACKET WITH STROKE
"\x{2E57}" => "\x{2E58}", # LEFT/RIGHT SQUARE BRACKET WITH DOUBLE STROKE
"\x{2E59}" => "\x{2E5A}", # TOP HALF LEFT/RIGHT PARENTHESIS
"\x{2E5B}" => "\x{2E5C}", # BOTTOM HALF LEFT/RIGHT PARENTHESIS
"\x{3008}" => "\x{3009}", # LEFT/RIGHT ANGLE BRACKET
"\x{300A}" => "\x{300B}", # LEFT/RIGHT DOUBLE ANGLE BRACKET
"\x{300C}" => "\x{300D}", # LEFT/RIGHT CORNER BRACKET
"\x{300E}" => "\x{300F}", # LEFT/RIGHT WHITE CORNER BRACKET
"\x{3010}" => "\x{3011}", # LEFT/RIGHT BLACK LENTICULAR BRACKET
"\x{3014}" => "\x{3015}", # LEFT/RIGHT TORTOISE SHELL BRACKET
"\x{3016}" => "\x{3017}", # LEFT/RIGHT WHITE LENTICULAR BRACKET
"\x{3018}" => "\x{3019}", # LEFT/RIGHT WHITE TORTOISE SHELL BRACKET
"\x{301A}" => "\x{301B}", # LEFT/RIGHT WHITE SQUARE BRACKET
"\x{301D}" => "\x{301E}", # REVERSED DOUBLE PRIME QUOTATION MARK, DOUBLE PRIME QUOTATION MARK
"\x{A9C1}" => "\x{A9C2}", # JAVANESE LEFT/RIGHT RERENGGAN
"\x{FD3E}" => "\x{FD3F}", # ORNATE LEFT/RIGHT PARENTHESIS
"\x{FE59}" => "\x{FE5A}", # SMALL LEFT/RIGHT PARENTHESIS
"\x{FE5B}" => "\x{FE5C}", # SMALL LEFT/RIGHT CURLY BRACKET
"\x{FE5D}" => "\x{FE5E}", # SMALL LEFT/RIGHT TORTOISE SHELL BRACKET
"\x{FE64}" => "\x{FE65}", # SMALL LESS-THAN/GREATER-THAN SIGN
"\x{FF08}" => "\x{FF09}", # FULLWIDTH LEFT/RIGHT PARENTHESIS
"\x{FF1C}" => "\x{FF1E}", # FULLWIDTH LESS-THAN/GREATER-THAN SIGN
"\x{FF3B}" => "\x{FF3D}", # FULLWIDTH LEFT/RIGHT SQUARE BRACKET
"\x{FF5B}" => "\x{FF5D}", # FULLWIDTH LEFT/RIGHT CURLY BRACKET
"\x{FF5F}" => "\x{FF60}", # FULLWIDTH LEFT/RIGHT WHITE PARENTHESIS
"\x{FF62}" => "\x{FF63}", # HALFWIDTH LEFT/RIGHT CORNER BRACKET
"\x{FFEB}" => "\x{FFE9}", # HALFWIDTH RIGHT/LEFTWARDS ARROW
"\x{1D103}" => "\x{1D102}", # MUSICAL SYMBOL REVERSE FINAL BARLINE, MUSICAL SYMBOL FINAL BARLINE
"\x{1D106}" => "\x{1D107}", # MUSICAL SYMBOL LEFT/RIGHT REPEAT SIGN
"\x{1F449}" => "\x{1F448}", # WHITE RIGHT/LEFT POINTING BACKHAND INDEX
"\x{1F508}" => "\x{1F568}", # SPEAKER, RIGHT SPEAKER
"\x{1F509}" => "\x{1F569}", # SPEAKER WITH ONE SOUND WAVE, RIGHT SPEAKER WITH ONE SOUND WAVE
"\x{1F50A}" => "\x{1F56A}", # SPEAKER WITH THREE SOUND WAVES, RIGHT SPEAKER WITH THREE SOUND WAVES
"\x{1F57B}" => "\x{1F57D}", # LEFT/RIGHT HAND TELEPHONE RECEIVER
"\x{1F599}" => "\x{1F598}", # SIDEWAYS WHITE RIGHT/LEFT POINTING INDEX
"\x{1F59B}" => "\x{1F59A}", # SIDEWAYS BLACK RIGHT/LEFT POINTING INDEX
"\x{1F59D}" => "\x{1F59C}", # BLACK RIGHT/LEFT POINTING BACKHAND INDEX
"\x{1F5E6}" => "\x{1F5E7}", # THREE RAYS LEFT/RIGHT
"\x{1F802}" => "\x{1F800}", # RIGHT/LEFTWARDS ARROW WITH SMALL TRIANGLE ARROWHEAD
"\x{1F806}" => "\x{1F804}", # RIGHT/LEFTWARDS ARROW WITH MEDIUM TRIANGLE ARROWHEAD
"\x{1F80A}" => "\x{1F808}", # RIGHT/LEFTWARDS ARROW WITH LARGE TRIANGLE ARROWHEAD
"\x{1F812}" => "\x{1F810}", # RIGHT/LEFTWARDS ARROW WITH SMALL EQUILATERAL ARROWHEAD
"\x{1F816}" => "\x{1F814}", # RIGHT/LEFTWARDS ARROW WITH EQUILATERAL ARROWHEAD
"\x{1F81A}" => "\x{1F818}", # HEAVY RIGHT/LEFTWARDS ARROW WITH EQUILATERAL ARROWHEAD
"\x{1F81E}" => "\x{1F81C}", # HEAVY RIGHT/LEFTWARDS ARROW WITH LARGE EQUILATERAL ARROWHEAD
"\x{1F822}" => "\x{1F820}", # RIGHT/LEFTWARDS TRIANGLE-HEADED ARROW WITH NARROW SHAFT
"\x{1F826}" => "\x{1F824}", # RIGHT/LEFTWARDS TRIANGLE-HEADED ARROW WITH MEDIUM SHAFT
"\x{1F82A}" => "\x{1F828}", # RIGHT/LEFTWARDS TRIANGLE-HEADED ARROW WITH BOLD SHAFT
"\x{1F82E}" => "\x{1F82C}", # RIGHT/LEFTWARDS TRIANGLE-HEADED ARROW WITH HEAVY SHAFT
"\x{1F832}" => "\x{1F830}", # RIGHT/LEFTWARDS TRIANGLE-HEADED ARROW WITH VERY HEAVY SHAFT
"\x{1F836}" => "\x{1F834}", # RIGHT/LEFTWARDS FINGER-POST ARROW
"\x{1F83A}" => "\x{1F838}", # RIGHT/LEFTWARDS SQUARED ARROW
"\x{1F83E}" => "\x{1F83C}", # RIGHT/LEFTWARDS COMPRESSED ARROW
"\x{1F842}" => "\x{1F840}", # RIGHT/LEFTWARDS HEAVY COMPRESSED ARROW
"\x{1F846}" => "\x{1F844}", # RIGHT/LEFTWARDS HEAVY ARROW
"\x{1F852}" => "\x{1F850}", # RIGHT/LEFTWARDS SANS-SERIF ARROW
"\x{1F862}" => "\x{1F860}", # WIDE-HEADED RIGHT/LEFTWARDS LIGHT BARB ARROW
"\x{1F86A}" => "\x{1F868}", # WIDE-HEADED RIGHT/LEFTWARDS BARB ARROW
"\x{1F872}" => "\x{1F870}", # WIDE-HEADED RIGHT/LEFTWARDS MEDIUM BARB ARROW
"\x{1F87A}" => "\x{1F878}", # WIDE-HEADED RIGHT/LEFTWARDS HEAVY BARB ARROW
"\x{1F882}" => "\x{1F880}", # WIDE-HEADED RIGHT/LEFTWARDS VERY HEAVY BARB ARROW
"\x{1F892}" => "\x{1F890}", # RIGHT/LEFTWARDS TRIANGLE ARROWHEAD
"\x{1F896}" => "\x{1F894}", # RIGHT/LEFTWARDS WHITE ARROW WITHIN TRIANGLE ARROWHEAD
"\x{1F89A}" => "\x{1F898}", # RIGHT/LEFTWARDS ARROW WITH NOTCHED TAIL
"\x{1F8A1}" => "\x{1F8A0}", # RIGHTWARDS BOTTOM SHADED WHITE ARROW, LEFTWARDS BOTTOM-SHADED WHITE ARROW
"\x{1F8A3}" => "\x{1F8A2}", # RIGHT/LEFTWARDS TOP SHADED WHITE ARROW
"\x{1F8A5}" => "\x{1F8A6}", # RIGHT/LEFTWARDS RIGHT-SHADED WHITE ARROW
"\x{1F8A7}" => "\x{1F8A4}", # RIGHT/LEFTWARDS LEFT-SHADED WHITE ARROW
"\x{1F8A9}" => "\x{1F8A8}", # RIGHT/LEFTWARDS BACK-TILTED SHADOWED WHITE ARROW
"\x{1F8AB}" => "\x{1F8AA}", # RIGHT/LEFTWARDS FRONT-TILTED SHADOWED WHITE ARROW
);
}
sub decomment {
if ($] >= 5.014 && $] < 5.016) { _croak( "PPR::decomment() does not work under Perl 5.14" )}
my ($str) = @_;
local %PPR::comment_len;
# Locate comments...
$str =~ m{ (?&PerlEntireDocument)
(?(DEFINE)
(?<decomment>
( (?<! [\$@%] ) [#] [^\n]*+ )
(?{
my $len = length($^N);
my $pos = pos() - $len;
$PPR::comment_len{$pos} = $len;
})
)
(?<PerlOWS>
(?:
\h++
|
(?&PPR_newline_and_heredoc)
|
(?&decomment)
|
__ (?> END | DATA ) __ \b .*+ \z
)*+
) # End of rule
(?<PerlNWS>
(?:
\h++
|
(?&PPR_newline_and_heredoc)
|
(?&decomment)
|
__ (?> END | DATA ) __ \b .*+ \z
)++
) # End of rule
(?<PerlPod>
(
^ = [^\W\d]\w*+
.*?
(?>
^ = cut \b [^\n]*+ $
|
\z
)
)
(?{
my $len = length($^N);
my $pos = pos() - $len;
$PPR::comment_len{$pos} = $len;
})
) # End of rule
$PPR::GRAMMAR
)
}xms or return;
# Delete the comments found...
for my $from_pos (_uniq(sort { $b <=> $a } keys %PPR::comment_len)) {
substr($str, $from_pos, $PPR::comment_len{$from_pos}) =~ s/.+//g;
}
return $str;
}
sub _uniq {
my %seen;
return grep {!$seen{$_}++} @_;
}
sub _croak {
require Carp;
Carp::croak(@_);
}
sub _report {
state $CONTEXT_WIDTH = 20;
state $BUFFER = q{ } x $CONTEXT_WIDTH;
state $depth = 0;
my ($msg, $increment) = @_;
$depth++ if $increment;
my $at = pos();
my $str = $BUFFER . $_ . $BUFFER;
my $pre = substr($str, $at, $CONTEXT_WIDTH);
my $post = substr($str, $at+$CONTEXT_WIDTH, $CONTEXT_WIDTH);
tr/\n/ / for $pre, $post;
no warnings 'utf8';
warn sprintf("%05d ⎜%*s⎜%-*s⎜ %s%s\n",
$at, $CONTEXT_WIDTH, $pre, $CONTEXT_WIDTH, $post, q{ } x $depth, $msg);
$depth-- if !$increment;
}
1; # Magic true value required at end of module
__END__
=head1 NAME
PPR - Pattern-based Perl Recognizer
=head1 VERSION
This document describes PPR version 0.001010
=head1 SYNOPSIS
use PPR;
# Define a regex that will match an entire Perl document...
my $perl_document = qr{
# What to match # Install the (?&PerlDocument) rule
(?&PerlEntireDocument) $PPR::GRAMMAR
}x;
# Define a regex that will match a single Perl block...
my $perl_block = qr{
# What to match... # Install the (?&PerlBlock) rule...
(?&PerlBlock) $PPR::GRAMMAR
}x;
# Define a regex that will match a simple Perl extension...
my $perl_coroutine = qr{
# What to match...
coro (?&PerlOWS)
(?<coro_name> (?&PerlQualifiedIdentifier) ) (?&PerlOWS)
(?<coro_code> (?&PerlBlock) )
# Install the necessary subrules...
$PPR::GRAMMAR
}x;
# Define a regex that will match an integrated Perl extension...
my $perl_with_classes = qr{
# What to match...
\A
(?&PerlOWS) # Optional whitespace (including comments)
(?&PerlDocument) # A full Perl document
(?&PerlOWS) # More optional whitespace
\Z
# Add a 'class' keyword into the syntax that PPR understands...
(?(DEFINE)
(?<PerlKeyword>
class (?&PerlOWS)
(?&PerlQualifiedIdentifier) (?&PerlOWS)
(?: is (?&PerlNWS) (?&PerlIdentifier) (?&PerlOWS) )*+
(?&PerlBlock)
)
(?<kw_balanced_parens>
\( (?: [^()]++ | (?&kw_balanced_parens) )*+ \)
)
)
# Install the necessary standard subrules...
$PPR::GRAMMAR
}x;
=head1 DESCRIPTION
The PPR module provides a single regular expression that defines a set
of independent subpatterns suitable for matching entire Perl documents,
as well as a wide range of individual syntactic components of Perl
(i.e. statements, expressions, control blocks, variables, etc.)
The regex does not "parse" Perl (that is, it does not build a syntax
tree, like the PPI module does). Instead it simply "recognizes" standard
Perl constructs, or new syntaxes composed from Perl constructs.
Its features and capabilities therefore complement those of the PPI
module, rather than replacing them. See L<"Comparison with PPI">.
=head1 INTERFACE
=head2 Importing and using the Perl grammar regex
The PPR module exports no subroutines or variables,
and provides no methods. Instead, it defines a single
package variable, C<$PPR::GRAMMAR>, which can be
interpolated into regexes to add rules that permit
Perl constructs to be parsed:
$source_code =~ m{ (?&PerlEntireDocument) $PPR::GRAMMAR }x;
Note that all the examples shown so far have interpolated this "grammar
variable" at the end of the regular expression. This placement is
desirable, but not necessary. Both of the following work identically:
$source_code =~ m{ (?&PerlEntireDocument) $PPR::GRAMMAR }x;
$source_code =~ m{ $PPR::GRAMMAR (?&PerlEntireDocument) }x;
However, if the grammar is to be L<extended|"Extending the Perl syntax with keywords">,
then the extensions must be specified B<I<before>> the base grammar
(i.e. before the interpolation of C<$PPR::GRAMMAR>). Placing the grammar
variable at the end of a regex ensures that will be the case, and has
the added advantage of "front-loading" the regex with the most important
information: what is actually going to be matched.
Note too that, because the PPR grammar internally uses capture groups,
placing C<$PPR::GRAMMAR> anywhere other than the very end of your regex
may change the numbering of any explicit capture groups in your regex.
For complete safety, regexes that use the PPR grammar should probably
use named captures, instead of numbered captures.
=head2 Error reporting
Regex-based parsing is all-or-nothing: either your regex matches
(and returns any captures you requested), or it fails to match
(and returns nothing).
This can make it difficult to detect I<why> a PPR-based match failed;
to work out what the "bad source code" was that prevented your regex
from matching.
So the module provides a special variable that attempts to detect the
source code that prevented any call to the C<(?&PerlStatement)> subpattern
from matching. That variable is: C<$PPR::ERROR>
C<$PPR::ERROR> is only set if it is undefined at the point where an
error is detected, and will only be set to the first such error that
is encountered during parsing.
Note that errors are only detected when matching context-sensitive components
(for example in the middle of a C<(?&PerlStatement), as part of a
C<(?&PerlContextualRegex)>, or at the end of a C<(?&PerlEntireDocument>)>.
Errors, especially errors at the end of otherwise valid code, will often
not be detected in context-free components (for example, at the end of a
C<(?&PerlStatementSequence), as part of a C<(?&PerlRegex)>, or at the
end of a C<(?&PerlDocument>)>.
A common mistake in this area is to attempt to match an entire Perl document
using:
m{ \A (?&PerlDocument) \Z $PPR::GRAMMAR }x
instead of:
m{ (?&PerlEntireDocument) $PPR::GRAMMAR }x
Only the second approach will be able to successfully detect an unclosed
curly bracket at the end of the document.
=head3 C<PPR::ERROR> interface
If it is set, C<$PPR::ERROR> will contain an object of type PPR::ERROR,
with the following methods:
=over
=item C<< $PPR::ERROR->origin($line, $file) >>
Returns a clone of the PPR::ERROR object that now believes that the
source code parsing failure it is reporting occurred in a code fragment
starting at the specified line and file. If the second argument is
omitted, the file name is not reported in any diagnostic.
=item C<< $PPR::ERROR->source() >>
Returns a string containing the specific source code that could not be
parsed as a Perl statement.
=item C<< $PPR::ERROR->prefix() >>
Returns a string containing all the source code preceding the
code that could not be parsed. That is: the valid code that is
the preceding context of the unparsable code.
=item C<< $PPR::ERROR->line( $opt_offset ) >>
Returns an integer which is the line number at which the unparsable
code was encountered. If the optional "offset" argument is provided,
it will be added to the line number returned. Note that the offset
is ignored if the PPR::ERROR object originates from a prior call to
C<< $PPR::ERROR->origin >> (because in that case you will have already
specified the correct offset).
=item C<< $PPR::ERROR->diagnostic() >>
Returns a string containing the diagnostic that would be returned
by C<perl -c> if the source code were compiled.
B<I<Warning:>> The diagnostic is obtained by partially eval'ing
the source code. This means that run-time code will not be executed,
but C<BEGIN> and C<CHECK> blocks will run. Do B<I<not>> call this method
if the source code that created this error might also have non-trivial
compile-time side-effects.
=back
A typical use might therefore be:
# Make sure it's undefined, and will only be locally modified...
local $PPR::ERROR;
# Process the matched block...
if ($source_code =~ m{ (?<Block> (?&PerlBlock) ) $PPR::GRAMMAR }x) {
process( $+{Block} );
}
# Or report the offending code that stopped it being a valid block...
else {
die "Invalid Perl block: " . $PPR::ERROR->source . "\n",
$PPR::ERROR->origin($linenum, $filename)->diagnostic . "\n";
}
=head2 Decommenting code with C<PPR::decomment()>
The module provides (but does not export) a C<decomment()>
subroutine that can remove any comments and/or POD from source code.
It takes a single argument: a string containing the course code.
It returns a single value: a string containing the decommented source code.
For example:
$decommented_code = PPR::decomment( $commented_code );
The subroutine will fail if the argument wasn't valid Perl code,
in which case it returns C<undef> and sets C<$PPR::ERROR> to indicate
where the invalid source code was encountered.
Note that, due to separate bugs in the regex engine in Perl 5.14 and
5.20, the C<decomment()> subroutine is not available when running under
these releases.
=head2 Examples
I<Note:> In each of the following examples, the subroutine C<slurp()> is
used to acquire the source code from a file whose name is passed as its
argument. The C<slurp()> subroutine is just:
sub slurp { local (*ARGV, $/); @ARGV = shift; readline; }
or, for the less twisty-minded:
sub slurp {
my ($filename) = @_;
open my $filehandle, '<', $filename or die $!;
local $/;
return readline($filehandle);
}
=head3 Validating source code
# "Valid" if source code matches a Perl document under the Perl grammar
printf(
"$filename %s a valid Perl file\n",
slurp($filename) =~ m{ (?&PerlEntireDocument) $PPR::GRAMMAR }x
? "is"
: "is not"
);
=head3 Counting statements
printf( # Output
"$filename contains %d statements\n", # a report of
scalar # the count of
grep {defined} # defined matches
slurp($filename) # from the source code,
=~ m{
\G (?&PerlOWS) # skipping whitespace
((?&PerlStatement)) # and keeping statements,
$PPR::GRAMMAR # using the Perl grammar
}gcx; # incrementally
);
=head3 Stripping comments and POD from source code
my $source = slurp($filename); # Get the source
$source =~ s{ (?&PerlNWS) $PPR::GRAMMAR }{ }gx; # Compact whitespace
print $source; # Print the result
=head3 Stripping comments and POD from source code (in Perl v5.14 or later)
# Print the source code, having compacted whitespace...
print slurp($filename) =~ s{ (?&PerlNWS) $PPR::GRAMMAR }{ }gxr;
=head3 Stripping everything C<except> comments and POD from source code
say # Output
grep {defined} # defined matches
slurp($filename) # from the source code,
=~ m{ \G ((?&PerlOWS)) # keeping whitespace,
(?&PerlStatement)? # skipping statements,
$PPR::GRAMMAR # using the Perl grammar
}gcx; # incrementally
=head2 Available rules
Interpolating C<$PPR::GRAMMAR> in a regex makes all of the following
rules available within that regex.
Note that other rules not listed here may also be added, but these are
all considered strictly internal to the PPR module and are not
guaranteed to continue to exist in future releases. All such
"internal-use-only" rules have names that start with C<PPR_>...
=head3 C<< (?&PerlDocument) >>
Matches a valid Perl document, including leading or trailing
whitespace, comments, and any final C<__DATA__> or C<__END__> section.
This rule is context-free, so it can be embedded in a larger regex.
For example, to match an embedded chunk of Perl code, delimited by
C<<<< <<< >>>>...C<<<< >>> >>>>:
$src = m{ <<< (?&PerlDocument) >>> $PPR::GRAMMAR }x;
=head3 C<< (?&PerlEntireDocument) >>
Matches an entire valid Perl document, including leading or trailing
whitespace, comments, and any final C<__DATA__> or C<__END__> section.
This rule is I<not> context-free. It has an internal C<\A> at the beginning
and C<\Z> at the end, so a regex containing C<(?&PerlEntireDocument)>
will only match if:
=over
=item (a)
the C<(?&PerlEntireDocument)> is the sole top-level element of the regex
(or, at least the sole element of a single top-level C<|>-branch of the regex),
=item B<I<and>>
=item (b)
the entire string being matched contains only a single valid Perl document.
=back
In general, if you want to check that a string consists entirely of
a single valid sequence of Perl code, use:
$str =~ m{ (?&PerlEntireDocument) $PPR::GRAMMAR }
If you want to check that a string I<contains> at least one valid sequence
of Perl code at some point, possibly embedded in other text, use:
$str =~ m{ (?&PerlDocument) $PPR::GRAMMAR }
=head3 C<< (?&PerlStatementSequence) >>
Matches zero-or-more valid Perl statements, separated by optional
POD sequences.
=head3 C<< (?&PerlStatement) >>
Matches a single valid Perl statement, including: control structures;
C<BEGIN>, C<CHECK>, C<UNITCHECK>, C<INIT>, C<END>, C<DESTROY>, or
C<AUTOLOAD> blocks; variable declarations, C<use> statements, etc.
=head3 C<< (?&PerlExpression) >>
Matches a single valid Perl expression involving operators of any
precedence, but not any kind of block (i.e. not control structures,
C<BEGIN> blocks, etc.) nor any trailing statement modifier (e.g.
not a postfix C<if>, C<while>, or C<for>).
=head3 C<< (?&PerlLowPrecedenceNotExpression) >>
Matches an expression at the precedence of the C<not> operator.
That is, a single valid Perl expression that involves operators above
the precedence of C<and>.
=head3 C<< (?&PerlAssignment) >>
Matches an assignment expression.
That is, a single valid Perl expression involving operators above the
precedence of comma (C<,> or C<< => >>).
=head3 C<< (?&PerlConditionalExpression) >> or C<< (?&PerlScalarExpression) >>
Matches a conditional expression that uses the C<?>...C<:> ternary operator.
That is, a single valid Perl expression involving operators above the
precedence of assignment.
The alterative name comes from the fact that anything matching this rule
is what most people think of as a single element of a comma-separated list.
=head3 C<< (?&PerlBinaryExpression) >>
Matches an expression that uses any high-precedence binary operators.
That is, a single valid Perl expression involving operators above the
precedence of the ternary operator.
=head3 C<< (?&PerlPrefixPostfixTerm) >>
Matches a term with optional prefix and/or postfix unary operators
and/or a trailing sequence of C<< -> >> dereferences.
That is, a single valid Perl expression involving operators above the
precedence of exponentiation (C<**>).
=head3 C<< (?&PerlTerm) >>
Matches a simple high-precedence term within a Perl expression.
That is: a subroutine or builtin function call; a variable declaration;
a variable or typeglob lookup; an anonymous array, hash, or subroutine
constructor; a quotelike or numeric literal; a regex match; a
substitution; a transliteration; a C<do> or C<eval> block; or any other
expression in surrounding parentheses.
=head3 C<< (?&PerlTermPostfixDereference) >>
Matches a sequence of array- or hash-lookup brackets, or subroutine call
parentheses, or a postfix dereferencer (e.g. C<< ->$* >>), with
explicit or implicit intervening C<< -> >>, such as might appear after a term.
=head3 C<< (?&PerlLvalue) >>
Matches any variable or parenthesized list of variables that could
be assigned to.
=head3 C<< (?&PerlPackageDeclaration) >>
Matches the declaration of any package
(with or without a defining block).
=head3 C<< (?&PerlSubroutineDeclaration) >>
Matches the declaration of any named subroutine
(with or without a defining block).
=head3 C<< (?&PerlUseStatement) >>
Matches a C<< use <module name> ...; >> or C<< use <version number>; >> statement.
=head3 C<< (?&PerlReturnStatement) >>
Matches a C<< return <expression>; >> or C<< return; >> statement.
=head3 C<< (?&PerlReturnExpression) >>
Matches a C<< return <expression> >>
as an expression without trailing end-of-statement markers.
=head3 C<< (?&PerlControlBlock) >>
Matches an C<if>, C<unless>, C<while>, C<until>, C<for>, or C<foreach>
statement, including its block.
=head3 C<< (?&PerlDoBlock) >>
Matches a C<do>-block expression.
=head3 C<< (?&PerlEvalBlock) >>
Matches a C<eval>-block expression.
=head3 C<< (?&PerlTryCatchFinallyBlock) >>
Matches an C<try> block, followed by an option C<catch> block,
followed by an optional C<finally> block, using the built-in
syntax introduced in Perl v5.34 and v5.36.
Note that if your code uses one of the many CPAN modules
(such as C<Try::Tiny> or C<TryCatch>) that provided try/catch behaviours
prior to Perl v5.34, then you will most likely need to override
this subrule to match the alternate C<try>/C<catch> syntax
provided by your preferred module.
For example, if your code uses the C<TryCatch> module, you would
need to alter the PPR parser by explicitly redefining the subrule
for C<try> blocks, with something like:
my $MATCH_A_PERL_DOCUMENT = qr{
\A (?&PerlEntireDocument) \Z
(?(DEFINE)
# Redefine this subrule to match TryCatch syntax...
(?<PerlTryCatchFinallyBlock>
try (?>(?&PerlOWS))
(?>(?&PerlBlock))
(?: (?>(?&PerlOWS))
catch (?>(?&PerlOWS))
(?: \( (?>(?&PPR_balanced_parens)) \) (?>(?&PerlOWS)) )?+
(?>(?&PerlBlock))
)*+
)
)
$PPR::GRAMMAR
}xms;
Note that the popular C<Try::Tiny> module actually implements C<try>/C<catch>
as a normally parsed Perl subroutine call expression, rather than a statement.
This means that the unmodified PPR grammar can successfully parse all the
module's constructs.
However, the unmodified PPR grammar may misclassify some C<Try::Tiny> usages
as being built-in Perl v5.36 C<try> blocks followed by an unrelated call to
the C<catch> subroutine, rather than identifying the C<try> and C<catch> as
a single expression containing two subroutine calls.
If that difference in interpretation matters to you, you can deactivate
the built-in Perl v5.36 C<try>/C<catch> syntax entirely, like so:
my $MATCH_A_PERL_DOCUMENT = qr{
\A (?&PerlEntireDocument) \Z
(?(DEFINE)
# Turn off built-in try/catch syntax...
(?<PerlTryCatchFinallyBlock> (?!) )
# Decanonize 'try' and 'catch' as reserved words ineligible for sub names...
(?<PPR_X_non_reserved_identifier>
(?! (?> for(?:each)?+ | while | if | unless | until | given | when | default
| sub | format | use | no | my | our | state | defer | finally
# Note: Removed 'try' and 'catch' which appear here in the original subrule
| (?&PPR_X_named_op)
| [msy] | q[wrxq]?+ | tr
| __ (?> END | DATA ) __
)
\b
)
(?>(?&PerlQualifiedIdentifier))
(?! :: )
)
)
$PPR::GRAMMAR
}xms;
For more details and options for modifying PPR grammars in this way,
see also the documentation of the C<PPR::X> module.
=head3 C<< (?&PerlStatementModifier) >>
Matches an C<if>, C<unless>, C<while>, C<until>, C<for>, or C<foreach>
modifier that could appear after a statement. Only matches the modifier, not
the preceding statement.
=head3 C<< (?&PerlFormat) >>
Matches a C<format> declaration, including its terminating "dot".
=head3 C<< (?&PerlBlock) >>
Matches a C<{>...C<}>-delimited block containing zero-or-more statements.
=head3 C<< (?&PerlCall) >>
Matches a call to a subroutine or built-in function.
Accepts all valid call syntaxes,
either via a literal names or a reference,
with or without a leading C<&>,
with or without arguments,
with or without parentheses on any argument list.
=head3 C<< (?&PerlAttributes) >>
Matches a list of colon-preceded attributes, such as might be specified
on the declaration of a subroutine or a variable.
=head3 C<< (?&PerlCommaList) >>
Matches a list of zero-or-more comma-separated subexpressions.
That is, a single valid Perl expression that involves operators above the
precedence of C<not>.
=head3 C<< (?&PerlParenthesesList) >>
Matches a list of zero-or-more comma-separated subexpressions inside
a set of parentheses.
=head3 C<< (?&PerlList) >>
Matches either a parenthesized or unparenthesized list of
comma-separated subexpressions. That is, matches anything that either of
the two preceding rules would match.
=head3 C<< (?&PerlAnonymousArray) >>
Matches an anonymous array constructor.
That is: a list of zero-or-more subexpressions inside square brackets.
=head3 C<< (?&PerlAnonymousHash) >>
Matches an anonymous hash constructor.
That is: a list of zero-or-more subexpressions inside curly brackets.
=head3 C<< (?&PerlArrayIndexer) >>
Matches a valid indexer that could be applied to look up elements of a array.
That is: a list of or one-or-more subexpressions inside square brackets.
=head3 C<< (?&PerlHashIndexer) >>
Matches a valid indexer that could be applied to look up entries of a hash.
That is: a list of or one-or-more subexpressions inside curly brackets,
or a simple bareword indentifier inside curley brackets.
=head3 C<< (?&PerlDiamondOperator) >>
Matches anything in angle brackets.
That is: any "diamond" readline (e.g. C<< <$filehandle> >>
or file-grep operation (e.g. C<< <*.pl> >>).
=head3 C<< (?&PerlComma) >>
Matches a short (C<,>) or long (C<< => >>) comma.
=head3 C<< (?&PerlPrefixUnaryOperator) >>
Matches any high-precedence prefix unary operator.
=head3 C<< (?&PerlPostfixUnaryOperator) >>
Matches any high-precedence postfix unary operator.
=head3 C<< (?&PerlInfixBinaryOperator) >>
Matches any infix binary operator
whose precedence is between C<..> and C<**>.
=head3 C<< (?&PerlAssignmentOperator) >>
Matches any assignment operator,
including all I<op>C<=> variants.
=head3 C<< (?&PerlLowPrecedenceInfixOperator) >>
Matches C<and>, <or>, or C<xor>.
=head3 C<< (?&PerlAnonymousSubroutine) >>
Matches an anonymous subroutine.
=head3 C<< (?&PerlVariable) >>
Matches any type of access on any scalar, array, or hash
variable.
=head3 C<< (?&PerlVariableScalar) >>
Matches any scalar variable,
including fully qualified package variables,
punctuation variables, scalar dereferences,
and the C<$#array> syntax.
=head3 C<< (?&PerlVariableArray) >>
Matches any array variable,
including fully qualified package variables,
punctuation variables, and array dereferences.
=head3 C<< (?&PerlVariableHash) >>
Matches any hash variable,
including fully qualified package variables,
punctuation variables, and hash dereferences.
=head3 C<< (?&PerlTypeglob) >>
Matches a typeglob.
=head3 C<< (?&PerlScalarAccess) >>
Matches any kind of variable access
beginning with a C<$>,
including fully qualified package variables,
punctuation variables, scalar dereferences,
the C<$#array> syntax, and single-value
array or hash look-ups.
=head3 C<< (?&PerlScalarAccessNoSpace) >>
Matches any kind of variable access beginning with a C<$>, including
fully qualified package variables, punctuation variables, scalar
dereferences, the C<$#array> syntax, and single-value array or hash
look-ups.
But does not allow spaces between the components of the
variable access (i.e. imposes the same constraint as within an
interpolating quotelike).
=head3 C<< (?&PerlScalarAccessNoSpaceNoArrow) >>
Matches any kind of variable access beginning with a C<$>, including
fully qualified package variables, punctuation variables, scalar
dereferences, the C<$#array> syntax, and single-value array or hash
look-ups.
But does not allow spaces or arrows between the components of the
variable access (i.e. imposes the same constraint as within a
C<< <...> >>-delimited interpolating quotelike).
=head3 C<< (?&PerlArrayAccess) >>
Matches any kind of variable access
beginning with a C<@>,
including arrays, array dereferences,
and list slices of arrays or hashes.
=head3 C<< (?&PerlArrayAccessNoSpace) >>
Matches any kind of variable access
beginning with a C<@>,
including arrays, array dereferences,
and list slices of arrays or hashes.
But does not allow spaces between the components of the
variable access (i.e. imposes the same constraint as within an
interpolating quotelike).
=head3 C<< (?&PerlArrayAccessNoSpaceNoArrow) >>
Matches any kind of variable access
beginning with a C<@>,
including arrays, array dereferences,
and list slices of arrays or hashes.
But does not allow spaces or arrows between the components of the
variable access (i.e. imposes the same constraint as within a
C<< <...> >>-delimited interpolating quotelike).
=head3 C<< (?&PerlHashAccess) >>
Matches any kind of variable access
beginning with a C<%>,
including hashes, hash dereferences,
and kv-slices of hashes or arrays.
=head3 C<< (?&PerlLabel) >>
Matches a colon-terminated label.
=head3 C<< (?&PerlLiteral) >>
Matches a literal value.
That is: a number, a C<qr> or C<qw>
quotelike, a string, or a bareword.
=head3 C<< (?&PerlString) >>
Matches a string literal.
That is: a single- or double-quoted string,
a C<q> or C<qq> string, a heredoc, or a
version string.
=head3 C<< (?&PerlQuotelike) >>
Matches any form of quotelike operator.
That is: a single- or double-quoted string,
a C<q> or C<qq> string, a heredoc, a
version string, a C<qr>, a C<qw>, a C<qx>,
a C</.../> or C<m/.../> regex,
a substitution, or a transliteration.
=head3 C<< (?&PerlHeredoc) >>
Matches a heredoc specifier.
That is: just the initial C<< <<TERMINATOR> >> component,
I<not> the actual contents of the heredoc on the
subsequent lines.
This rule only matches a heredoc specifier if that specifier
is correctly followed on the next line by any heredoc contents
and then the correct terminator.
However, if the heredoc specifier I<is> correctly matched, subsequent
calls to either of the whitespace-matching rules (C<(?&PerlOWS)> or
C<(?&PerlNWS)>) will also consume the trailing heredoc contents and
the terminator.
So, for example, to correctly match a heredoc plus its contents
you could use something like:
m/ (?&PerlHeredoc) (?&PerlOWS) $PPR::GRAMMAR /x
or, if there may be trailing items on the same line as the heredoc
specifier:
m/ (?&PerlHeredoc)
(?<trailing_items> [^\n]* )
(?&PerlOWS)
$PPR::GRAMMAR
/x
Note that the saeme limitations apply to other constructs that
match heredocs, such a C<< (?&PerlQuotelike) >> or C<< (?&PerlString) >>.
=head3 C<< (?&PerlQuotelikeQ) >>
Matches a single-quoted string,
either a C<'...'>
or a C<q/.../> (with any valid delimiters).
=head3 C<< (?&PerlQuotelikeQQ) >>
Matches a double-quoted string,
either a C<"...">
or a C<qq/.../> (with any valid delimiters).
=head3 C<< (?&PerlQuotelikeQW) >>
Matches a "quotewords" list.
That is a C<qw/ list of words />
(with any valid delimiters).
=head3 C<< (?&PerlQuotelikeQX) >>
Matches a C<qx> system call,
either a C<`...`>
or a C<qx/.../> (with any valid delimiters)
=head3 C<< (?&PerlQuotelikeS) >> or C<< (?&PerlSubstitution) >>
Matches a substitution operation.
That is: C<s/.../.../>
(with any valid delimiters and any valid trailing modifiers).
=head3 C<< (?&PerlQuotelikeTR) >> or C<< (?&PerlTransliteration) >>
Matches a transliteration operation.
That is: C<tr/.../.../> or C<y/.../.../>
(with any valid delimiters and any valid trailing modifiers).
=head3 C<< (?&PerlContextualQuotelikeM) >> or C<< (?&PerContextuallMatch) >>
Matches a regex-match operation in any context where it would
be allowed in valid Perl.
That is: C</.../> or C<m/.../>
(with any valid delimiters and any valid trailing modifiers).
=head3 C<< (?&PerlQuotelikeM) >> or C<< (?&PerlMatch) >>
Matches a regex-match operation.
That is: C</.../> or C<m/.../>
(with any valid delimiters and any valid trailing modifiers)
in any context (i.e. even in places where it would not normally
be allowed within a valid piece of Perl code).
=head3 C<< (?&PerlQuotelikeQR) >>
Matches a C<qr> regex constructor
(with any valid delimiters and any valid trailing modifiers).
=head3 C<< (?&PerlContextualRegex) >>
Matches a C<qr> regex constructor or a C</.../> or C<m/.../> regex-match
operation (with any valid delimiters and any valid trailing modifiers)
anywhere where either would be allowed in valid Perl.
In other words: anything capable of matching within valid Perl code.
=head3 C<< (?&PerlRegex) >>
Matches a C<qr> regex constructor or a C</.../> or C<m/.../> regex-match
operation in any context (i.e. even in places where it would not normally
be allowed within a valid piece of Perl code).
In other words: anything capable of matching.
=head3 C<< (?&PerlBuiltinFunction) >>
Matches the I<name> of any builtin function.
To match an actual call to a built-in function, use:
m/
(?= (?&PerlBuiltinFunction) )
(?&PerlCall)
/x
=head3 C<< (?&PerlNullaryBuiltinFunction) >>
Matches the name of any builtin function that never
takes arguments.
To match an actual call to a built-in function that
never takes arguments, use:
m/
(?= (?&PerlNullaryBuiltinFunction) )
(?&PerlCall)
/x
=head3 C<< (?&PerlVersionNumber) >>
Matches any number or version-string that can be
used as a version number within a C<use>, C<no>,
or C<package> statement.
=head3 C<< (?&PerlVString) >>
Matches a version-string (a.k.a v-string).
=head3 C<< (?&PerlNumber) >>
Matches a valid number,
including binary, octal, decimal and hexadecimal integers,
and floating-point numbers with or without an exponent.
=head3 C<< (?&PerlIdentifier) >>
Matches a simple, unqualified identifier.
=head3 C<< (?&PerlQualifiedIdentifier) >>
Matches a qualified or unqualified identifier,
which may use either C<::> or C<'> as internal
separators, but only C<::> as initial or terminal
separators.
=head3 C<< (?&PerlOldQualifiedIdentifier) >>
Matches a qualified or unqualified identifier,
which may use either C<::> or C<'> as both
internal and external separators.
=head3 C<< (?&PerlBareword) >>
Matches a valid bareword.
Note that this is not the same as an simple identifier,
nor the same as a qualified identifier.
=head3 C<< (?&PerlPod) >>
Matches a single POD section containing any contiguous set of POD
directives, up to the first C<=cut> or end-of-file.
=head3 C<< (?&PerlPodSequence) >>
Matches any sequence of POD sections,
separated and /or surrounded by optional whitespace.
=head3 C<< (?&PerlNWS) >>
Match one-or-more characters of necessary whitespace,
including spaces, tabs, newlines, comments, and POD.
=head3 C<< (?&PerlOWS) >>
Match zero-or-more characters of optional whitespace,
including spaces, tabs, newlines, comments, and POD.
=head3 C<< (?&PerlOWSOrEND) >>
Match zero-or-more characters of optional whitespace,
including spaces, tabs, newlines, comments, POD,
and any trailing C<__END__> or C<__DATA__> section.
=head3 C<< (?&PerlEndOfLine) >>
Matches a single newline (C<\n>) character.
This is provided mainly to allow newlines to
be "hooked" by redefining C<< (?<PerlEndOfLine>) >>
(for example, to count lines during a parse).
=head3 C<< (?&PerlKeyword) >>
Match a pluggable keyword.
Note that there are no pluggable keywords
in the default PPR regex;
they must be added by the end-user.
See the following section for details.
=head2 Extending the Perl syntax with keywords
In Perl 5.12 and later, it's possible to add new types
of statements to the language using a mechanism called
"pluggable keywords".
This mechanism (best accessed via CPAN modules such as
C<Keyword::Simple> or C<Keyword::Declare>) acts like a limited macro
facility. It detects when a statement begins with a particular,
pre-specified keyword, passes the trailing text to an associated keyword
handler, and replaces the trailing source code with whatever the keyword
handler produces.
For example, the L<Dios> module uses this mechanism to add keywords such
as C<class>, C<method>, and C<has> to Perl 5, providing a declarative
OO syntax. And the L<Object::Result> module uses pluggable keywords to
add a C<result> statement that simplifies returning an ad hoc object from a
subroutine.
Unfortunately, because such modules effectively extend the standard Perl
syntax, by default PPR has no way of successfully parsing them.
However, when setting up a regex using C<$PPR::GRAMMAR> it is possible to
extend that grammar to deal with new keywords...by defining a rule named
C<< (?<PerlKeyword>...) >>.
This rule is always tested as the first option within the standard
C<(?&PerlStatement)> rule, so any syntax declared within effectively
becomes a new kind of statement. Note that each alternative within
the rule must begin with a valid "keyword" (that is: a simple
identifier of some kind).
For example, to support the three keywords from L<Dios>:
$Dios::GRAMMAR = qr{
# Add a keyword rule to support Dios...
(?(DEFINE)
(?<PerlKeyword>
class (?&PerlOWS)
(?&PerlQualifiedIdentifier) (?&PerlOWS)
(?: is (?&PerlNWS) (?&PerlIdentifier) (?&PerlOWS) )*+
(?&PerlBlock)
|
method (?&PerlOWS)
(?&PerlIdentifier) (?&PerlOWS)
(?: (?&kw_balanced_parens) (?&PerlOWS) )?+
(?: (?&PerlAttributes) (?&PerlOWS) )?+
(?&PerlBlock)
|
has (?&PerlOWS)
(?: (?&PerlQualifiedIdentifier) (?&PerlOWS) )?+
[\@\$%][.!]?(?&PerlIdentifier) (?&PerlOWS)
(?: (?&PerlAttributes) (?&PerlOWS) )?+
(?: (?: // )?+ = (?&PerlOWS)
(?&PerlExpression) (?&PerlOWS) )?+
(?> ; | (?= \} ) | \z )
)
(?<kw_balanced_parens>
\( (?: [^()]++ | (?&kw_balanced_parens) )*+ \)
)
)
# Add all the standard PPR rules...
$PPR::GRAMMAR
}x;
# Then parse with it...
$source_code =~ m{ \A (?&PerlDocument) \Z $Dios::GRAMMAR }x;
Or, to support the C<result> statement from C<Object::Result>:
my $ORK_GRAMMAR = qr{
# Add a keyword rule to support Object::Result...
(?(DEFINE)
(?<PerlKeyword>
result (?&PerlOWS)
\{ (?&PerlOWS)
(?: (?> (?&PerlIdentifier)
| < [[:upper:]]++ >
) (?&PerlOWS)
(?&PerlParenthesesList)?+ (?&PerlOWS)
(?&PerlBlock) (?&PerlOWS)
)*+
\}
)
)
# Add all the standard PPR rules...
$PPR::GRAMMAR
}x;
# Then parse with it...
$source_code =~ m{ \A (?&PerlDocument) \Z $ORK_GRAMMAR }x;
Note that, although pluggable keywords are only available from Perl
5.12 onwards, PPR will still accept C<(&?PerlKeyword)> extensions under
Perl 5.10.
=head2 Extending the Perl syntax in other ways
Other modules (such as C<Devel::Declare> and C<Filter::Simple>)
make it possible to extend Perl syntax in even more flexible ways.
The L<< PPR::X >> module provides support for syntactic extensions more
general than pluggable keywords.
=begin PPR::X
PPR::X allows I<any> of its public rules to be redefined in a
particular regex. For example, to create a regex that matches
standard Perl syntax, but which allows the keyword C<fun> as
a synonym for C<sub>:
my $FUN_GRAMMAR = qr{
# Extend the subroutine-matching rules...
(?(DEFINE)
(?<PerlStatement>
# Try the standard syntax...
(?&PerlStdStatement)
|
# Try the new syntax...
fun (?&PerlOWS)
(?&PerlOldQualifiedIdentifier) (?&PerlOWS)
(?: \( [^)]*+ \) )?+ (?&PerlOWS)
(?: (?&PerlAttributes) (?&PerlOWS) )?+
(?> ; | (?&PerlBlock) )
)
(?<PerlAnonymousSubroutine>
# Try the standard syntax
(?&PerlStdAnonymousSubroutine)
|
# Try the new syntax
fun (?&PerlOWS)
(?: \( [^)]*+ \) )?+ (?&PerlOWS)
(?: (?&PerlAttributes) (?&PerlOWS) )?+
(?> ; | (?&PerlBlock) )
)
)
$PPR::X::GRAMMAR
}x;
Note first that any redefinitions of the various rules have to be
specified before the interpolation of the standard rules (so that the
new rules take syntactic precedence over the originals).
The structure of each redefinition is essentially identical.
First try the original rule, which is still accessible as C<(?&PerlStd...)>
(instead of C<(?&Perl...)>). Otherwise, try the new alternative, which
may be constructed out of other rules.
original rule.
There is no absolute requirement to try the original rule as part of the
new rule, but if you don't then you are I<replacing> the rule, rather
than extending it. For example, to replace the low-precedence boolean
operators (C<and>, C<or>, C<xor>, and C<not>) with their Latin equivalents:
my $GRAMMATICA = qr{
# Verbum sapienti satis est...
(?(DEFINE)
# Iunctiones...
(?<PerlLowPrecedenceInfixOperator>
atque | vel | aut
)
# Contradicetur...
(?<PerlLowPrecedenceNotExpression>
(?: non (?&PerlOWS) )*+ (?&PerlCommaList)
)
)
$PPR::X::GRAMMAR
}x;
Or to maintain a line count within the parse:
my $COUNTED_GRAMMAR = qr{
(?(DEFINE)
(?<PerlEndOfLine>
# Try the standard syntax
(?&PerlStdEndOfLine)
# Then count the line (must localize, to handle backtracking)...
(?{ local $linenum = $linenum + 1; })
)
)
$PPR::X::GRAMMAR
}x;
=end PPR::X
=head2 Comparison with PPI
The PPI and PPR modules can both identify valid Perl code,
but they do so in very different ways, and are optimal for
different purposes.
PPI scans an entire Perl document and builds a hierarchical
representation of the various components. It is therefore suitable for
recognition, validation, partial extraction, and in-place transformation
of Perl code.
PPR matches only as much of a Perl document as specified by the regex
you create, and does not build any hierarchical representation of the
various components it matches. It is therefore suitable for recognition
and validation of Perl code. However, unless great care is taken, PPR is
not as reliable as PPI for extractions or transformations of components
smaller than a single statement.
On the other hand, PPI always has to parse its entire input, and
build a complete non-trivial nested data structure for it, before it
can be used to recognize or validate any component. So it is almost
always significantly slower and more complicated than PPR for those
kinds of tasks.
For example, to determine whether an input string begins with a valid
Perl block, PPI requires something like:
if (my $document = PPI::Document->new(\$input_string) ) {
my $block = $document->schild(0)->schild(0);
if ($block->isa('PPI::Structure::Block')) {
$block->remove;
process_block($block);
process_extra($document);
}
}
whereas PPR needs just:
if ($input_string =~ m{ \A (?&PerlOWS) ((?&PerlBlock)) (.*) }xs) {
process_block($1);
process_extra($2);
}
Moreover, the PPR version will be at least twice as fast at recognizing that
leading block (and usually four to seven times faster)...mainly because it
doesn't have to parse the trailing code at all, nor build any representation
of its hierarchical structure.
As a simple rule of thumb, when you only need to quickly detect, identify,
or confirm valid Perl (or just a single valid Perl component), use PPR.
When you need to examine, traverse, or manipulate the internal structure
or component relationships within an entire Perl document, use PPI.
=head1 DIAGNOSTICS
=over
=item C<Warning: This program is running under Perl 5.20...>
Due to an unsolved issue with that particular release of Perl, the
single regex in the PPR module takes a ridiculously long time
to compile under Perl 5.20 (i.e. minutes, not milliseconds).
The code will work correctly when it eventually does compile,
but the start-up delay is so extreme that the module issues
this warning, to reassure users the something is actually
happening, and explain why it's happening so slowly.
The only remedy at present is to use an older or newer version
of Perl.
For all the gory details, see:
L<https://rt.perl.org/Public/Bug/Display.html?id=122283>
L<https://rt.perl.org/Public/Bug/Display.html?id=122890>
=item C<< PPR::decomment() does not work under Perl 5.14 >>
There is a separate bug in the Perl 5.14 regex engine that prevents
the C<decomment()> subroutine from correctly detecting the location
of comments.
The subroutine throws an exception if you attempt to call it
when running under Perl 5.14 specifically.
=back
The module has no other diagnostics, apart from those Perl
provides for all regular expressions.
The commonest error is to forget to add C<$PPR::GRAMMAR>
to a regex, in which case you will get a standard Perl
error message such as:
Reference to nonexistent named group in regex;
marked by <-- HERE in m/
(?&PerlDocument <-- HERE )
/ at example.pl line 42.
Adding C<$PPR::GRAMMAR> at the end of the regex solves the problem.
=head1 CONFIGURATION AND ENVIRONMENT
PPR requires no configuration files or environment variables.
=head1 DEPENDENCIES
Requires Perl 5.10 or later.
=head1 INCOMPATIBILITIES
None reported.
=head1 LIMITATIONS
This module works under all versions of Perl from 5.10 onwards.
However, the lastest release of Perl 5.20 seems to have significant
difficulties compiling large regular expressions, and typically requires
over a minute to build any regex that incorporates the C<$PPR::GRAMMAR> rule
definitions.
The problem does not occur in Perl 5.10 to 5.18, nor in Perl 5.22 or later,
though the parser is still measurably slower in all Perl versions
greater than 5.20 (presumably because I<most> regexes are measurably
slower in more modern versions of Perl; such is the price of full
re-entrancy and safe lexical scoping).
The C<decomment()> subroutine trips a separate regex engine bug in Perl
5.14 only and will not run under that version.
There was a lingering bug in regex re-interpolation between Perl 5.18 and 5.28,
which means that interpolating a PPR grammar (or any other precompiled regex
that uses the C<(??{...})> construct) into another regex sometimes does not work.
In these cases, the spurious error message generated is usually:
S<I<Sequence (?_...) not recognized>>. This problem is unlikely ever to be
resolved, as those versions of Perl are no longer being maintained. The
only known workaround is to upgrade to Perl 5.30 or later.
There are also constructs in Perl 5 which cannot be parsed without
actually executing some code...which the regex does not attempt to
do, for obvious reasons.
=head1 BUGS
No bugs have been reported.
Please report any bugs or feature requests to
C<bug-ppr@rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org>.
=head1 AUTHOR
Damian Conway C<< <DCONWAY@CPAN.org> >>
=head1 LICENCE AND COPYRIGHT
Copyright (c) 2017, Damian Conway C<< <DCONWAY@CPAN.org> >>. All rights reserved.
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. See L<perlartistic>.
=head1 DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE
LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
|