summaryrefslogtreecommitdiff
path: root/tests/existing.at
blob: 7106af6e02e6eaeaa95a4d9e8c6dff4cd1f79d33 (plain)
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
# Exercising Bison on actual grammars.                   -*- Autotest -*-

# Copyright (C) 1989-1992, 2000-2005, 2007, 2009-2015, 2018-2022 Free
# Software Foundation, Inc.

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

AT_BANNER([[Existing Grammars.]])

# AT_TEST_EXISTING_GRAMMAR(DESCRIPTION,
#                          DECLS, GRAMMAR, INPUT,
#                          BISON-STDERR, LAST-STATE, LALR1-DIFF,
#                          [OTHER-CHECKS],
#                          [PARSER-EXIT-VALUE],
#                          [PARSER-STDOUT], [PARSER-STDERR])
# --------------------------------------------------------------
m4_define([AT_TEST_EXISTING_GRAMMAR], [_AT_TEST_EXISTING_GRAMMAR([$][1], $@)])

m4_define([_AT_TEST_EXISTING_GRAMMAR],
[
dnl See how the parser tables have changed.  As the .output format evolves, the
dnl diff comments with line numbers might be a pain to maintain.  When that
dnl time comes, just use sed to drop the line numbers.  For now, as LR(1)
dnl support is rapidly evolving, let's keep that information to be careful.
dnl However, we don't do diffs for canonical LR(1) because the diff is huge.
m4_pushdef([AT_LALR1_DIFF_CHECK],
[AT_CHECK([[sed 's/^%define lr.type .*$//' input.y > input-lalr.y]])
AT_BISON_CHECK([[--report=all,no-cex input-lalr.y]], [[0]], [ignore], [ignore])
AT_DIFF_U_CHECK([[input-lalr.output input.output]], [$1])])

AT_TEST_TABLES_AND_PARSE([$2[: LALR(1)]], [[LALR]], [[last-state]],
                         [[%define lr.type lalr
]$3],
                         [$4], [$5], [$6], [$7],
                         [AT_LALR1_DIFF_CHECK([$8])$9], [$10], [$11], [$12])
AT_TEST_TABLES_AND_PARSE([$2[: IELR(1)]], [[IELR]], [[last-state]],
                         [[%define lr.type ielr
]$3],
                         [$4], [$5], [$6], [$7],
                         [AT_LALR1_DIFF_CHECK([$8])$9], [$10], [$11], [$12])
AT_TEST_TABLES_AND_PARSE([$2[: Canonical LR(1)]], [[canonical LR]],
                         [[last-state,no-xml]],
                         [[%define lr.type canonical-lr
]$3],
                         [$4], [$5], [$6], [$7],
                         [$9], [$10], [$11], [$12])

m4_popdef([AT_LALR1_DIFF_CHECK])
])



## ----------------------- ##
## GNU AWK 3.1.0 Grammar.  ##
## ----------------------- ##

# We have been careful to strip all the actions excepts the
# midrule actions.
#
# There are 65 SR conflicts.  Bison was once wrong, due to an incorrect
# computation of nullable.  It reported 485 SR conflicts!

AT_TEST_EXISTING_GRAMMAR([[GNU AWK 3.1.0 Grammar]],
[[%define parse.error verbose

%token FUNC_CALL NAME REGEXP
%token ERROR
%token YNUMBER YSTRING
%token RELOP APPEND_OP
%token ASSIGNOP MATCHOP NEWLINE CONCAT_OP
%token LEX_BEGIN LEX_END LEX_IF LEX_ELSE LEX_RETURN LEX_DELETE
%token LEX_WHILE LEX_DO LEX_FOR LEX_BREAK LEX_CONTINUE
%token LEX_PRINT LEX_PRINTF LEX_NEXT LEX_EXIT LEX_FUNCTION
%token LEX_GETLINE LEX_NEXTFILE
%token LEX_IN
%token LEX_AND LEX_OR INCREMENT DECREMENT
%token LEX_BUILTIN LEX_LENGTH

/* Lowest to highest */
%right ASSIGNOP
%right '?' ':'
%left LEX_OR
%left LEX_AND
%left LEX_GETLINE
%nonassoc LEX_IN
%left FUNC_CALL LEX_BUILTIN LEX_LENGTH
%nonassoc ','
%nonassoc MATCHOP
%nonassoc RELOP '<' '>' '|' APPEND_OP TWOWAYIO
%left CONCAT_OP
%left YSTRING YNUMBER
%left '+' '-'
%left '*' '/' '%'
%right '!' UNARY
%right '^'
%left INCREMENT DECREMENT
%left '$'
%left '(' ')'
]],
[[
start
        : opt_nls program opt_nls
        ;

program
        : rule
        | program rule
        | error
        | program error
        | /* empty */
        ;

rule
        : LEX_BEGIN {} action
        | LEX_END {}   action
        | LEX_BEGIN statement_term
        | LEX_END statement_term
        | pattern action
        | action
        | pattern statement_term
        | function_prologue function_body
        ;

func_name
        : NAME
        | FUNC_CALL
        | lex_builtin
        ;

lex_builtin
        : LEX_BUILTIN
        | LEX_LENGTH
        ;

function_prologue
        : LEX_FUNCTION {} func_name '(' opt_param_list r_paren opt_nls
        ;

function_body
        : l_brace statements r_brace opt_semi opt_nls
        | l_brace r_brace opt_semi opt_nls
        ;

pattern
        : exp
        | exp ',' exp
        ;

regexp
        /*
         * In this rule, want_regexp tells yylex that the next thing
         * is a regexp so it should read up to the closing slash.
         */
        : '/' {} REGEXP '/'
        ;

action
        : l_brace statements r_brace opt_semi opt_nls
        | l_brace r_brace opt_semi opt_nls
        ;

statements
        : statement
        | statements statement
        | error
        | statements error
        ;

statement_term
        : nls
        | semi opt_nls
        ;

statement
        : semi opt_nls
        | l_brace r_brace
        | l_brace statements r_brace
        | if_statement
        | LEX_WHILE '(' exp r_paren opt_nls statement
        | LEX_DO opt_nls statement LEX_WHILE '(' exp r_paren opt_nls
        | LEX_FOR '(' NAME LEX_IN NAME r_paren opt_nls statement
        | LEX_FOR '(' opt_exp semi opt_nls exp semi opt_nls opt_exp r_paren opt_nls statement
        | LEX_FOR '(' opt_exp semi opt_nls semi opt_nls opt_exp r_paren opt_nls statement
        | LEX_BREAK statement_term
        | LEX_CONTINUE statement_term
        | print '(' expression_list r_paren output_redir statement_term
        | print opt_rexpression_list output_redir statement_term
        | LEX_NEXT statement_term
        | LEX_NEXTFILE statement_term
        | LEX_EXIT opt_exp statement_term
        | LEX_RETURN {} opt_exp statement_term
        | LEX_DELETE NAME '[' expression_list ']' statement_term
        | LEX_DELETE NAME  statement_term
        | exp statement_term
        ;

print
        : LEX_PRINT
        | LEX_PRINTF
        ;

if_statement
        : LEX_IF '(' exp r_paren opt_nls statement
        | LEX_IF '(' exp r_paren opt_nls statement
             LEX_ELSE opt_nls statement
        ;

nls
        : NEWLINE
        | nls NEWLINE
        ;

opt_nls
        : /* empty */
        | nls
        ;

input_redir
        : /* empty */
        | '<' simp_exp
        ;

output_redir
        : /* empty */
        | '>' exp
        | APPEND_OP exp
        | '|' exp
        | TWOWAYIO exp
        ;

opt_param_list
        : /* empty */
        | param_list
        ;

param_list
        : NAME
        | param_list comma NAME
        | error
        | param_list error
        | param_list comma error
        ;

/* optional expression, as in for loop */
opt_exp
        : /* empty */
        | exp
        ;

opt_rexpression_list
        : /* empty */
        | rexpression_list
        ;

rexpression_list
        : rexp
        | rexpression_list comma rexp
        | error
        | rexpression_list error
        | rexpression_list error rexp
        | rexpression_list comma error
        ;

opt_expression_list
        : /* empty */
        | expression_list
        ;

expression_list
        : exp
        | expression_list comma exp
        | error
        | expression_list error
        | expression_list error exp
        | expression_list comma error
        ;

/* Expressions, not including the comma operator.  */
exp     : variable ASSIGNOP {} exp
        | '(' expression_list r_paren LEX_IN NAME
        | exp '|' LEX_GETLINE opt_variable
        | exp TWOWAYIO LEX_GETLINE opt_variable
        | LEX_GETLINE opt_variable input_redir
        | exp LEX_AND exp
        | exp LEX_OR exp
        | exp MATCHOP exp
        | regexp
        | '!' regexp %prec UNARY
        | exp LEX_IN NAME
        | exp RELOP exp
        | exp '<' exp
        | exp '>' exp
        | exp '?' exp ':' exp
        | simp_exp
        | exp simp_exp %prec CONCAT_OP
        ;

rexp
        : variable ASSIGNOP {} rexp
        | rexp LEX_AND rexp
        | rexp LEX_OR rexp
        | LEX_GETLINE opt_variable input_redir
        | regexp
        | '!' regexp %prec UNARY
        | rexp MATCHOP rexp
        | rexp LEX_IN NAME
        | rexp RELOP rexp
        | rexp '?' rexp ':' rexp
        | simp_exp
        | rexp simp_exp %prec CONCAT_OP
        ;

simp_exp
        : non_post_simp_exp
        /* Binary operators in order of decreasing precedence.  */
        | simp_exp '^' simp_exp
        | simp_exp '*' simp_exp
        | simp_exp '/' simp_exp
        | simp_exp '%' simp_exp
        | simp_exp '+' simp_exp
        | simp_exp '-' simp_exp
        | variable INCREMENT
        | variable DECREMENT
        ;

non_post_simp_exp
        : '!' simp_exp %prec UNARY
        | '(' exp r_paren
        | LEX_BUILTIN
          '(' opt_expression_list r_paren
        | LEX_LENGTH '(' opt_expression_list r_paren
        | LEX_LENGTH
        | FUNC_CALL '(' opt_expression_list r_paren
        | variable
        | INCREMENT variable
        | DECREMENT variable
        | YNUMBER
        | YSTRING
        | '-' simp_exp    %prec UNARY
        | '+' simp_exp    %prec UNARY
        ;

opt_variable
        : /* empty */
        | variable
        ;

variable
        : NAME
        | NAME '[' expression_list ']'
        | '$' non_post_simp_exp
        ;

l_brace
        : '{' opt_nls
        ;

r_brace
        : '}' opt_nls
        ;

r_paren
        : ')'
        ;

opt_semi
        : /* empty */
        | semi
        ;

semi
        : ';'
        ;

comma   : ',' opt_nls
        ;
]],

dnl INPUT
dnl
dnl For example, in AWK:
dnl
dnl   getline $!4*0;
dnl
dnl The grammar below (from GNU AWK 3.1.0) using canonical LR(1) or IELR(1)
dnl parses it as:
dnl
dnl   getline $!(4*0);
dnl
dnl That is, they shift '*' immediately and make it part of the getline
dnl argument.
dnl
dnl The grammar below using LALR(1) parses it as a syntax error.  So does
dnl GNU AWK 3.0.6, 3.1.0, and 3.1.1.  They reduce the full getline expression
dnl before shifting '*' even though '*' is not a valid lookahead.
dnl
dnl GNU AWK 3.1.2, 3.1.3, 3.1.4, and 3.1.5 parse it as:
dnl
dnl   (getline $!4)*0;
dnl
dnl That is, like the other versions of GNU AWK, they reduce the full getline
dnl expression before shifting '*'.  However, because of a different LHS on the
dnl getline rule, '*' actually is a valid lookahead.  Solaris /usr/xpg4/bin/awk
dnl and the Open Group awk specification seem to agree:
dnl
dnl   https://pubs.opengroup.org/onlinepubs/9699919799/utilities/awk.html
dnl
dnl /bin/nawk and /bin/awk on Solaris 10 report it as a syntax error, but they
dnl don't like even 'print $!4;'.
[[LEX_GETLINE, '$', '!', YNUMBER, '*', YNUMBER, ';']],

dnl BISON-STDERR
[[input.y:66.10: warning: empty rule without %empty [-Wempty-rule]
input.y:170.10: warning: empty rule without %empty [-Wempty-rule]
input.y:175.10: warning: empty rule without %empty [-Wempty-rule]
input.y:180.10: warning: empty rule without %empty [-Wempty-rule]
input.y:188.10: warning: empty rule without %empty [-Wempty-rule]
input.y:202.10: warning: empty rule without %empty [-Wempty-rule]
input.y:207.10: warning: empty rule without %empty [-Wempty-rule]
input.y:221.10: warning: empty rule without %empty [-Wempty-rule]
input.y:300.10: warning: empty rule without %empty [-Wempty-rule]
input.y:323.10: warning: empty rule without %empty [-Wempty-rule]
]AT_COND_CASE([[canonical LR]],
[[input.y: warning: 265 shift/reduce conflicts [-Wconflicts-sr]]],
[[input.y: warning: 65 shift/reduce conflicts [-Wconflicts-sr]]])[
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
input.y:39.1-5: warning: useless associativity for FUNC_CALL, use %precedence [-Wprecedence]
input.y:44.1-5: warning: useless associativity for YNUMBER, use %precedence [-Wprecedence]
input.y:44.1-5: warning: useless associativity for YSTRING, use %precedence [-Wprecedence]
input.y:42.1-9: warning: useless precedence and associativity for APPEND_OP [-Wprecedence]
input.y:33.1-6: warning: useless associativity for ASSIGNOP, use %precedence [-Wprecedence]
input.y:43.1-5: warning: useless associativity for CONCAT_OP, use %precedence [-Wprecedence]
input.y:37.1-5: warning: useless precedence and associativity for LEX_GETLINE [-Wprecedence]
input.y:38.1-9: warning: useless associativity for LEX_IN, use %precedence [-Wprecedence]
input.y:49.1-5: warning: useless associativity for INCREMENT, use %precedence [-Wprecedence]
input.y:49.1-5: warning: useless associativity for DECREMENT, use %precedence [-Wprecedence]
input.y:39.1-5: warning: useless associativity for LEX_BUILTIN, use %precedence [-Wprecedence]
input.y:39.1-5: warning: useless associativity for LEX_LENGTH, use %precedence [-Wprecedence]
input.y:40.1-9: warning: useless precedence and associativity for ',' [-Wprecedence]
input.y:47.1-6: warning: useless associativity for '!', use %precedence [-Wprecedence]
input.y:47.1-6: warning: useless associativity for UNARY, use %precedence [-Wprecedence]
input.y:50.1-5: warning: useless associativity for '$', use %precedence [-Wprecedence]
input.y:51.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence]
input.y:51.1-5: warning: useless precedence and associativity for ')' [-Wprecedence]
input.y: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
]],

dnl LAST-STATE
[AT_COND_CASE([[LALR]], [[319]], [[canonical LR]], [[2358]], [[328]])],

dnl LALR1-DIFF not used for canonical LR(1) because the diff is huge.
dnl Isocore map from LALR(1) state number to new state number plus descriptions
dnl of any change in the actions resulting in a change in accepted language:
dnl   - 24 -> 320
dnl   - 16 -> 321
dnl   - 17 -> 322
dnl   - 20 -> 323
dnl   - 21 -> 324
dnl   - 54 -> 325
dnl   - 56 -> 326: reduce -> shift on '*', '/', and '%'
dnl   - 58 -> 327: reduce -> shift on '*', '/', and '%'
dnl   - 61 -> 328: reduce -> shift on '*', '/', and '%'
[AT_COND_CASE([[LALR]], [],
[[@@ -747,7 +747,7 @@
   156         | . '$' non_post_simp_exp

     NAME  shift, and go to state 9
-    '$'   shift, and go to state 24
+    '$'   shift, and go to state 320

     NAME      [reduce using rule 152 (opt_variable)]
     '$'       [reduce using rule 152 (opt_variable)]
@@ -5414,7 +5414,7 @@
   156         | . '$' non_post_simp_exp

     NAME  shift, and go to state 9
-    '$'   shift, and go to state 24
+    '$'   shift, and go to state 320

     NAME      [reduce using rule 152 (opt_variable)]
     '$'       [reduce using rule 152 (opt_variable)]
@@ -5434,7 +5434,7 @@
   156         | . '$' non_post_simp_exp

     NAME  shift, and go to state 9
-    '$'   shift, and go to state 24
+    '$'   shift, and go to state 320

     NAME      [reduce using rule 152 (opt_variable)]
     '$'       [reduce using rule 152 (opt_variable)]
@@ -6249,7 +6249,7 @@
   156         | . '$' non_post_simp_exp

     NAME  shift, and go to state 9
-    '$'   shift, and go to state 24
+    '$'   shift, and go to state 320

     NAME      [reduce using rule 152 (opt_variable)]
     '$'       [reduce using rule 152 (opt_variable)]
@@ -11134,3 +11134,274 @@
    45 statement: LEX_FOR '(' opt_exp semi opt_nls exp semi opt_nls opt_exp r_paren opt_nls statement .

     $default  reduce using rule 45 (statement)
+
+
+State 320
+
+  139 non_post_simp_exp: . '!' simp_exp
+  140                  | . '(' exp r_paren
+  141                  | . LEX_BUILTIN '(' opt_expression_list r_paren
+  142                  | . LEX_LENGTH '(' opt_expression_list r_paren
+  143                  | . LEX_LENGTH
+  144                  | . FUNC_CALL '(' opt_expression_list r_paren
+  145                  | . variable
+  146                  | . INCREMENT variable
+  147                  | . DECREMENT variable
+  148                  | . YNUMBER
+  149                  | . YSTRING
+  150                  | . '-' simp_exp
+  151                  | . '+' simp_exp
+  154 variable: . NAME
+  155         | . NAME '[' expression_list ']'
+  156         | . '$' non_post_simp_exp
+  156         | '$' . non_post_simp_exp
+
+    FUNC_CALL    shift, and go to state 8
+    NAME         shift, and go to state 9
+    YNUMBER      shift, and go to state 10
+    YSTRING      shift, and go to state 11
+    INCREMENT    shift, and go to state 321
+    DECREMENT    shift, and go to state 322
+    LEX_BUILTIN  shift, and go to state 18
+    LEX_LENGTH   shift, and go to state 19
+    '+'          shift, and go to state 323
+    '-'          shift, and go to state 324
+    '!'          shift, and go to state 325
+    '$'          shift, and go to state 320
+    '('          shift, and go to state 55
+
+    non_post_simp_exp  go to state 62
+    variable           go to state 63
+
+
+State 321
+
+  146 non_post_simp_exp: INCREMENT . variable
+  154 variable: . NAME
+  155         | . NAME '[' expression_list ']'
+  156         | . '$' non_post_simp_exp
+
+    NAME  shift, and go to state 9
+    '$'   shift, and go to state 320
+
+    variable  go to state 50
+
+
+State 322
+
+  147 non_post_simp_exp: DECREMENT . variable
+  154 variable: . NAME
+  155         | . NAME '[' expression_list ']'
+  156         | . '$' non_post_simp_exp
+
+    NAME  shift, and go to state 9
+    '$'   shift, and go to state 320
+
+    variable  go to state 51
+
+
+State 323
+
+  130 simp_exp: . non_post_simp_exp
+  131         | . simp_exp '^' simp_exp
+  132         | . simp_exp '*' simp_exp
+  133         | . simp_exp '/' simp_exp
+  134         | . simp_exp '%' simp_exp
+  135         | . simp_exp '+' simp_exp
+  136         | . simp_exp '-' simp_exp
+  137         | . variable INCREMENT
+  138         | . variable DECREMENT
+  139 non_post_simp_exp: . '!' simp_exp
+  140                  | . '(' exp r_paren
+  141                  | . LEX_BUILTIN '(' opt_expression_list r_paren
+  142                  | . LEX_LENGTH '(' opt_expression_list r_paren
+  143                  | . LEX_LENGTH
+  144                  | . FUNC_CALL '(' opt_expression_list r_paren
+  145                  | . variable
+  146                  | . INCREMENT variable
+  147                  | . DECREMENT variable
+  148                  | . YNUMBER
+  149                  | . YSTRING
+  150                  | . '-' simp_exp
+  151                  | . '+' simp_exp
+  151                  | '+' . simp_exp
+  154 variable: . NAME
+  155         | . NAME '[' expression_list ']'
+  156         | . '$' non_post_simp_exp
+
+    FUNC_CALL    shift, and go to state 8
+    NAME         shift, and go to state 9
+    YNUMBER      shift, and go to state 10
+    YSTRING      shift, and go to state 11
+    INCREMENT    shift, and go to state 16
+    DECREMENT    shift, and go to state 17
+    LEX_BUILTIN  shift, and go to state 18
+    LEX_LENGTH   shift, and go to state 19
+    '+'          shift, and go to state 20
+    '-'          shift, and go to state 21
+    '!'          shift, and go to state 54
+    '$'          shift, and go to state 24
+    '('          shift, and go to state 55
+
+    simp_exp           go to state 326
+    non_post_simp_exp  go to state 35
+    variable           go to state 57
+
+
+State 324
+
+  130 simp_exp: . non_post_simp_exp
+  131         | . simp_exp '^' simp_exp
+  132         | . simp_exp '*' simp_exp
+  133         | . simp_exp '/' simp_exp
+  134         | . simp_exp '%' simp_exp
+  135         | . simp_exp '+' simp_exp
+  136         | . simp_exp '-' simp_exp
+  137         | . variable INCREMENT
+  138         | . variable DECREMENT
+  139 non_post_simp_exp: . '!' simp_exp
+  140                  | . '(' exp r_paren
+  141                  | . LEX_BUILTIN '(' opt_expression_list r_paren
+  142                  | . LEX_LENGTH '(' opt_expression_list r_paren
+  143                  | . LEX_LENGTH
+  144                  | . FUNC_CALL '(' opt_expression_list r_paren
+  145                  | . variable
+  146                  | . INCREMENT variable
+  147                  | . DECREMENT variable
+  148                  | . YNUMBER
+  149                  | . YSTRING
+  150                  | . '-' simp_exp
+  150                  | '-' . simp_exp
+  151                  | . '+' simp_exp
+  154 variable: . NAME
+  155         | . NAME '[' expression_list ']'
+  156         | . '$' non_post_simp_exp
+
+    FUNC_CALL    shift, and go to state 8
+    NAME         shift, and go to state 9
+    YNUMBER      shift, and go to state 10
+    YSTRING      shift, and go to state 11
+    INCREMENT    shift, and go to state 16
+    DECREMENT    shift, and go to state 17
+    LEX_BUILTIN  shift, and go to state 18
+    LEX_LENGTH   shift, and go to state 19
+    '+'          shift, and go to state 20
+    '-'          shift, and go to state 21
+    '!'          shift, and go to state 54
+    '$'          shift, and go to state 24
+    '('          shift, and go to state 55
+
+    simp_exp           go to state 327
+    non_post_simp_exp  go to state 35
+    variable           go to state 57
+
+
+State 325
+
+  130 simp_exp: . non_post_simp_exp
+  131         | . simp_exp '^' simp_exp
+  132         | . simp_exp '*' simp_exp
+  133         | . simp_exp '/' simp_exp
+  134         | . simp_exp '%' simp_exp
+  135         | . simp_exp '+' simp_exp
+  136         | . simp_exp '-' simp_exp
+  137         | . variable INCREMENT
+  138         | . variable DECREMENT
+  139 non_post_simp_exp: . '!' simp_exp
+  139                  | '!' . simp_exp
+  140                  | . '(' exp r_paren
+  141                  | . LEX_BUILTIN '(' opt_expression_list r_paren
+  142                  | . LEX_LENGTH '(' opt_expression_list r_paren
+  143                  | . LEX_LENGTH
+  144                  | . FUNC_CALL '(' opt_expression_list r_paren
+  145                  | . variable
+  146                  | . INCREMENT variable
+  147                  | . DECREMENT variable
+  148                  | . YNUMBER
+  149                  | . YSTRING
+  150                  | . '-' simp_exp
+  151                  | . '+' simp_exp
+  154 variable: . NAME
+  155         | . NAME '[' expression_list ']'
+  156         | . '$' non_post_simp_exp
+
+    FUNC_CALL    shift, and go to state 8
+    NAME         shift, and go to state 9
+    YNUMBER      shift, and go to state 10
+    YSTRING      shift, and go to state 11
+    INCREMENT    shift, and go to state 16
+    DECREMENT    shift, and go to state 17
+    LEX_BUILTIN  shift, and go to state 18
+    LEX_LENGTH   shift, and go to state 19
+    '+'          shift, and go to state 20
+    '-'          shift, and go to state 21
+    '!'          shift, and go to state 54
+    '$'          shift, and go to state 24
+    '('          shift, and go to state 55
+
+    simp_exp           go to state 328
+    non_post_simp_exp  go to state 35
+    variable           go to state 57
+
+
+State 326
+
+  131 simp_exp: simp_exp . '^' simp_exp
+  132         | simp_exp . '*' simp_exp
+  133         | simp_exp . '/' simp_exp
+  134         | simp_exp . '%' simp_exp
+  135         | simp_exp . '+' simp_exp
+  136         | simp_exp . '-' simp_exp
+  151 non_post_simp_exp: '+' simp_exp .  [error, FUNC_CALL, NAME, YNUMBER, YSTRING, RELOP, APPEND_OP, MATCHOP, NEWLINE, LEX_IN, LEX_AND, LEX_OR, INCREMENT, DECREMENT, LEX_BUILTIN, LEX_LENGTH, '?', ':', ',', '<', '>', '|', TWOWAYIO, '+', '-', '!', '$', '(', ')', '@:>@', '{', ';']
+
+    '*'  shift, and go to state 89
+    '/'  shift, and go to state 90
+    '%'  shift, and go to state 91
+    '^'  shift, and go to state 92
+
+    $default  reduce using rule 151 (non_post_simp_exp)
+
+    Conflict between rule 151 and token '+' resolved as reduce ('+' < UNARY).
+    Conflict between rule 151 and token '-' resolved as reduce ('-' < UNARY).
+
+
+State 327
+
+  131 simp_exp: simp_exp . '^' simp_exp
+  132         | simp_exp . '*' simp_exp
+  133         | simp_exp . '/' simp_exp
+  134         | simp_exp . '%' simp_exp
+  135         | simp_exp . '+' simp_exp
+  136         | simp_exp . '-' simp_exp
+  150 non_post_simp_exp: '-' simp_exp .  [error, FUNC_CALL, NAME, YNUMBER, YSTRING, RELOP, APPEND_OP, MATCHOP, NEWLINE, LEX_IN, LEX_AND, LEX_OR, INCREMENT, DECREMENT, LEX_BUILTIN, LEX_LENGTH, '?', ':', ',', '<', '>', '|', TWOWAYIO, '+', '-', '!', '$', '(', ')', '@:>@', '{', ';']
+
+    '*'  shift, and go to state 89
+    '/'  shift, and go to state 90
+    '%'  shift, and go to state 91
+    '^'  shift, and go to state 92
+
+    $default  reduce using rule 150 (non_post_simp_exp)
+
+    Conflict between rule 150 and token '+' resolved as reduce ('+' < UNARY).
+    Conflict between rule 150 and token '-' resolved as reduce ('-' < UNARY).
+
+
+State 328
+
+  131 simp_exp: simp_exp . '^' simp_exp
+  132         | simp_exp . '*' simp_exp
+  133         | simp_exp . '/' simp_exp
+  134         | simp_exp . '%' simp_exp
+  135         | simp_exp . '+' simp_exp
+  136         | simp_exp . '-' simp_exp
+  139 non_post_simp_exp: '!' simp_exp .  [error, FUNC_CALL, NAME, YNUMBER, YSTRING, RELOP, APPEND_OP, MATCHOP, NEWLINE, LEX_IN, LEX_AND, LEX_OR, INCREMENT, DECREMENT, LEX_BUILTIN, LEX_LENGTH, '?', ':', ',', '<', '>', '|', TWOWAYIO, '+', '-', '!', '$', '(', ')', '@:>@', '{', ';']
+
+    '*'  shift, and go to state 89
+    '/'  shift, and go to state 90
+    '%'  shift, and go to state 91
+    '^'  shift, and go to state 92
+
+    $default  reduce using rule 139 (non_post_simp_exp)
+
+    Conflict between rule 139 and token '+' resolved as reduce ('+' < UNARY).
+    Conflict between rule 139 and token '-' resolved as reduce ('-' < UNARY).
]])],

dnl OTHER-CHECKS
[],

dnl PARSER-EXIT-VALUE, PARSER-STDOUT, PARSER-STDERR
dnl In the case of the syntax error, the parser recovers, so it returns 0.
[[0]],
[],
[AT_COND_CASE([[LALR]],
[[syntax error, unexpected '*', expecting NEWLINE or '{' or ';'
]])])

## ----------------- ##
## GNU Cim Grammar.  ##
## ----------------- ##

# GNU Cim, the GNU Simula 87 Compiler.

# Bison was once wrong, due to an incorrect computation of the RR conflicts.
# It reported 80 SR && 99 RR conflicts instead of 78/10!!!

AT_TEST_EXISTING_GRAMMAR([[GNU Cim Grammar]],
[[
%token
        HACTIVATE HAFTER /*HAND*/ HARRAY HAT
        HBEFORE HBEGIN HBOOLEAN
        HCHARACTER HCLASS /*HCOMMENT*/ HCONC
        HDELAY HDO
        HELSE HEND HEQ /*HEQV*/ HEXTERNAL
        HFOR
        HGE HGO HGOTO HGT
        HHIDDEN
        HIF /*HIMP*/ HIN HINNER HINSPECT HINTEGER HIS
        HLABEL HLE HLONG HLT
        HNAME HNE HNEW HNONE /*HNOT*/ HNOTEXT
        /*HOR*/ HOTHERWISE
        HPRIOR HPROCEDURE HPROTECTED
        HQUA
        HREACTIVATE HREAL HREF
        HSHORT HSTEP HSWITCH
        HTEXT HTHEN HTHIS HTO
        HUNTIL
        HVALUE HVAR HVIRTUAL
        HWHEN HWHILE

        HASSIGNVALUE HASSIGNREF
        /*HDOT*/ HPAREXPSEPARATOR HLABELSEPARATOR HSTATEMENTSEPARATOR
        HBEGPAR HENDPAR
        HEQR HNER
        HADD HSUB HMUL HDIV HINTDIV HEXP
        HDOTDOTDOT

%token HIDENTIFIER
%token HBOOLEANKONST HINTEGERKONST HCHARACTERKONST
%token HREALKONST
%token HTEXTKONST


%right HASSIGN
%left   HORELSE
%left   HANDTHEN
%left   HEQV
%left   HIMP
%left   HOR
%left   HAND

%left   HNOT

%left HVALRELOPERATOR HREFRELOPERATOR HOBJRELOPERATOR

%left   HCONC

%left HTERMOPERATOR
%left UNEAR
%left HFACTOROPERATOR
%left         HPRIMARYOPERATOR

%left   HQUA

%left   HDOT

%start  MAIN_MODULE
]],
[[
/* GRAMATIKK FOR PROGRAM MODULES */
MAIN_MODULE     :       {}
                        MODULS
                |       error HSTATEMENTSEPARATOR MBEE_DECLSTMS
                ;
EXT_DECLARATION :       HEXTERNAL
                        MBEE_TYPE
                        HPROCEDURE
                                {}
                        EXT_LIST
                |
                        HEXTERNAL
                        HIDENTIFIER
                        HPROCEDURE
                                {}
                        HIDENTIFIER {}
                        EXTERNAL_KIND_ITEM
                |       HEXTERNAL
                        HCLASS
                                {}
                        EXT_LIST

                ;
EXTERNAL_KIND_ITEM:     EXT_IDENT
                        HOBJRELOPERATOR
                                {}
                        MBEE_TYPE HPROCEDURE
                        HIDENTIFIER
                                {}
                        HEADING EMPTY_BLOCK
                                {}
/*              |
                        EXT_IDENT
                                {}
                        MBEE_REST_EXT_LIST
                ;
MBEE_REST_EXT_LIST:     /* EMPTY
                |       HPAREXPSEPARATOR EXT_KIND_LIST
                ;
EXT_KIND_LIST   :       EXT_KIND_ITEM
                |       EXT_KIND_LIST HPAREXPSEPARATOR EXT_KIND_ITEM
                ;
EXT_KIND_ITEM   :       HIDENTIFIER
                        EXT_IDENT
                                {}*/
                ;
EMPTY_BLOCK     :       /*EMPT*/
                |       HBEGIN HEND
                ;
EXT_LIST        :       EXT_ITEM
                |       EXT_LIST HPAREXPSEPARATOR EXT_ITEM
                ;
EXT_ITEM        :       HIDENTIFIER
                        EXT_IDENT
                ;
EXT_IDENT       :       /* EMPTY */
                |       HVALRELOPERATOR {}
                        HTEXTKONST
                ;
/* GRAMATIKK FOR TYPER */
NO_TYPE         :       /*EMPT*/
                ;
MBEE_TYPE       :       NO_TYPE
                |       TYPE
                ;
TYPE            :       HREF HBEGPAR
                        HIDENTIFIER
                                {}
                        HENDPAR
                |       HTEXT
                |       HBOOLEAN
                |       HCHARACTER
                |       HSHORT HINTEGER
                |       HINTEGER
                |       HREAL
                |       HLONG HREAL
                ;

/* GRAMATIKK FOR DEL AV SETNINGER */
MBEE_ELSE_PART  :       /*EMPT*/
/*              |       HELSE
                        HIF
                        EXPRESSION
                        HTHEN   {}
                        BLOCK   {}
                        MBEE_ELSE_PART          {}*/
                |       HELSE   {}
                        BLOCK
                ;
FOR_LIST        :       FOR_LIST_ELEMENT
                |       FOR_LIST_ELEMENT
                        HPAREXPSEPARATOR
                        FOR_LIST
                ;
FOR_LIST_ELEMENT:       EXPRESSION
                        MBEE_F_L_EL_R_PT
                ;
MBEE_F_L_EL_R_PT:       /*EMPT*/
                |       HWHILE
                        EXPRESSION
                |       HSTEP
                        EXPRESSION
                        HUNTIL
                        EXPRESSION
                ;
GOTO            :       HGO
                        HTO
                |       HGOTO
                ;
CONN_STATE_R_PT :       WHEN_CLAUSE_LIST
                |       HDO   {}
                        BLOCK
                ;
WHEN_CLAUSE_LIST:       HWHEN
                        HIDENTIFIER
                        HDO    {}
                        BLOCK
                |       WHEN_CLAUSE_LIST
                        HWHEN
                        HIDENTIFIER
                        HDO    {}
                        BLOCK
                ;
MBEE_OTWI_CLAUS :       /*EMPT*/
                |       HOTHERWISE {}

                        BLOCK
                ;
ACTIVATOR       :       HACTIVATE
                |       HREACTIVATE
                ;
SCHEDULE        :       /*EMPT*/
                |       ATDELAY EXPRESSION      {}
                        PRIOR
                |       BEFOREAFTER             {}
                        EXPRESSION
                ;
ATDELAY         :       HAT
                |       HDELAY
                ;
BEFOREAFTER     :       HBEFORE
                |       HAFTER
                ;
PRIOR           :       /*EMPT*/
                |       HPRIOR
                ;
/* GRAMATIKK FOR SETNINGER OG DEKLARASJONER */
MODULSTATEMENT  :       HWHILE
                        EXPRESSION
                        HDO     {}
                        BLOCK
                |       HIF
                        EXPRESSION
                        HTHEN   {}
                        BLOCK   {}
                        MBEE_ELSE_PART
                |       HFOR
                        HIDENTIFIER
                        HASSIGN {}
                        FOR_LIST
                        HDO     {}
                        BLOCK
                |       GOTO
                        EXPRESSION
                |       HINSPECT
                        EXPRESSION              {}
                        CONN_STATE_R_PT
                                {}
                        MBEE_OTWI_CLAUS
                |       HINNER
                |       HIDENTIFIER
                        HLABELSEPARATOR
                                {}
                        DECLSTATEMENT
                |       EXPRESSION_SIMP
                        HBEGIN
                                {}
                        IMPORT_SPEC_MODULE
                                {}
                        MBEE_DECLSTMS
                        HEND
                |       EXPRESSION_SIMP HBEGIN error HSTATEMENTSEPARATOR
                        MBEE_DECLSTMS HEND
                |       EXPRESSION_SIMP HBEGIN error HEND
                |       EXPRESSION_SIMP
                |       ACTIVATOR EXPRESSION SCHEDULE
                |       HBEGIN
                                {}
                        MBEE_DECLSTMS
                        HEND
                |       MBEE_TYPE HPROCEDURE
                        HIDENTIFIER
                                {}
                        HEADING BLOCK
                |       HIDENTIFIER
                        HCLASS
                        NO_TYPE
                                {}
                        IMPORT_SPEC_MODULE
                        HIDENTIFIER
                                {}
                        HEADING
                        BLOCK
                |       HCLASS
                        NO_TYPE
                        HIDENTIFIER
                                {}
                        HEADING
                        BLOCK
                |       EXT_DECLARATION
                |       /*EMPT*/
                ;
IMPORT_SPEC_MODULE:
                ;
DECLSTATEMENT   :       MODULSTATEMENT
                |       TYPE
                        HIDENTIFIER
                        MBEE_CONSTANT
                        HPAREXPSEPARATOR
                                {}
                        IDENTIFIER_LISTC
                |       TYPE
                        HIDENTIFIER
                        MBEE_CONSTANT
                |       MBEE_TYPE
                        HARRAY  {}
                        ARR_SEGMENT_LIST
                |       HSWITCH
                        HIDENTIFIER
                        HASSIGN {}
                        SWITCH_LIST
                ;
BLOCK           :       DECLSTATEMENT
                |       HBEGIN MBEE_DECLSTMS HEND
                |       HBEGIN error HSTATEMENTSEPARATOR MBEE_DECLSTMS HEND
                |       HBEGIN error HEND
                ;
MBEE_DECLSTMS   :       MBEE_DECLSTMSU
                ;
MBEE_DECLSTMSU  :       DECLSTATEMENT
                |       MBEE_DECLSTMSU
                        HSTATEMENTSEPARATOR
                        DECLSTATEMENT
                ;
MODULS          :       MODULSTATEMENT
                |       MODULS HSTATEMENTSEPARATOR MODULSTATEMENT
                ;
/* GRAMATIKK FOR DEL AV DEKLARASJONER */
ARR_SEGMENT_LIST:       ARR_SEGMENT
                |       ARR_SEGMENT_LIST
                        HPAREXPSEPARATOR
                        ARR_SEGMENT
                ;
ARR_SEGMENT     :       ARRAY_SEGMENT
                        HBEGPAR
                        BAUND_PAIR_LIST HENDPAR
                ;
ARRAY_SEGMENT   :       ARRAY_SEGMENT_EL        {}

                |       ARRAY_SEGMENT_EL
                        HPAREXPSEPARATOR
                        ARRAY_SEGMENT
                ;
ARRAY_SEGMENT_EL:       HIDENTIFIER
                ;
BAUND_PAIR_LIST :       BAUND_PAIR
                |       BAUND_PAIR
                        HPAREXPSEPARATOR
                        BAUND_PAIR_LIST
                ;
BAUND_PAIR      :       EXPRESSION
                        HLABELSEPARATOR
                        EXPRESSION
                ;
SWITCH_LIST     :       EXPRESSION
                |       EXPRESSION
                        HPAREXPSEPARATOR
                        SWITCH_LIST
                ;
HEADING         :       MBEE_FMAL_PAR_P HSTATEMENTSEPARATOR {}
                        MBEE_MODE_PART  {}
                        MBEE_SPEC_PART  {}
                        MBEE_PROT_PART  {}
                        MBEE_VIRT_PART
                ;
MBEE_FMAL_PAR_P :       /*EMPT*/
                |       FMAL_PAR_PART
                ;
FMAL_PAR_PART   :       HBEGPAR NO_TYPE
                        MBEE_LISTV HENDPAR
                ;
MBEE_LISTV      :       /*EMPT*/
                |       LISTV
                ;
LISTV           :       HIDENTIFIER
                |       FPP_CATEG HDOTDOTDOT
                |       HIDENTIFIER     {}
                        HPAREXPSEPARATOR LISTV
                |       FPP_SPEC
                |       FPP_SPEC
                        HPAREXPSEPARATOR LISTV
                ;
FPP_HEADING     :       HBEGPAR NO_TYPE
                        FPP_MBEE_LISTV HENDPAR
                ;
FPP_MBEE_LISTV  :       /*EMPT*/
                |       FPP_LISTV
                ;
FPP_LISTV       :       FPP_CATEG HDOTDOTDOT
                |       FPP_SPEC
                |       FPP_SPEC
                        HPAREXPSEPARATOR LISTV
                ;
FPP_SPEC        :       FPP_CATEG SPECIFIER HIDENTIFIER
                |       FPP_CATEG FPP_PROC_DECL_IN_SPEC
                ;
FPP_CATEG       :       HNAME HLABELSEPARATOR
                |       HVALUE HLABELSEPARATOR
                |       HVAR HLABELSEPARATOR
                |       /*EMPT*/
                ;
FPP_PROC_DECL_IN_SPEC:  MBEE_TYPE HPROCEDURE
                        HIDENTIFIER
                                        {}
                        FPP_HEADING {} { /* Yes, two "final" actions. */ }
                ;
IDENTIFIER_LISTV:       HIDENTIFIER
                |       HDOTDOTDOT
                |       HIDENTIFIER     {}
                        HPAREXPSEPARATOR IDENTIFIER_LISTV
                ;
MBEE_MODE_PART  :       /*EMPT*/
                |       MODE_PART
                ;
MODE_PART       :       NAME_PART
                |       VALUE_PART
                |       VAR_PART
                |       NAME_PART VALUE_PART
                |       VALUE_PART NAME_PART
                |       NAME_PART VAR_PART
                |       VAR_PART NAME_PART
                |       VALUE_PART VAR_PART
                |       VAR_PART VALUE_PART
                |       VAR_PART NAME_PART VALUE_PART
                |       NAME_PART VAR_PART VALUE_PART
                |       NAME_PART VALUE_PART VAR_PART
                |       VAR_PART VALUE_PART NAME_PART
                |       VALUE_PART VAR_PART NAME_PART
                |       VALUE_PART NAME_PART VAR_PART
                ;
NAME_PART       :       HNAME           {}
                        IDENTIFIER_LISTV
                        HSTATEMENTSEPARATOR
                ;
VAR_PART        :       HVAR            {}
                        IDENTIFIER_LISTV
                        HSTATEMENTSEPARATOR
                ;
VALUE_PART      :       HVALUE          {}
                        IDENTIFIER_LISTV HSTATEMENTSEPARATOR
                ;
MBEE_SPEC_PART  :       /*EMPT*/
                |       SPEC_PART
                ;
SPEC_PART       :       ONE_SPEC
                |       SPEC_PART ONE_SPEC
                ;
ONE_SPEC        :       SPECIFIER IDENTIFIER_LIST HSTATEMENTSEPARATOR
                |       NO_TYPE HPROCEDURE HIDENTIFIER HOBJRELOPERATOR
                          {}
                        PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR
                |       FPP_PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR
                |       MBEE_TYPE HPROCEDURE HIDENTIFIER HSTATEMENTSEPARATOR
                |       MBEE_TYPE HPROCEDURE HIDENTIFIER HPAREXPSEPARATOR
                        IDENTIFIER_LIST HSTATEMENTSEPARATOR
                ;
SPECIFIER       :       TYPE
                |       MBEE_TYPE
                        HARRAY
                |       HLABEL
                |       HSWITCH
                ;
PROC_DECL_IN_SPEC:      MBEE_TYPE HPROCEDURE
                        HIDENTIFIER
                                        {}
                        HEADING
                                        {}
                        MBEE_BEGIN_END
                ;
MBEE_BEGIN_END  :       /* EMPTY */
                |       HBEGIN HEND
                ;
MBEE_PROT_PART  :       /*EMPT*/
                |       PROTECTION_PART
                ;
PROTECTION_PART :       PROT_SPECIFIER IDENTIFIER_LIST
                        HSTATEMENTSEPARATOR
                |       PROTECTION_PART  PROT_SPECIFIER
                        IDENTIFIER_LIST HSTATEMENTSEPARATOR
                ;
PROT_SPECIFIER  :       HHIDDEN
                |       HPROTECTED
                |       HHIDDEN
                        HPROTECTED
                |       HPROTECTED
                        HHIDDEN
                ;
MBEE_VIRT_PART  :       /*EMPT*/
                |       VIRTUAL_PART
                ;
VIRTUAL_PART    :       HVIRTUAL
                        HLABELSEPARATOR
                        MBEE_SPEC_PART
                ;
IDENTIFIER_LIST :       HIDENTIFIER
                |       IDENTIFIER_LIST HPAREXPSEPARATOR
                        HIDENTIFIER
                ;
IDENTIFIER_LISTC:       HIDENTIFIER
                        MBEE_CONSTANT
                |       IDENTIFIER_LISTC HPAREXPSEPARATOR
                        HIDENTIFIER
                        MBEE_CONSTANT
                ;
MBEE_CONSTANT   :       /* EMPTY */
                |       HVALRELOPERATOR
                                {}
                        EXPRESSION
                ;

/* GRAMATIKK FOR UTTRYKK */
EXPRESSION      :       EXPRESSION_SIMP
                |       HIF
                        EXPRESSION
                        HTHEN
                        EXPRESSION
                        HELSE
                        EXPRESSION
                ;
EXPRESSION_SIMP :       EXPRESSION_SIMP
                        HASSIGN
                        EXPRESSION
                |

                        EXPRESSION_SIMP
                        HCONC
                        EXPRESSION_SIMP
                |       EXPRESSION_SIMP HOR
                        HELSE
                        EXPRESSION_SIMP
                        %prec HORELSE
                |       EXPRESSION_SIMP HAND
                        HTHEN
                        EXPRESSION_SIMP
                        %prec HANDTHEN
                |       EXPRESSION_SIMP
                        HEQV EXPRESSION_SIMP
                |       EXPRESSION_SIMP
                        HIMP EXPRESSION_SIMP
                |       EXPRESSION_SIMP
                        HOR EXPRESSION_SIMP
                |       EXPRESSION_SIMP
                        HAND EXPRESSION_SIMP
                |       HNOT EXPRESSION_SIMP
                |       EXPRESSION_SIMP
                        HVALRELOPERATOR
                        EXPRESSION_SIMP
                |       EXPRESSION_SIMP
                        HREFRELOPERATOR
                        EXPRESSION_SIMP
                |       EXPRESSION_SIMP
                        HOBJRELOPERATOR
                        EXPRESSION_SIMP
                |       HTERMOPERATOR
                        EXPRESSION_SIMP %prec UNEAR
                |       EXPRESSION_SIMP
                        HTERMOPERATOR
                        EXPRESSION_SIMP
                |       EXPRESSION_SIMP
                        HFACTOROPERATOR
                        EXPRESSION_SIMP
                |       EXPRESSION_SIMP
                        HPRIMARYOPERATOR
                        EXPRESSION_SIMP
                |       HBEGPAR
                        EXPRESSION HENDPAR
                |       HTEXTKONST
                |       HCHARACTERKONST
                |       HREALKONST
                |       HINTEGERKONST
                |       HBOOLEANKONST
                |       HNONE
                |       HIDENTIFIER
                                {}
                        MBEE_ARG_R_PT
                |       HTHIS HIDENTIFIER
                |       HNEW
                        HIDENTIFIER
                        ARG_R_PT
                |       EXPRESSION_SIMP
                        HDOT
                        EXPRESSION_SIMP
                |       EXPRESSION_SIMP
                        HQUA HIDENTIFIER
                ;
ARG_R_PT        :       /*EMPTY*/
                |       HBEGPAR
                        ARGUMENT_LIST HENDPAR
                ;
MBEE_ARG_R_PT   :       /*EMPTY*/
                |       HBEGPAR
                        ARGUMENT_LIST HENDPAR
                ;
ARGUMENT_LIST   :       EXPRESSION
                |       EXPRESSION
                        HPAREXPSEPARATOR
                        ARGUMENT_LIST
                ;
]],

dnl INPUT
[[]],

dnl BISON-STDERR
[[input.y:128.18: warning: empty rule without %empty [-Wempty-rule]
input.y:137.18: warning: empty rule without %empty [-Wempty-rule]
input.y:142.18: warning: empty rule without %empty [-Wempty-rule]
input.y:161.18: warning: empty rule without %empty [-Wempty-rule]
input.y:179.18: warning: empty rule without %empty [-Wempty-rule]
input.y:205.18: warning: empty rule without %empty [-Wempty-rule]
input.y:213.18: warning: empty rule without %empty [-Wempty-rule]
input.y:225.18: warning: empty rule without %empty [-Wempty-rule]
input.y:292.18: warning: empty rule without %empty [-Wempty-rule]
input.y:294.20: warning: empty rule without %empty [-Wempty-rule]
input.y:367.18: warning: empty rule without %empty [-Wempty-rule]
input.y:373.18: warning: empty rule without %empty [-Wempty-rule]
input.y:387.18: warning: empty rule without %empty [-Wempty-rule]
input.y:401.18: warning: empty rule without %empty [-Wempty-rule]
input.y:413.18: warning: empty rule without %empty [-Wempty-rule]
input.y:443.18: warning: empty rule without %empty [-Wempty-rule]
input.y:471.18: warning: empty rule without %empty [-Wempty-rule]
input.y:474.18: warning: empty rule without %empty [-Wempty-rule]
input.y:489.18: warning: empty rule without %empty [-Wempty-rule]
input.y:506.18: warning: empty rule without %empty [-Wempty-rule]
input.y:587.18: warning: empty rule without %empty [-Wempty-rule]
input.y:591.18: warning: empty rule without %empty [-Wempty-rule]
]AT_COND_CASE([[canonical LR]],
[[input.y: warning: 1876 shift/reduce conflicts [-Wconflicts-sr]
input.y: warning: 144 reduce/reduce conflicts [-Wconflicts-rr]]],
[[input.y: warning: 78 shift/reduce conflicts [-Wconflicts-sr]
input.y: warning: 10 reduce/reduce conflicts [-Wconflicts-rr]]])[
input.y: note: rerun with option '-Wcounterexamples' to generate conflict counterexamples
input.y:72.1-5: warning: useless associativity for HQUA, use %precedence [-Wprecedence]
input.y:53.1-6: warning: useless associativity for HASSIGN, use %precedence [-Wprecedence]
input.y:54.1-5: warning: useless associativity for HORELSE, use %precedence [-Wprecedence]
input.y:55.1-5: warning: useless associativity for HANDTHEN, use %precedence [-Wprecedence]
input.y:61.1-5: warning: useless associativity for HNOT, use %precedence [-Wprecedence]
input.y:68.1-5: warning: useless associativity for UNEAR, use %precedence [-Wprecedence]
input.y: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
]],

dnl LAST-STATE
[AT_COND_CASE([[canonical LR]], [[10425]], [[442]])],

dnl LALR1-DIFF not used for canonical LR(1) because the diff is huge.
[],

dnl OTHER-CHECKS
[AT_COND_CASE([[canonical LR]], [[]],
[AT_CHECK([[grep '^State.*conflicts:' input.output]], [[0]],
[[State 64 conflicts: 14 shift/reduce
State 164 conflicts: 1 shift/reduce
State 201 conflicts: 33 shift/reduce, 4 reduce/reduce
State 206 conflicts: 1 shift/reduce
State 240 conflicts: 1 shift/reduce
State 335 conflicts: 9 shift/reduce, 2 reduce/reduce
State 356 conflicts: 1 shift/reduce
State 360 conflicts: 9 shift/reduce, 2 reduce/reduce
State 427 conflicts: 9 shift/reduce, 2 reduce/reduce
]])])])

## -------------------------------- ##
## GNU pic (Groff 1.18.1) Grammar.  ##
## -------------------------------- ##

# GNU pic, part of groff.

# Bison once reported shift/reduce conflicts that it shouldn't have.

AT_TEST_EXISTING_GRAMMAR([[GNU pic (Groff 1.18.1) Grammar]],
[[%define parse.error verbose

%token LABEL
%token VARIABLE
%token NUMBER
%token TEXT
%token COMMAND_LINE
%token DELIMITED
%token ORDINAL
%token TH
%token LEFT_ARROW_HEAD
%token RIGHT_ARROW_HEAD
%token DOUBLE_ARROW_HEAD
%token LAST
%token UP
%token DOWN
%token LEFT
%token RIGHT
%token BOX
%token CIRCLE
%token ELLIPSE
%token ARC
%token LINE
%token ARROW
%token MOVE
%token SPLINE
%token HEIGHT
%token RADIUS
%token WIDTH
%token DIAMETER
%token FROM
%token TO
%token AT
%token WITH
%token BY
%token THEN
%token SOLID
%token DOTTED
%token DASHED
%token CHOP
%token SAME
%token INVISIBLE
%token LJUST
%token RJUST
%token ABOVE
%token BELOW
%token OF
%token THE
%token WAY
%token BETWEEN
%token AND
%token HERE
%token DOT_N
%token DOT_E
%token DOT_W
%token DOT_S
%token DOT_NE
%token DOT_SE
%token DOT_NW
%token DOT_SW
%token DOT_C
%token DOT_START
%token DOT_END
%token DOT_X
%token DOT_Y
%token DOT_HT
%token DOT_WID
%token DOT_RAD
%token SIN
%token COS
%token ATAN2
%token LOG
%token EXP
%token SQRT
%token K_MAX
%token K_MIN
%token INT
%token RAND
%token SRAND
%token COPY
%token THROUGH
%token TOP
%token BOTTOM
%token UPPER
%token LOWER
%token SH
%token PRINT
%token CW
%token CCW
%token FOR
%token DO
%token IF
%token ELSE
%token ANDAND
%token OROR
%token NOTEQUAL
%token EQUALEQUAL
%token LESSEQUAL
%token GREATEREQUAL
%token LEFT_CORNER
%token RIGHT_CORNER
%token NORTH
%token SOUTH
%token EAST
%token WEST
%token CENTER
%token END
%token START
%token RESET
%token UNTIL
%token PLOT
%token THICKNESS
%token FILL
%token COLORED
%token OUTLINED
%token SHADED
%token ALIGNED
%token SPRINTF
%token COMMAND

%left '.'

/* this ensures that plot 17 "%g" parses as (plot 17 "%g") */
%left PLOT
%left TEXT SPRINTF

/* give text adjustments higher precedence than TEXT, so that
box "foo" above ljust == box ("foo" above ljust)
*/

%left LJUST RJUST ABOVE BELOW

%left LEFT RIGHT
/* Give attributes that take an optional expression a higher
precedence than left and right, so that eg 'line chop left'
parses properly. */
%left CHOP SOLID DASHED DOTTED UP DOWN FILL COLORED OUTLINED
%left LABEL

%left VARIABLE NUMBER '(' SIN COS ATAN2 LOG EXP SQRT K_MAX K_MIN INT RAND SRAND LAST
%left ORDINAL HERE '`'

%left BOX CIRCLE ELLIPSE ARC LINE ARROW SPLINE '[' /* ] */

/* these need to be lower than '-' */
%left HEIGHT RADIUS WIDTH DIAMETER FROM TO AT THICKNESS

/* these must have higher precedence than CHOP so that 'label %prec CHOP'
works */
%left DOT_N DOT_E DOT_W DOT_S DOT_NE DOT_SE DOT_NW DOT_SW DOT_C
%left DOT_START DOT_END TOP BOTTOM LEFT_CORNER RIGHT_CORNER
%left UPPER LOWER NORTH SOUTH EAST WEST CENTER START END

%left ','
%left OROR
%left ANDAND
%left EQUALEQUAL NOTEQUAL
%left '<' '>' LESSEQUAL GREATEREQUAL

%left BETWEEN OF
%left AND

%left '+' '-'
%left '*' '/' '%'
%right '!'
%right '^'
]],
[[
top:
        optional_separator
        | element_list
        ;

element_list:
        optional_separator middle_element_list optional_separator
        ;

middle_element_list:
        element
        | middle_element_list separator element
        ;

optional_separator:
        /* empty */
        | separator
        ;

separator:
        ';'
        | separator ';'
        ;

placeless_element:
        VARIABLE '=' any_expr
        | VARIABLE ':' '=' any_expr
        | UP
        | DOWN
        | LEFT
        | RIGHT
        | COMMAND_LINE
        | COMMAND print_args
        | PRINT print_args
        | SH
                {}
          DELIMITED
        | COPY TEXT
        | COPY TEXT THROUGH
                {}
          DELIMITED
                {}
          until
        | COPY THROUGH
                {}
          DELIMITED
                {}
          until
        | FOR VARIABLE '=' expr TO expr optional_by DO
                {}
          DELIMITED
        | simple_if
        | simple_if ELSE
                {}
          DELIMITED
        | reset_variables
        | RESET
        ;

reset_variables:
        RESET VARIABLE
        | reset_variables VARIABLE
        | reset_variables ',' VARIABLE
        ;

print_args:
        print_arg
        | print_args print_arg
        ;

print_arg:
        expr                                                    %prec ','
        | text
        | position                                              %prec ','
        ;

simple_if:
        IF any_expr THEN
                {}
        DELIMITED
        ;

until:
        /* empty */
        | UNTIL TEXT
        ;

any_expr:
        expr
        | text_expr
        ;

text_expr:
        text EQUALEQUAL text
        | text NOTEQUAL text
        | text_expr ANDAND text_expr
        | text_expr ANDAND expr
        | expr ANDAND text_expr
        | text_expr OROR text_expr
        | text_expr OROR expr
        | expr OROR text_expr
        | '!' text_expr
        ;

optional_by:
        /* empty */
        | BY expr
        | BY '*' expr
        ;

element:
        object_spec
        | LABEL ':' optional_separator element
        | LABEL ':' optional_separator position_not_place
        | LABEL ':' optional_separator place
        | '{' {} element_list '}'
                {}
          optional_element
        | placeless_element
        ;

optional_element:
        /* empty */
        | element
        ;

object_spec:
        BOX
        | CIRCLE
        | ELLIPSE
        | ARC
        | LINE
        | ARROW
        | MOVE
        | SPLINE
        | text                                                  %prec TEXT
        | PLOT expr
        | PLOT expr text
        | '['
                {}
          element_list ']'
        | object_spec HEIGHT expr
        | object_spec RADIUS expr
        | object_spec WIDTH expr
        | object_spec DIAMETER expr
        | object_spec expr                                      %prec HEIGHT
        | object_spec UP
        | object_spec UP expr
        | object_spec DOWN
        | object_spec DOWN expr
        | object_spec RIGHT
        | object_spec RIGHT expr
        | object_spec LEFT
        | object_spec LEFT expr
        | object_spec FROM position
        | object_spec TO position
        | object_spec AT position
        | object_spec WITH path
        | object_spec WITH position                             %prec ','
        | object_spec BY expr_pair
        | object_spec THEN
        | object_spec SOLID
        | object_spec DOTTED
        | object_spec DOTTED expr
        | object_spec DASHED
        | object_spec DASHED expr
        | object_spec FILL
        | object_spec FILL expr
        | object_spec SHADED text
        | object_spec COLORED text
        | object_spec OUTLINED text
        | object_spec CHOP
        | object_spec CHOP expr
        | object_spec SAME
        | object_spec INVISIBLE
        | object_spec LEFT_ARROW_HEAD
        | object_spec RIGHT_ARROW_HEAD
        | object_spec DOUBLE_ARROW_HEAD
        | object_spec CW
        | object_spec CCW
        | object_spec text                                      %prec TEXT
        | object_spec LJUST
        | object_spec RJUST
        | object_spec ABOVE
        | object_spec BELOW
        | object_spec THICKNESS expr
        | object_spec ALIGNED
        ;

text:
        TEXT
        | SPRINTF '(' TEXT sprintf_args ')'
        ;

sprintf_args:
        /* empty */
        | sprintf_args ',' expr
        ;

position:
        position_not_place
        | place
        ;

position_not_place:
        expr_pair
        | position '+' expr_pair
        | position '-' expr_pair
        | '(' position ',' position ')'
        | expr between position AND position
        | expr '<' position ',' position '>'
        ;

between:
        BETWEEN
        | OF THE WAY BETWEEN
        ;

expr_pair:
        expr ',' expr
        | '(' expr_pair ')'
        ;

place:
        /* line at A left == line (at A) left */
        label                                                   %prec CHOP
        | label corner
        | corner label
        | corner OF label
        | HERE
        ;

label:
        LABEL
        | nth_primitive
        | label '.' LABEL
        ;

ordinal:
        ORDINAL
        | '`' any_expr TH
        ;

optional_ordinal_last:
        LAST
        | ordinal LAST
        ;

nth_primitive:
        ordinal object_type
        | optional_ordinal_last object_type
        ;

object_type:
        BOX
        | CIRCLE
        | ELLIPSE
        | ARC
        | LINE
        | ARROW
        | SPLINE
        | '[' ']'
        | TEXT
        ;

label_path:
        '.' LABEL
        | label_path '.' LABEL
        ;

relative_path:
        corner                                                  %prec CHOP
        /* give this a lower precedence than LEFT and RIGHT so that
           [A: box] with .A left == [A: box] with (.A left) */
        | label_path                                            %prec TEXT
        | label_path corner
        ;

path:
        relative_path
        | '(' relative_path ',' relative_path ')'
                {}
        /* The rest of these rules are a compatibility sop. */
        | ORDINAL LAST object_type relative_path
        | LAST object_type relative_path
        | ORDINAL object_type relative_path
        | LABEL relative_path
        ;

corner:
        DOT_N
        | DOT_E
        | DOT_W
        | DOT_S
        | DOT_NE
        | DOT_SE
        | DOT_NW
        | DOT_SW
        | DOT_C
        | DOT_START
        | DOT_END
        | TOP
        | BOTTOM
        | LEFT
        | RIGHT
        | UPPER LEFT
        | LOWER LEFT
        | UPPER RIGHT
        | LOWER RIGHT
        | LEFT_CORNER
        | RIGHT_CORNER
        | UPPER LEFT_CORNER
        | LOWER LEFT_CORNER
        | UPPER RIGHT_CORNER
        | LOWER RIGHT_CORNER
        | NORTH
        | SOUTH
        | EAST
        | WEST
        | CENTER
        | START
        | END
        ;

expr:
        VARIABLE
        | NUMBER
        | place DOT_X
        | place DOT_Y
        | place DOT_HT
        | place DOT_WID
        | place DOT_RAD
        | expr '+' expr
        | expr '-' expr
        | expr '*' expr
        | expr '/' expr
        | expr '%' expr
        | expr '^' expr
        | '-' expr                                              %prec '!'
        | '(' any_expr ')'
        | SIN '(' any_expr ')'
        | COS '(' any_expr ')'
        | ATAN2 '(' any_expr ',' any_expr ')'
        | LOG '(' any_expr ')'
        | EXP '(' any_expr ')'
        | SQRT '(' any_expr ')'
        | K_MAX '(' any_expr ',' any_expr ')'
        | K_MIN '(' any_expr ',' any_expr ')'
        | INT '(' any_expr ')'
        | RAND '(' any_expr ')'
        | RAND '(' ')'
        | SRAND '(' any_expr ')'
        | expr '<' expr
        | expr LESSEQUAL expr
        | expr '>' expr
        | expr GREATEREQUAL expr
        | expr EQUALEQUAL expr
        | expr NOTEQUAL expr
        | expr ANDAND expr
        | expr OROR expr
        | '!' expr
        ;
]],

dnl INPUT
dnl
dnl For example, in pic:
dnl
dnl   .PS
dnl   A: circle "A"
dnl   B: A left
dnl   circle "B" at B
dnl   .PE
dnl
dnl Even using groff 1.19.2, the 3rd line above is a syntax error.  Change
dnl "left" to "right", and it still is.  However, add "upper" or "lower" before
dnl "left or "right" and it's accepted to mean ".nw", ".ne", ".sw", or ".se".
dnl (There seem to be no aliases for "north" and "south" that can stand alone
dnl without being followed by "of".)
[[VARIABLE, '=', LABEL, LEFT, DOT_X]],

dnl BISON-STDERR
[[input.y:202.20: warning: empty rule without %empty [-Wempty-rule]
input.y:270.7: warning: empty rule without %empty [-Wempty-rule]
input.y:292.13: warning: empty rule without %empty [-Wempty-rule]
input.y:309.18: warning: empty rule without %empty [-Wempty-rule]
input.y:382.14: warning: empty rule without %empty [-Wempty-rule]
input.y:471.11-48: warning: rule useless in parser due to conflicts [-Wother]
input.y:154.1-5: warning: useless associativity for LABEL, use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for VARIABLE, use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for NUMBER, use %precedence [-Wprecedence]
input.y:141.1-5: warning: useless associativity for TEXT, use %precedence [-Wprecedence]
input.y:157.1-5: warning: useless associativity for ORDINAL, use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for LAST, use %precedence [-Wprecedence]
input.y:153.1-5: warning: useless associativity for UP, use %precedence [-Wprecedence]
input.y:153.1-5: warning: useless associativity for DOWN, use %precedence [-Wprecedence]
input.y:159.1-5: warning: useless associativity for BOX, use %precedence [-Wprecedence]
input.y:159.1-5: warning: useless associativity for CIRCLE, use %precedence [-Wprecedence]
input.y:159.1-5: warning: useless associativity for ELLIPSE, use %precedence [-Wprecedence]
input.y:159.1-5: warning: useless associativity for ARC, use %precedence [-Wprecedence]
input.y:159.1-5: warning: useless associativity for LINE, use %precedence [-Wprecedence]
input.y:159.1-5: warning: useless associativity for ARROW, use %precedence [-Wprecedence]
input.y:159.1-5: warning: useless associativity for SPLINE, use %precedence [-Wprecedence]
input.y:162.1-5: warning: useless associativity for HEIGHT, use %precedence [-Wprecedence]
input.y:162.1-5: warning: useless associativity for RADIUS, use %precedence [-Wprecedence]
input.y:162.1-5: warning: useless associativity for WIDTH, use %precedence [-Wprecedence]
input.y:162.1-5: warning: useless associativity for DIAMETER, use %precedence [-Wprecedence]
input.y:162.1-5: warning: useless associativity for FROM, use %precedence [-Wprecedence]
input.y:162.1-5: warning: useless associativity for TO, use %precedence [-Wprecedence]
input.y:162.1-5: warning: useless associativity for AT, use %precedence [-Wprecedence]
input.y:153.1-5: warning: useless precedence and associativity for SOLID [-Wprecedence]
input.y:153.1-5: warning: useless associativity for DOTTED, use %precedence [-Wprecedence]
input.y:153.1-5: warning: useless associativity for DASHED, use %precedence [-Wprecedence]
input.y:153.1-5: warning: useless associativity for CHOP, use %precedence [-Wprecedence]
input.y:147.1-5: warning: useless precedence and associativity for LJUST [-Wprecedence]
input.y:147.1-5: warning: useless precedence and associativity for RJUST [-Wprecedence]
input.y:147.1-5: warning: useless precedence and associativity for ABOVE [-Wprecedence]
input.y:147.1-5: warning: useless precedence and associativity for BELOW [-Wprecedence]
input.y:176.1-5: warning: useless associativity for OF, use %precedence [-Wprecedence]
input.y:176.1-5: warning: useless associativity for BETWEEN, use %precedence [-Wprecedence]
input.y:177.1-5: warning: useless associativity for AND, use %precedence [-Wprecedence]
input.y:157.1-5: warning: useless associativity for HERE, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_N, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_E, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_W, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_S, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_NE, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_SE, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_NW, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_SW, use %precedence [-Wprecedence]
input.y:166.1-5: warning: useless associativity for DOT_C, use %precedence [-Wprecedence]
input.y:167.1-5: warning: useless associativity for DOT_START, use %precedence [-Wprecedence]
input.y:167.1-5: warning: useless associativity for DOT_END, use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for SIN, use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for COS, use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for ATAN2, use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for LOG, use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for EXP, use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for SQRT, use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for K_MAX, use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for K_MIN, use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for INT, use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for RAND, use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for SRAND, use %precedence [-Wprecedence]
input.y:167.1-5: warning: useless associativity for TOP, use %precedence [-Wprecedence]
input.y:167.1-5: warning: useless associativity for BOTTOM, use %precedence [-Wprecedence]
input.y:168.1-5: warning: useless associativity for UPPER, use %precedence [-Wprecedence]
input.y:168.1-5: warning: useless associativity for LOWER, use %precedence [-Wprecedence]
input.y:167.1-5: warning: useless associativity for LEFT_CORNER, use %precedence [-Wprecedence]
input.y:167.1-5: warning: useless associativity for RIGHT_CORNER, use %precedence [-Wprecedence]
input.y:168.1-5: warning: useless associativity for NORTH, use %precedence [-Wprecedence]
input.y:168.1-5: warning: useless associativity for SOUTH, use %precedence [-Wprecedence]
input.y:168.1-5: warning: useless associativity for EAST, use %precedence [-Wprecedence]
input.y:168.1-5: warning: useless associativity for WEST, use %precedence [-Wprecedence]
input.y:168.1-5: warning: useless associativity for CENTER, use %precedence [-Wprecedence]
input.y:168.1-5: warning: useless associativity for END, use %precedence [-Wprecedence]
input.y:168.1-5: warning: useless associativity for START, use %precedence [-Wprecedence]
input.y:140.1-5: warning: useless associativity for PLOT, use %precedence [-Wprecedence]
input.y:162.1-5: warning: useless associativity for THICKNESS, use %precedence [-Wprecedence]
input.y:153.1-5: warning: useless associativity for FILL, use %precedence [-Wprecedence]
input.y:153.1-5: warning: useless precedence and associativity for COLORED [-Wprecedence]
input.y:153.1-5: warning: useless precedence and associativity for OUTLINED [-Wprecedence]
input.y:141.1-5: warning: useless associativity for SPRINTF, use %precedence [-Wprecedence]
input.y:137.1-5: warning: useless associativity for '.', use %precedence [-Wprecedence]
input.y:156.1-5: warning: useless associativity for '(', use %precedence [-Wprecedence]
input.y:157.1-5: warning: useless associativity for '`', use %precedence [-Wprecedence]
input.y:159.1-5: warning: useless associativity for '@<:@', use %precedence [-Wprecedence]
input.y:170.1-5: warning: useless associativity for ',', use %precedence [-Wprecedence]
input.y:181.1-6: warning: useless associativity for '!', use %precedence [-Wprecedence]
input.y: warning: fix-its can be applied.  Rerun with option '--update'. [-Wother]
]],

dnl LAST-STATE
[AT_COND_CASE([[LALR]], [[422]], [[canonical LR]], [[4833]], [[427]])],

dnl LALR1-DIFF not used for canonical LR(1) because the diff is huge.
dnl Isocore map from LALR(1) state number to new state number plus descriptions
dnl of any change in the actions resulting in a change in accepted language:
dnl   - 102 -> 423: reduce -> shift on LEFT and RIGHT
dnl   - 237 -> 425
dnl   - 266 -> 424
dnl   - 339 -> 426
dnl   - 383 -> 427
[AT_COND_CASE([[LALR]], [],
[[@@ -1249,7 +1249,7 @@
     text_expr              go to state 112
     text                   go to state 113
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -1403,7 +1403,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -1880,7 +1880,7 @@

     text                   go to state 162
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -2073,7 +2073,7 @@
     text_expr              go to state 112
     text                   go to state 113
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -2597,7 +2597,7 @@
     position_not_place     go to state 99
     expr_pair              go to state 191
     place                  go to state 101
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -2758,7 +2758,7 @@
     text_expr              go to state 112
     text                   go to state 113
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -2901,7 +2901,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -3044,7 +3044,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -3282,7 +3282,7 @@

 State 102

-  146 place: label .  [$end, LABEL, VARIABLE, NUMBER, TEXT, ORDINAL, LEFT_ARROW_HEAD, RIGHT_ARROW_HEAD, DOUBLE_ARROW_HEAD, LAST, UP, DOWN, LEFT, RIGHT, HEIGHT, RADIUS, WIDTH, DIAMETER, FROM, TO, AT, WITH, BY, THEN, SOLID, DOTTED, DASHED, CHOP, SAME, INVISIBLE, LJUST, RJUST, ABOVE, BELOW, AND, HERE, DOT_X, DOT_Y, DOT_HT, DOT_WID, DOT_RAD, SIN, COS, ATAN2, LOG, EXP, SQRT, K_MAX, K_MIN, INT, RAND, SRAND, CW, CCW, THICKNESS, FILL, COLORED, OUTLINED, SHADED, ALIGNED, SPRINTF, '(', '`', ',', '>', '+', '-', '!', ';', '}', '@:>@', ')']
+  146 place: label .  [$end, LABEL, VARIABLE, NUMBER, TEXT, ORDINAL, LEFT_ARROW_HEAD, RIGHT_ARROW_HEAD, DOUBLE_ARROW_HEAD, LAST, UP, DOWN, LEFT, RIGHT, HEIGHT, RADIUS, WIDTH, DIAMETER, FROM, TO, AT, WITH, BY, THEN, SOLID, DOTTED, DASHED, CHOP, SAME, INVISIBLE, LJUST, RJUST, ABOVE, BELOW, HERE, DOT_X, DOT_Y, DOT_HT, DOT_WID, DOT_RAD, SIN, COS, ATAN2, LOG, EXP, SQRT, K_MAX, K_MIN, INT, RAND, SRAND, CW, CCW, THICKNESS, FILL, COLORED, OUTLINED, SHADED, ALIGNED, SPRINTF, '(', '`', '+', '-', '!', ';', '}', '@:>@']
   147      | label . corner
   153 label: label . '.' LABEL
   180 corner: . DOT_N
@@ -3671,7 +3671,7 @@
     text_expr              go to state 112
     text                   go to state 113
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -3830,7 +3830,7 @@
     text_expr              go to state 239
     text                   go to state 113
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -4507,7 +4507,7 @@
     $default  reduce using rule 89 (object_spec)

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -4699,7 +4699,7 @@
     $default  reduce using rule 91 (object_spec)

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -4893,7 +4893,7 @@
     $default  reduce using rule 95 (object_spec)

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -5091,7 +5091,7 @@
     $default  reduce using rule 93 (object_spec)

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -5286,7 +5286,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -5429,7 +5429,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -5572,7 +5572,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -5715,7 +5715,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -6501,7 +6501,7 @@

     expr_pair              go to state 280
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -6659,7 +6659,7 @@
     $default  reduce using rule 105 (object_spec)

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -6851,7 +6851,7 @@
     $default  reduce using rule 107 (object_spec)

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -7043,7 +7043,7 @@
     $default  reduce using rule 114 (object_spec)

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -7290,7 +7290,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -7434,7 +7434,7 @@
     $default  reduce using rule 109 (object_spec)

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -7845,12 +7845,12 @@
     position_not_place     go to state 296
     expr_pair              go to state 100
     place                  go to state 297
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
     corner                 go to state 106
-    expr                   go to state 266
+    expr                   go to state 424


 State 165
@@ -8013,7 +8013,7 @@
     text_expr              go to state 112
     text                   go to state 113
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -8198,7 +8198,7 @@
     text_expr              go to state 112
     text                   go to state 113
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -8359,7 +8359,7 @@
     text_expr              go to state 112
     text                   go to state 113
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -8520,7 +8520,7 @@
     text_expr              go to state 112
     text                   go to state 113
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -8681,7 +8681,7 @@
     text_expr              go to state 112
     text                   go to state 113
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -8842,7 +8842,7 @@
     text_expr              go to state 112
     text                   go to state 113
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -9003,7 +9003,7 @@
     text_expr              go to state 112
     text                   go to state 113
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -9164,7 +9164,7 @@
     text_expr              go to state 112
     text                   go to state 113
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -9325,7 +9325,7 @@
     text_expr              go to state 112
     text                   go to state 113
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -9486,7 +9486,7 @@
     text_expr              go to state 112
     text                   go to state 113
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -9649,7 +9649,7 @@
     text_expr              go to state 112
     text                   go to state 113
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -9810,7 +9810,7 @@
     text_expr              go to state 112
     text                   go to state 113
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -9947,7 +9947,7 @@

     $default  reduce using rule 47 (any_expr)

-    between  go to state 237
+    between  go to state 425


 State 193
@@ -10178,7 +10178,7 @@

     expr_pair              go to state 317
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -10324,7 +10324,7 @@

     expr_pair              go to state 318
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -10648,7 +10648,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -10791,7 +10791,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -10934,7 +10934,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -11077,7 +11077,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -11220,7 +11220,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -11363,7 +11363,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -11506,7 +11506,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -11663,7 +11663,7 @@
     position_not_place     go to state 99
     expr_pair              go to state 100
     place                  go to state 101
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -11806,7 +11806,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -11949,7 +11949,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -12092,7 +12092,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -12235,7 +12235,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -12378,7 +12378,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -12521,7 +12521,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -12664,7 +12664,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -12820,12 +12820,12 @@
     position_not_place     go to state 99
     expr_pair              go to state 100
     place                  go to state 101
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
     corner                 go to state 106
-    expr                   go to state 266
+    expr                   go to state 424


 State 238
@@ -12963,7 +12963,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -13186,7 +13186,7 @@
     text_expr              go to state 342
     text                   go to state 113
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -13345,7 +13345,7 @@
     text_expr              go to state 344
     text                   go to state 113
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -13528,7 +13528,7 @@
     text_expr              go to state 348
     text                   go to state 113
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -13687,7 +13687,7 @@
     text_expr              go to state 350
     text                   go to state 113
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -13830,7 +13830,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -14773,7 +14773,7 @@
     position_not_place     go to state 99
     expr_pair              go to state 191
     place                  go to state 101
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -15100,7 +15100,7 @@
     text                   go to state 113
     expr_pair              go to state 365
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -15719,12 +15719,12 @@
     position_not_place     go to state 99
     expr_pair              go to state 100
     place                  go to state 101
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
     corner                 go to state 106
-    expr                   go to state 266
+    expr                   go to state 424


 State 315
@@ -16150,7 +16150,7 @@

     $default  reduce using rule 239 (expr)

-    between  go to state 237
+    between  go to state 425

     Conflict between rule 239 and token OF resolved as shift ('<' < OF).
     Conflict between rule 239 and token BETWEEN resolved as shift ('<' < BETWEEN).
@@ -17260,7 +17260,7 @@
     text_expr              go to state 112
     text                   go to state 113
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -17442,7 +17442,7 @@
     text_expr              go to state 112
     text                   go to state 113
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -17603,7 +17603,7 @@
     text_expr              go to state 112
     text                   go to state 113
     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -17798,12 +17798,12 @@
     position_not_place     go to state 99
     expr_pair              go to state 100
     place                  go to state 101
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
     corner                 go to state 106
-    expr                   go to state 266
+    expr                   go to state 424


 State 383
@@ -18097,7 +18097,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -18247,7 +18247,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -18856,7 +18856,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -19013,7 +19013,7 @@
     '!'           shift, and go to state 94

     place                  go to state 114
-    label                  go to state 102
+    label                  go to state 423
     ordinal                go to state 103
     optional_ordinal_last  go to state 104
     nth_primitive          go to state 105
@@ -19115,3 +19115,440 @@
    29 placeless_element: FOR VARIABLE '=' expr TO expr optional_by DO $@6 DELIMITED .

     $default  reduce using rule 29 (placeless_element)
+
+
+State 423
+
+  146 place: label .  [$end, AND, DOT_X, DOT_Y, DOT_HT, DOT_WID, DOT_RAD, ',', '>', '+', '-', ';', '}', '@:>@', ')']
+  147      | label . corner
+  153 label: label . '.' LABEL
+  180 corner: . DOT_N
+  181       | . DOT_E
+  182       | . DOT_W
+  183       | . DOT_S
+  184       | . DOT_NE
+  185       | . DOT_SE
+  186       | . DOT_NW
+  187       | . DOT_SW
+  188       | . DOT_C
+  189       | . DOT_START
+  190       | . DOT_END
+  191       | . TOP
+  192       | . BOTTOM
+  193       | . LEFT
+  194       | . RIGHT
+  195       | . UPPER LEFT
+  196       | . LOWER LEFT
+  197       | . UPPER RIGHT
+  198       | . LOWER RIGHT
+  199       | . LEFT_CORNER
+  200       | . RIGHT_CORNER
+  201       | . UPPER LEFT_CORNER
+  202       | . LOWER LEFT_CORNER
+  203       | . UPPER RIGHT_CORNER
+  204       | . LOWER RIGHT_CORNER
+  205       | . NORTH
+  206       | . SOUTH
+  207       | . EAST
+  208       | . WEST
+  209       | . CENTER
+  210       | . START
+  211       | . END
+
+    LEFT          shift, and go to state 53
+    RIGHT         shift, and go to state 54
+    DOT_N         shift, and go to state 56
+    DOT_E         shift, and go to state 57
+    DOT_W         shift, and go to state 58
+    DOT_S         shift, and go to state 59
+    DOT_NE        shift, and go to state 60
+    DOT_SE        shift, and go to state 61
+    DOT_NW        shift, and go to state 62
+    DOT_SW        shift, and go to state 63
+    DOT_C         shift, and go to state 64
+    DOT_START     shift, and go to state 65
+    DOT_END       shift, and go to state 66
+    TOP           shift, and go to state 78
+    BOTTOM        shift, and go to state 79
+    UPPER         shift, and go to state 80
+    LOWER         shift, and go to state 81
+    LEFT_CORNER   shift, and go to state 82
+    RIGHT_CORNER  shift, and go to state 83
+    NORTH         shift, and go to state 84
+    SOUTH         shift, and go to state 85
+    EAST          shift, and go to state 86
+    WEST          shift, and go to state 87
+    CENTER        shift, and go to state 88
+    END           shift, and go to state 89
+    START         shift, and go to state 90
+    '.'           shift, and go to state 204
+
+    $default  reduce using rule 146 (place)
+
+    corner  go to state 205
+
+
+State 424
+
+  140 position_not_place: expr . between position AND position
+  141                   | expr . '<' position ',' position '>'
+  142 between: . BETWEEN
+  143        | . OF THE WAY BETWEEN
+  144 expr_pair: expr . ',' expr
+  219 expr: expr . '+' expr
+  220     | expr . '-' expr
+  221     | expr . '*' expr
+  222     | expr . '/' expr
+  223     | expr . '%' expr
+  224     | expr . '^' expr
+  239     | expr . '<' expr
+  240     | expr . LESSEQUAL expr
+  241     | expr . '>' expr
+  242     | expr . GREATEREQUAL expr
+  243     | expr . EQUALEQUAL expr
+  244     | expr . NOTEQUAL expr
+  245     | expr . ANDAND expr
+  246     | expr . OROR expr
+
+    OF            shift, and go to state 220
+    BETWEEN       shift, and go to state 221
+    ANDAND        shift, and go to state 222
+    OROR          shift, and go to state 223
+    NOTEQUAL      shift, and go to state 224
+    EQUALEQUAL    shift, and go to state 225
+    LESSEQUAL     shift, and go to state 226
+    GREATEREQUAL  shift, and go to state 227
+    ','           shift, and go to state 228
+    '<'           shift, and go to state 229
+    '>'           shift, and go to state 230
+    '+'           shift, and go to state 231
+    '-'           shift, and go to state 232
+    '*'           shift, and go to state 233
+    '/'           shift, and go to state 234
+    '%'           shift, and go to state 235
+    '^'           shift, and go to state 236
+
+    between  go to state 425
+
+
+State 425
+
+  134 position: . position_not_place
+  135         | . place
+  136 position_not_place: . expr_pair
+  137                   | . position '+' expr_pair
+  138                   | . position '-' expr_pair
+  139                   | . '(' position ',' position ')'
+  140                   | . expr between position AND position
+  140                   | expr between . position AND position
+  141                   | . expr '<' position ',' position '>'
+  144 expr_pair: . expr ',' expr
+  145          | . '(' expr_pair ')'
+  146 place: . label
+  147      | . label corner
+  148      | . corner label
+  149      | . corner OF label
+  150      | . HERE
+  151 label: . LABEL
+  152      | . nth_primitive
+  153      | . label '.' LABEL
+  154 ordinal: . ORDINAL
+  155        | . '`' any_expr TH
+  156 optional_ordinal_last: . LAST
+  157                      | . ordinal LAST
+  158 nth_primitive: . ordinal object_type
+  159              | . optional_ordinal_last object_type
+  180 corner: . DOT_N
+  181       | . DOT_E
+  182       | . DOT_W
+  183       | . DOT_S
+  184       | . DOT_NE
+  185       | . DOT_SE
+  186       | . DOT_NW
+  187       | . DOT_SW
+  188       | . DOT_C
+  189       | . DOT_START
+  190       | . DOT_END
+  191       | . TOP
+  192       | . BOTTOM
+  193       | . LEFT
+  194       | . RIGHT
+  195       | . UPPER LEFT
+  196       | . LOWER LEFT
+  197       | . UPPER RIGHT
+  198       | . LOWER RIGHT
+  199       | . LEFT_CORNER
+  200       | . RIGHT_CORNER
+  201       | . UPPER LEFT_CORNER
+  202       | . LOWER LEFT_CORNER
+  203       | . UPPER RIGHT_CORNER
+  204       | . LOWER RIGHT_CORNER
+  205       | . NORTH
+  206       | . SOUTH
+  207       | . EAST
+  208       | . WEST
+  209       | . CENTER
+  210       | . START
+  211       | . END
+  212 expr: . VARIABLE
+  213     | . NUMBER
+  214     | . place DOT_X
+  215     | . place DOT_Y
+  216     | . place DOT_HT
+  217     | . place DOT_WID
+  218     | . place DOT_RAD
+  219     | . expr '+' expr
+  220     | . expr '-' expr
+  221     | . expr '*' expr
+  222     | . expr '/' expr
+  223     | . expr '%' expr
+  224     | . expr '^' expr
+  225     | . '-' expr
+  226     | . '(' any_expr ')'
+  227     | . SIN '(' any_expr ')'
+  228     | . COS '(' any_expr ')'
+  229     | . ATAN2 '(' any_expr ',' any_expr ')'
+  230     | . LOG '(' any_expr ')'
+  231     | . EXP '(' any_expr ')'
+  232     | . SQRT '(' any_expr ')'
+  233     | . K_MAX '(' any_expr ',' any_expr ')'
+  234     | . K_MIN '(' any_expr ',' any_expr ')'
+  235     | . INT '(' any_expr ')'
+  236     | . RAND '(' any_expr ')'
+  237     | . RAND '(' ')'
+  238     | . SRAND '(' any_expr ')'
+  239     | . expr '<' expr
+  240     | . expr LESSEQUAL expr
+  241     | . expr '>' expr
+  242     | . expr GREATEREQUAL expr
+  243     | . expr EQUALEQUAL expr
+  244     | . expr NOTEQUAL expr
+  245     | . expr ANDAND expr
+  246     | . expr OROR expr
+  247     | . '!' expr
+
+    LABEL         shift, and go to state 48
+    VARIABLE      shift, and go to state 49
+    NUMBER        shift, and go to state 50
+    ORDINAL       shift, and go to state 51
+    LAST          shift, and go to state 52
+    LEFT          shift, and go to state 53
+    RIGHT         shift, and go to state 54
+    HERE          shift, and go to state 55
+    DOT_N         shift, and go to state 56
+    DOT_E         shift, and go to state 57
+    DOT_W         shift, and go to state 58
+    DOT_S         shift, and go to state 59
+    DOT_NE        shift, and go to state 60
+    DOT_SE        shift, and go to state 61
+    DOT_NW        shift, and go to state 62
+    DOT_SW        shift, and go to state 63
+    DOT_C         shift, and go to state 64
+    DOT_START     shift, and go to state 65
+    DOT_END       shift, and go to state 66
+    SIN           shift, and go to state 67
+    COS           shift, and go to state 68
+    ATAN2         shift, and go to state 69
+    LOG           shift, and go to state 70
+    EXP           shift, and go to state 71
+    SQRT          shift, and go to state 72
+    K_MAX         shift, and go to state 73
+    K_MIN         shift, and go to state 74
+    INT           shift, and go to state 75
+    RAND          shift, and go to state 76
+    SRAND         shift, and go to state 77
+    TOP           shift, and go to state 78
+    BOTTOM        shift, and go to state 79
+    UPPER         shift, and go to state 80
+    LOWER         shift, and go to state 81
+    LEFT_CORNER   shift, and go to state 82
+    RIGHT_CORNER  shift, and go to state 83
+    NORTH         shift, and go to state 84
+    SOUTH         shift, and go to state 85
+    EAST          shift, and go to state 86
+    WEST          shift, and go to state 87
+    CENTER        shift, and go to state 88
+    END           shift, and go to state 89
+    START         shift, and go to state 90
+    '('           shift, and go to state 91
+    '`'           shift, and go to state 92
+    '-'           shift, and go to state 93
+    '!'           shift, and go to state 94
+
+    position               go to state 426
+    position_not_place     go to state 99
+    expr_pair              go to state 100
+    place                  go to state 101
+    label                  go to state 423
+    ordinal                go to state 103
+    optional_ordinal_last  go to state 104
+    nth_primitive          go to state 105
+    corner                 go to state 106
+    expr                   go to state 424
+
+
+State 426
+
+  137 position_not_place: position . '+' expr_pair
+  138                   | position . '-' expr_pair
+  140                   | expr between position . AND position
+
+    AND  shift, and go to state 427
+    '+'  shift, and go to state 197
+    '-'  shift, and go to state 198
+
+
+State 427
+
+  134 position: . position_not_place
+  135         | . place
+  136 position_not_place: . expr_pair
+  137                   | . position '+' expr_pair
+  138                   | . position '-' expr_pair
+  139                   | . '(' position ',' position ')'
+  140                   | . expr between position AND position
+  140                   | expr between position AND . position
+  141                   | . expr '<' position ',' position '>'
+  144 expr_pair: . expr ',' expr
+  145          | . '(' expr_pair ')'
+  146 place: . label
+  147      | . label corner
+  148      | . corner label
+  149      | . corner OF label
+  150      | . HERE
+  151 label: . LABEL
+  152      | . nth_primitive
+  153      | . label '.' LABEL
+  154 ordinal: . ORDINAL
+  155        | . '`' any_expr TH
+  156 optional_ordinal_last: . LAST
+  157                      | . ordinal LAST
+  158 nth_primitive: . ordinal object_type
+  159              | . optional_ordinal_last object_type
+  180 corner: . DOT_N
+  181       | . DOT_E
+  182       | . DOT_W
+  183       | . DOT_S
+  184       | . DOT_NE
+  185       | . DOT_SE
+  186       | . DOT_NW
+  187       | . DOT_SW
+  188       | . DOT_C
+  189       | . DOT_START
+  190       | . DOT_END
+  191       | . TOP
+  192       | . BOTTOM
+  193       | . LEFT
+  194       | . RIGHT
+  195       | . UPPER LEFT
+  196       | . LOWER LEFT
+  197       | . UPPER RIGHT
+  198       | . LOWER RIGHT
+  199       | . LEFT_CORNER
+  200       | . RIGHT_CORNER
+  201       | . UPPER LEFT_CORNER
+  202       | . LOWER LEFT_CORNER
+  203       | . UPPER RIGHT_CORNER
+  204       | . LOWER RIGHT_CORNER
+  205       | . NORTH
+  206       | . SOUTH
+  207       | . EAST
+  208       | . WEST
+  209       | . CENTER
+  210       | . START
+  211       | . END
+  212 expr: . VARIABLE
+  213     | . NUMBER
+  214     | . place DOT_X
+  215     | . place DOT_Y
+  216     | . place DOT_HT
+  217     | . place DOT_WID
+  218     | . place DOT_RAD
+  219     | . expr '+' expr
+  220     | . expr '-' expr
+  221     | . expr '*' expr
+  222     | . expr '/' expr
+  223     | . expr '%' expr
+  224     | . expr '^' expr
+  225     | . '-' expr
+  226     | . '(' any_expr ')'
+  227     | . SIN '(' any_expr ')'
+  228     | . COS '(' any_expr ')'
+  229     | . ATAN2 '(' any_expr ',' any_expr ')'
+  230     | . LOG '(' any_expr ')'
+  231     | . EXP '(' any_expr ')'
+  232     | . SQRT '(' any_expr ')'
+  233     | . K_MAX '(' any_expr ',' any_expr ')'
+  234     | . K_MIN '(' any_expr ',' any_expr ')'
+  235     | . INT '(' any_expr ')'
+  236     | . RAND '(' any_expr ')'
+  237     | . RAND '(' ')'
+  238     | . SRAND '(' any_expr ')'
+  239     | . expr '<' expr
+  240     | . expr LESSEQUAL expr
+  241     | . expr '>' expr
+  242     | . expr GREATEREQUAL expr
+  243     | . expr EQUALEQUAL expr
+  244     | . expr NOTEQUAL expr
+  245     | . expr ANDAND expr
+  246     | . expr OROR expr
+  247     | . '!' expr
+
+    LABEL         shift, and go to state 48
+    VARIABLE      shift, and go to state 49
+    NUMBER        shift, and go to state 50
+    ORDINAL       shift, and go to state 51
+    LAST          shift, and go to state 52
+    LEFT          shift, and go to state 53
+    RIGHT         shift, and go to state 54
+    HERE          shift, and go to state 55
+    DOT_N         shift, and go to state 56
+    DOT_E         shift, and go to state 57
+    DOT_W         shift, and go to state 58
+    DOT_S         shift, and go to state 59
+    DOT_NE        shift, and go to state 60
+    DOT_SE        shift, and go to state 61
+    DOT_NW        shift, and go to state 62
+    DOT_SW        shift, and go to state 63
+    DOT_C         shift, and go to state 64
+    DOT_START     shift, and go to state 65
+    DOT_END       shift, and go to state 66
+    SIN           shift, and go to state 67
+    COS           shift, and go to state 68
+    ATAN2         shift, and go to state 69
+    LOG           shift, and go to state 70
+    EXP           shift, and go to state 71
+    SQRT          shift, and go to state 72
+    K_MAX         shift, and go to state 73
+    K_MIN         shift, and go to state 74
+    INT           shift, and go to state 75
+    RAND          shift, and go to state 76
+    SRAND         shift, and go to state 77
+    TOP           shift, and go to state 78
+    BOTTOM        shift, and go to state 79
+    UPPER         shift, and go to state 80
+    LOWER         shift, and go to state 81
+    LEFT_CORNER   shift, and go to state 82
+    RIGHT_CORNER  shift, and go to state 83
+    NORTH         shift, and go to state 84
+    SOUTH         shift, and go to state 85
+    EAST          shift, and go to state 86
+    WEST          shift, and go to state 87
+    CENTER        shift, and go to state 88
+    END           shift, and go to state 89
+    START         shift, and go to state 90
+    '('           shift, and go to state 91
+    '`'           shift, and go to state 92
+    '-'           shift, and go to state 93
+    '!'           shift, and go to state 94
+
+    position               go to state 402
+    position_not_place     go to state 99
+    expr_pair              go to state 100
+    place                  go to state 101
+    label                  go to state 423
+    ordinal                go to state 103
+    optional_ordinal_last  go to state 104
+    nth_primitive          go to state 105
+    corner                 go to state 106
+    expr                   go to state 424
]])],

dnl OTHER-CHECKS
[],

dnl PARSER-EXIT-VALUE, PARSER-STDOUT, PARSER-STDERR
[AT_COND_CASE([[LALR]], [[1]], [[0]])],
[],
[AT_COND_CASE([[LALR]],
[[syntax error, unexpected LEFT
]])])