1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
|
#line 3 "<stdout>"
#define YY_INT_ALIGNED short int
/* A lexical scanner generated by flex */
#define yy_create_buffer tclscanYY_create_buffer
#define yy_delete_buffer tclscanYY_delete_buffer
#define yy_flex_debug tclscanYY_flex_debug
#define yy_init_buffer tclscanYY_init_buffer
#define yy_flush_buffer tclscanYY_flush_buffer
#define yy_load_buffer_state tclscanYY_load_buffer_state
#define yy_switch_to_buffer tclscanYY_switch_to_buffer
#define yyin tclscanYYin
#define yyleng tclscanYYleng
#define yylex tclscanYYlex
#define yylineno tclscanYYlineno
#define yyout tclscanYYout
#define yyrestart tclscanYYrestart
#define yytext tclscanYYtext
#define yywrap tclscanYYwrap
#define yyalloc tclscanYYalloc
#define yyrealloc tclscanYYrealloc
#define yyfree tclscanYYfree
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
#define YY_FLEX_SUBMINOR_VERSION 35
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
/* First, we deal with platform-specific or compiler-specific issues. */
/* begin standard C headers. */
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
/* end standard C headers. */
/* flex integer type definitions */
#ifndef FLEXINT_H
#define FLEXINT_H
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
* if you want the limit (max/min) macros for int types.
*/
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS 1
#endif
#include <inttypes.h>
typedef int8_t flex_int8_t;
typedef uint8_t flex_uint8_t;
typedef int16_t flex_int16_t;
typedef uint16_t flex_uint16_t;
typedef int32_t flex_int32_t;
typedef uint32_t flex_uint32_t;
typedef uint64_t flex_uint64_t;
#else
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
#endif /* ! C99 */
/* Limits of integral types. */
#ifndef INT8_MIN
#define INT8_MIN (-128)
#endif
#ifndef INT16_MIN
#define INT16_MIN (-32767-1)
#endif
#ifndef INT32_MIN
#define INT32_MIN (-2147483647-1)
#endif
#ifndef INT8_MAX
#define INT8_MAX (127)
#endif
#ifndef INT16_MAX
#define INT16_MAX (32767)
#endif
#ifndef INT32_MAX
#define INT32_MAX (2147483647)
#endif
#ifndef UINT8_MAX
#define UINT8_MAX (255U)
#endif
#ifndef UINT16_MAX
#define UINT16_MAX (65535U)
#endif
#ifndef UINT32_MAX
#define UINT32_MAX (4294967295U)
#endif
#endif /* ! FLEXINT_H */
#ifdef __cplusplus
/* The "const" storage-class-modifier is valid. */
#define YY_USE_CONST
#else /* ! __cplusplus */
/* C99 requires __STDC__ to be defined as 1. */
#if defined (__STDC__)
#define YY_USE_CONST
#endif /* defined (__STDC__) */
#endif /* ! __cplusplus */
#ifdef YY_USE_CONST
#define yyconst const
#else
#define yyconst
#endif
/* Returned upon end-of-file. */
#define YY_NULL 0
/* Promotes a possibly negative, possibly signed char to an unsigned
* integer for use as an array index. If the signed char is negative,
* we want to instead treat it as an 8-bit unsigned char, hence the
* double cast.
*/
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
/* Enter a start condition. This macro really ought to take a parameter,
* but we do it the disgusting crufty way forced on us by the ()-less
* definition of BEGIN.
*/
#define BEGIN (yy_start) = 1 + 2 *
/* Translate the current start state into a value that can be later handed
* to BEGIN to return to the state. The YYSTATE alias is for lex
* compatibility.
*/
#define YY_START (((yy_start) - 1) / 2)
#define YYSTATE YY_START
/* Action number for EOF rule of a given start state. */
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
/* Special action meaning "start processing a new file". */
#define YY_NEW_FILE tclscanYYrestart(tclscanYYin )
#define YY_END_OF_BUFFER_CHAR 0
/* Size of default input buffer. */
#ifndef YY_BUF_SIZE
#define YY_BUF_SIZE 262144
#endif
/* The state buf must be large enough to hold one state per character in the main buffer.
*/
#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
#define YY_TYPEDEF_YY_BUFFER_STATE
typedef struct yy_buffer_state *YY_BUFFER_STATE;
#endif
#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
typedef size_t yy_size_t;
#endif
extern yy_size_t tclscanYYleng;
extern FILE *tclscanYYin, *tclscanYYout;
#define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2
/* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
* access to the local variable yy_act. Since yyless() is a macro, it would break
* existing scanners that call yyless() from OUTSIDE tclscanYYlex.
* One obvious solution it to make yy_act a global. I tried that, and saw
* a 5% performance hit in a non-tclscanYYlineno scanner, because yy_act is
* normally declared as a register variable-- so it is not worth it.
*/
#define YY_LESS_LINENO(n) \
do { \
yy_size_t yyl;\
for ( yyl = n; yyl < tclscanYYleng; ++yyl )\
if ( tclscanYYtext[yyl] == '\n' )\
--tclscanYYlineno;\
}while(0)
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
do \
{ \
/* Undo effects of setting up tclscanYYtext. */ \
int yyless_macro_arg = (n); \
YY_LESS_LINENO(yyless_macro_arg);\
*yy_cp = (yy_hold_char); \
YY_RESTORE_YY_MORE_OFFSET \
(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
YY_DO_BEFORE_ACTION; /* set up tclscanYYtext again */ \
} \
while ( 0 )
#define unput(c) yyunput( c, (yytext_ptr) )
#ifndef YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE
struct yy_buffer_state
{
FILE *yy_input_file;
char *yy_ch_buf; /* input buffer */
char *yy_buf_pos; /* current position in input buffer */
/* Size of input buffer in bytes, not including room for EOB
* characters.
*/
yy_size_t yy_buf_size;
/* Number of characters read into yy_ch_buf, not including EOB
* characters.
*/
yy_size_t yy_n_chars;
/* Whether we "own" the buffer - i.e., we know we created it,
* and can realloc() it to grow it, and should free() it to
* delete it.
*/
int yy_is_our_buffer;
/* Whether this is an "interactive" input source; if so, and
* if we're using stdio for input, then we want to use getc()
* instead of fread(), to make sure we stop fetching input after
* each newline.
*/
int yy_is_interactive;
/* Whether we're considered to be at the beginning of a line.
* If so, '^' rules will be active on the next match, otherwise
* not.
*/
int yy_at_bol;
int yy_bs_lineno; /**< The line count. */
int yy_bs_column; /**< The column count. */
/* Whether to try to fill the input buffer when we reach the
* end of it.
*/
int yy_fill_buffer;
int yy_buffer_status;
#define YY_BUFFER_NEW 0
#define YY_BUFFER_NORMAL 1
/* When an EOF's been seen but there's still some text to process
* then we mark the buffer as YY_EOF_PENDING, to indicate that we
* shouldn't try reading from the input source any more. We might
* still have a bunch of tokens to match, though, because of
* possible backing-up.
*
* When we actually see the EOF, we change the status to "new"
* (via tclscanYYrestart()), so that the user can continue scanning by
* just pointing tclscanYYin at a new input file.
*/
#define YY_BUFFER_EOF_PENDING 2
};
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
/* Stack of input buffers. */
static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
/* We provide macros for accessing buffer states in case in the
* future we want to put the buffer states in a more general
* "scanner state".
*
* Returns the top of the stack, or NULL.
*/
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
? (yy_buffer_stack)[(yy_buffer_stack_top)] \
: NULL)
/* Same as previous macro, but useful when we know that the buffer stack is not
* NULL or when we need an lvalue. For internal use only.
*/
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
/* yy_hold_char holds the character lost when tclscanYYtext is formed. */
static char yy_hold_char;
static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
yy_size_t tclscanYYleng;
/* Points to current character in buffer. */
static char *yy_c_buf_p = (char *) 0;
static int yy_init = 0; /* whether we need to initialize */
static int yy_start = 0; /* start state number */
/* Flag which is used to allow tclscanYYwrap()'s to do buffer switches
* instead of setting up a fresh tclscanYYin. A bit of a hack ...
*/
static int yy_did_buffer_switch_on_eof;
void tclscanYYrestart (FILE *input_file );
void tclscanYY_switch_to_buffer (YY_BUFFER_STATE new_buffer );
YY_BUFFER_STATE tclscanYY_create_buffer (FILE *file,int size );
void tclscanYY_delete_buffer (YY_BUFFER_STATE b );
void tclscanYY_flush_buffer (YY_BUFFER_STATE b );
void tclscanYYpush_buffer_state (YY_BUFFER_STATE new_buffer );
void tclscanYYpop_buffer_state (void );
static void tclscanYYensure_buffer_stack (void );
static void tclscanYY_load_buffer_state (void );
static void tclscanYY_init_buffer (YY_BUFFER_STATE b,FILE *file );
#define YY_FLUSH_BUFFER tclscanYY_flush_buffer(YY_CURRENT_BUFFER )
YY_BUFFER_STATE tclscanYY_scan_buffer (char *base,yy_size_t size );
YY_BUFFER_STATE tclscanYY_scan_string (yyconst char *yy_str );
YY_BUFFER_STATE tclscanYY_scan_bytes (yyconst char *bytes,yy_size_t len );
void *tclscanYYalloc (yy_size_t );
void *tclscanYYrealloc (void *,yy_size_t );
void tclscanYYfree (void * );
#define yy_new_buffer tclscanYY_create_buffer
#define yy_set_interactive(is_interactive) \
{ \
if ( ! YY_CURRENT_BUFFER ){ \
tclscanYYensure_buffer_stack (); \
YY_CURRENT_BUFFER_LVALUE = \
tclscanYY_create_buffer(tclscanYYin,YY_BUF_SIZE ); \
} \
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
}
#define yy_set_bol(at_bol) \
{ \
if ( ! YY_CURRENT_BUFFER ){\
tclscanYYensure_buffer_stack (); \
YY_CURRENT_BUFFER_LVALUE = \
tclscanYY_create_buffer(tclscanYYin,YY_BUF_SIZE ); \
} \
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
}
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
/* Begin user sect3 */
#define tclscanYYwrap(n) 1
#define YY_SKIP_YYWRAP
typedef unsigned char YY_CHAR;
FILE *tclscanYYin = (FILE *) 0, *tclscanYYout = (FILE *) 0;
typedef int yy_state_type;
extern int tclscanYYlineno;
int tclscanYYlineno = 1;
extern char *tclscanYYtext;
#define yytext_ptr tclscanYYtext
static yy_state_type yy_get_previous_state (void );
static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
static int yy_get_next_buffer (void );
static void yy_fatal_error (yyconst char msg[] );
/* Done after the current pattern has been matched and before the
* corresponding action - sets up tclscanYYtext.
*/
#define YY_DO_BEFORE_ACTION \
(yytext_ptr) = yy_bp; \
(yytext_ptr) -= (yy_more_len); \
tclscanYYleng = (yy_size_t) (yy_cp - (yytext_ptr)); \
(yy_hold_char) = *yy_cp; \
*yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp;
#define YY_NUM_RULES 55
#define YY_END_OF_BUFFER 56
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
{
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
static yyconst flex_int16_t yy_accept[179] =
{ 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5, 5, 0, 0, 0, 0, 0, 0, 26, 26,
0, 0, 56, 55, 1, 4, 3, 3, 2, 4,
40, 37, 36, 34, 35, 40, 40, 54, 50, 52,
53, 49, 48, 51, 46, 54, 47, 44, 45, 15,
5, 14, 15, 55, 23, 24, 55, 55, 17, 18,
55, 55, 20, 21, 55, 29, 26, 29, 25, 29,
55, 31, 32, 55, 3, 0, 37, 36, 34, 35,
0, 0, 0, 0, 39, 0, 42, 43, 41, 5,
0, 12, 13, 0, 0, 0, 0, 23, 24, 0,
22, 0, 17, 18, 0, 0, 20, 21, 0, 0,
25, 26, 0, 0, 31, 32, 0, 30, 33, 0,
0, 0, 8, 13, 0, 0, 0, 0, 11, 0,
0, 0, 28, 25, 0, 38, 0, 6, 13, 0,
7, 0, 0, 0, 0, 27, 6, 0, 0, 0,
0, 0, 0, 0, 0, 12, 0, 0, 0, 9,
9, 0, 0, 0, 0, 0, 0, 0, 16, 0,
12, 0, 10, 10, 0, 0, 19, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 4, 1, 1, 1, 1,
1, 5, 1, 6, 7, 1, 1, 1, 1, 1,
1, 8, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 9, 10,
1, 1, 1, 11, 12, 13, 14, 15, 16, 1,
1, 1, 17, 1, 1, 1, 18, 19, 20, 1,
1, 21, 1, 22, 1, 23, 1, 1, 1, 1,
24, 25, 26, 1, 1, 1, 27, 28, 29, 30,
31, 1, 1, 1, 32, 1, 1, 1, 33, 34,
35, 1, 1, 36, 1, 37, 1, 38, 1, 1,
1, 1, 39, 1, 40, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1
} ;
static yyconst flex_int32_t yy_meta[41] =
{ 0,
1, 2, 3, 1, 2, 2, 4, 1, 2, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 2, 5, 2, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 2, 2
} ;
static yyconst flex_int16_t yy_base[204] =
{ 0,
0, 0, 126, 112, 0, 8, 32, 70, 108, 147,
14, 22, 19, 27, 35, 42, 44, 51, 57, 63,
73, 77, 107, 615, 615, 615, 80, 91, 615, 100,
615, 116, 615, 615, 99, 96, 89, 615, 615, 615,
615, 615, 615, 615, 615, 3, 615, 615, 615, 615,
38, 615, 119, 83, 615, 132, 134, 87, 615, 124,
151, 136, 615, 139, 157, 88, 161, 615, 84, 4,
142, 615, 166, 171, 175, 81, 0, 615, 615, 183,
75, 187, 59, 60, 615, 16, 615, 615, 615, 48,
194, 615, 198, 200, 223, 259, 206, 615, 210, 213,
615, 202, 615, 217, 225, 229, 615, 236, 239, 8,
0, 245, 241, 250, 615, 254, 256, 615, 615, 0,
261, 264, 615, 268, 273, 287, 291, 297, 615, 299,
301, 304, 615, 306, 311, 615, 320, 615, 334, 336,
615, 338, 344, 340, 347, 615, 615, 363, 368, 370,
353, 379, 383, 386, 397, 213, 394, 399, 414, 615,
278, 408, 420, 434, 423, 439, 441, 451, 615, 455,
294, 457, 615, 325, 460, 462, 615, 615, 493, 498,
503, 508, 513, 518, 523, 528, 533, 538, 543, 547,
549, 554, 559, 564, 569, 574, 579, 584, 589, 594,
599, 604, 609
} ;
static yyconst flex_int16_t yy_def[204] =
{ 0,
179, 179, 180, 180, 181, 181, 182, 182, 183, 183,
184, 184, 185, 185, 186, 186, 187, 187, 188, 188,
189, 189, 178, 178, 178, 178, 178, 178, 178, 178,
178, 178, 178, 178, 178, 190, 178, 178, 178, 178,
178, 178, 178, 178, 178, 191, 178, 178, 178, 178,
178, 178, 192, 193, 178, 193, 193, 194, 178, 194,
194, 195, 178, 195, 195, 196, 196, 178, 196, 196,
197, 178, 197, 197, 178, 178, 32, 178, 178, 178,
178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
192, 178, 192, 198, 192, 192, 193, 178, 193, 193,
178, 194, 178, 194, 194, 195, 178, 195, 195, 196,
196, 196, 199, 197, 178, 197, 197, 178, 178, 200,
192, 198, 178, 198, 201, 198, 192, 192, 178, 194,
195, 199, 178, 199, 199, 178, 201, 178, 201, 201,
178, 192, 192, 194, 195, 178, 178, 192, 192, 194,
195, 192, 192, 194, 195, 202, 192, 194, 195, 178,
202, 192, 194, 195, 192, 194, 195, 192, 178, 195,
203, 195, 178, 203, 195, 195, 178, 0, 178, 178,
178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
178, 178, 178
} ;
static yyconst flex_int16_t yy_nxt[656] =
{ 0,
178, 27, 28, 111, 27, 88, 29, 111, 27, 27,
28, 111, 27, 113, 29, 51, 27, 52, 51, 178,
53, 55, 56, 51, 30, 52, 51, 89, 53, 55,
56, 178, 30, 32, 33, 34, 32, 59, 60, 90,
35, 61, 90, 57, 59, 60, 63, 64, 61, 90,
65, 57, 90, 63, 64, 120, 36, 65, 67, 68,
69, 67, 82, 70, 67, 68, 69, 67, 119, 70,
37, 32, 33, 34, 32, 72, 73, 77, 35, 72,
73, 75, 75, 75, 75, 98, 99, 111, 75, 103,
104, 111, 75, 75, 36, 75, 86, 74, 77, 75,
82, 74, 75, 82, 76, 83, 178, 100, 37, 39,
40, 41, 42, 43, 24, 76, 44, 77, 78, 79,
77, 92, 93, 84, 80, 94, 103, 104, 24, 95,
178, 45, 46, 47, 98, 99, 101, 99, 107, 108,
81, 107, 108, 96, 115, 116, 48, 49, 39, 40,
41, 42, 43, 103, 104, 44, 100, 178, 100, 107,
108, 105, 112, 178, 111, 112, 117, 109, 115, 116,
45, 46, 47, 118, 116, 105, 75, 75, 178, 75,
178, 109, 178, 75, 82, 48, 49, 82, 82, 83,
117, 82, 178, 83, 178, 117, 92, 93, 178, 76,
92, 93, 123, 124, 103, 104, 125, 84, 98, 99,
178, 84, 98, 99, 161, 101, 99, 161, 121, 103,
104, 178, 121, 178, 126, 92, 93, 103, 104, 178,
100, 107, 108, 178, 100, 178, 127, 100, 107, 108,
130, 107, 108, 133, 134, 128, 112, 121, 111, 112,
178, 127, 115, 116, 131, 130, 115, 116, 118, 116,
128, 129, 93, 129, 93, 135, 123, 124, 178, 131,
123, 124, 127, 178, 117, 138, 139, 178, 117, 161,
117, 128, 161, 121, 178, 121, 178, 127, 126, 141,
124, 178, 126, 92, 93, 174, 128, 140, 174, 92,
93, 103, 104, 107, 108, 178, 133, 134, 133, 134,
142, 126, 143, 146, 134, 121, 178, 144, 178, 145,
178, 121, 138, 139, 178, 142, 174, 143, 135, 174,
135, 178, 144, 178, 145, 135, 138, 139, 147, 139,
92, 93, 103, 104, 140, 178, 92, 93, 178, 107,
108, 178, 148, 178, 150, 107, 108, 178, 140, 178,
140, 151, 121, 178, 149, 92, 93, 148, 121, 150,
92, 93, 103, 104, 178, 155, 151, 178, 152, 149,
153, 156, 93, 154, 178, 92, 93, 121, 103, 104,
155, 178, 121, 152, 157, 153, 92, 93, 154, 107,
108, 103, 104, 121, 178, 158, 178, 121, 178, 157,
92, 93, 159, 163, 178, 162, 107, 108, 121, 178,
158, 178, 103, 104, 165, 92, 93, 159, 163, 178,
162, 178, 121, 178, 164, 166, 107, 108, 178, 165,
168, 169, 104, 107, 108, 178, 167, 121, 178, 164,
166, 178, 170, 171, 93, 168, 178, 107, 108, 107,
108, 167, 107, 108, 177, 108, 178, 170, 178, 178,
178, 178, 178, 175, 178, 121, 172, 176, 178, 178,
178, 178, 178, 178, 178, 178, 178, 178, 175, 178,
178, 172, 176, 24, 24, 24, 24, 24, 25, 25,
25, 25, 25, 26, 26, 26, 26, 26, 31, 31,
31, 31, 31, 38, 38, 38, 38, 38, 50, 50,
50, 50, 50, 54, 54, 54, 54, 54, 58, 58,
58, 58, 58, 62, 62, 62, 62, 62, 66, 66,
66, 66, 66, 71, 71, 71, 71, 71, 85, 85,
87, 87, 178, 87, 91, 91, 91, 91, 91, 97,
97, 97, 97, 97, 102, 102, 102, 102, 102, 106,
106, 106, 106, 106, 110, 110, 178, 110, 110, 114,
114, 114, 114, 114, 122, 122, 122, 122, 122, 132,
132, 132, 132, 132, 136, 136, 178, 136, 136, 137,
137, 137, 137, 137, 160, 160, 160, 178, 160, 173,
173, 173, 178, 173, 23, 178, 178, 178, 178, 178,
178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
178, 178, 178, 178, 178
} ;
static yyconst flex_int16_t yy_chk[656] =
{ 0,
0, 5, 5, 111, 5, 46, 5, 70, 5, 6,
6, 110, 6, 70, 6, 11, 6, 11, 11, 0,
11, 13, 13, 12, 5, 12, 12, 46, 12, 14,
14, 0, 6, 7, 7, 7, 7, 15, 15, 51,
7, 15, 51, 13, 16, 16, 17, 17, 16, 90,
17, 14, 90, 18, 18, 86, 7, 18, 19, 19,
19, 19, 84, 19, 20, 20, 20, 20, 83, 20,
7, 8, 8, 8, 8, 21, 21, 81, 8, 22,
22, 27, 27, 76, 27, 54, 54, 69, 27, 58,
58, 66, 28, 28, 8, 28, 37, 21, 36, 28,
35, 22, 30, 35, 27, 35, 23, 54, 8, 9,
9, 9, 9, 9, 4, 28, 9, 32, 32, 32,
32, 53, 53, 35, 32, 53, 60, 60, 3, 53,
0, 9, 9, 9, 56, 56, 57, 57, 62, 62,
32, 64, 64, 53, 71, 71, 9, 9, 10, 10,
10, 10, 10, 61, 61, 10, 56, 0, 57, 65,
65, 61, 67, 0, 67, 67, 71, 65, 73, 73,
10, 10, 10, 74, 74, 61, 75, 75, 0, 75,
0, 65, 0, 75, 80, 10, 10, 80, 82, 80,
73, 82, 0, 82, 0, 74, 91, 91, 0, 75,
93, 93, 94, 94, 102, 102, 94, 80, 97, 97,
0, 82, 99, 99, 156, 100, 100, 156, 91, 104,
104, 0, 93, 0, 94, 95, 95, 105, 105, 0,
97, 106, 106, 0, 99, 0, 95, 100, 108, 108,
105, 109, 109, 113, 113, 95, 112, 95, 112, 112,
0, 95, 114, 114, 109, 105, 116, 116, 117, 117,
95, 96, 96, 121, 121, 113, 122, 122, 0, 109,
124, 124, 96, 0, 114, 125, 125, 0, 116, 161,
117, 96, 161, 96, 0, 121, 0, 96, 122, 126,
126, 0, 124, 127, 127, 171, 96, 125, 171, 128,
128, 130, 130, 131, 131, 0, 132, 132, 134, 134,
127, 126, 128, 135, 135, 127, 0, 130, 0, 131,
0, 128, 137, 137, 0, 127, 174, 128, 132, 174,
134, 0, 130, 0, 131, 135, 139, 139, 140, 140,
142, 142, 144, 144, 137, 0, 143, 143, 0, 145,
145, 0, 142, 0, 144, 151, 151, 0, 139, 0,
140, 145, 142, 0, 143, 148, 148, 142, 143, 144,
149, 149, 150, 150, 0, 151, 145, 0, 148, 143,
149, 152, 152, 150, 0, 153, 153, 148, 154, 154,
151, 0, 149, 148, 153, 149, 157, 157, 150, 155,
155, 158, 158, 152, 0, 154, 0, 153, 0, 153,
162, 162, 155, 158, 0, 157, 159, 159, 157, 0,
154, 0, 163, 163, 162, 165, 165, 155, 158, 0,
157, 0, 162, 0, 159, 163, 164, 164, 0, 162,
165, 166, 166, 167, 167, 0, 164, 165, 0, 159,
163, 0, 167, 168, 168, 165, 0, 170, 170, 172,
172, 164, 175, 175, 176, 176, 0, 167, 0, 0,
0, 0, 0, 172, 0, 168, 170, 175, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 172, 0,
0, 170, 175, 179, 179, 179, 179, 179, 180, 180,
180, 180, 180, 181, 181, 181, 181, 181, 182, 182,
182, 182, 182, 183, 183, 183, 183, 183, 184, 184,
184, 184, 184, 185, 185, 185, 185, 185, 186, 186,
186, 186, 186, 187, 187, 187, 187, 187, 188, 188,
188, 188, 188, 189, 189, 189, 189, 189, 190, 190,
191, 191, 0, 191, 192, 192, 192, 192, 192, 193,
193, 193, 193, 193, 194, 194, 194, 194, 194, 195,
195, 195, 195, 195, 196, 196, 0, 196, 196, 197,
197, 197, 197, 197, 198, 198, 198, 198, 198, 199,
199, 199, 199, 199, 200, 200, 0, 200, 200, 201,
201, 201, 201, 201, 202, 202, 202, 0, 202, 203,
203, 203, 0, 203, 178, 178, 178, 178, 178, 178,
178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
178, 178, 178, 178, 178
} ;
/* Table of booleans, true if rule could match eol. */
static yyconst flex_int32_t yy_rule_can_match_eol[56] =
{ 0,
0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1,
1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0,
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, };
static yy_state_type yy_last_accepting_state;
static char *yy_last_accepting_cpos;
extern int tclscanYY_flex_debug;
int tclscanYY_flex_debug = 0;
/* The intent behind this definition is that it'll catch
* any uses of REJECT which flex missed.
*/
#define REJECT reject_used_but_not_detected
static int yy_more_flag = 0;
static int yy_more_len = 0;
#define yymore() ((yy_more_flag) = 1)
#define YY_MORE_ADJ (yy_more_len)
#define YY_RESTORE_YY_MORE_OFFSET
char *tclscanYYtext;
#line 1 "tclscanner.l"
/*****************************************************************************
* Parser for Tcl subset
*
* Copyright (C) 2010 by Rene Zaumseil
* based on the work of Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
* granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
* Documents produced by Doxygen are derivative works derived from the
* input used in their production; they are not affected by this license.
*
*/
#line 18 "tclscanner.l"
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <ctype.h>
#include "qtbc.h"
#include <qarray.h>
#include <qstack.h>
#include <qregexp.h>
#include <unistd.h>
#include <qfile.h>
#include <qdict.h>
#include "entry.h"
#include "message.h"
#include "config.h"
#include "doxygen.h"
#include "util.h"
#include "defargs.h"
#include "language.h"
#include "commentscan.h"
#include "pre.h"
#include "tclscanner.h"
#include "outputlist.h"
#include "membername.h"
#include "searchindex.h"
#include "commentcnv.h"
#include "bufstr.h"
#include "portable.h"
#include <qstring.h>
#include <qstringlist.h>
#include <qlist.h>
#include <qmap.h>
#include "arguments.h"
#define YY_NEVER_INTERACTIVE 1
#define YY_NO_INPUT 1
#define MAX_INCLUDE_DEPTH 10
//! Application error.
#define tcl_err \
printf("Error %d %s() at line %d! ",__LINE__,tcl.file_name.data(),tclscanYYlineno); \
yy_push_state(ERROR); \
yyless(0); \
printf
//! Application warning.
#define tcl_war \
printf("Warning %d %s() at line %d: ",__LINE__,tcl.file_name.data(),tclscanYYlineno); \
printf
//! Application message.
#define tcl_inf \
if (0) printf("--- %.4d %d@%d: ",__LINE__,tclscanYYlineno,yy_start_stack_ptr) && printf
//! Debug message.
#define D\
if (0) printf("--- %.4d %d@%d: %s\n",__LINE__,tclscanYYlineno,yy_start_stack_ptr,tclscanYYtext);
// BEGIN of copy from tclUtil.c
// - Tcl_Interp removed
// - changes are marked with RZ
// #define's to adapt the code:
#define CONST const
#define UCHAR (unsigned char)
#define TCL_ERROR 1
#define TCL_OK 0
#define ckalloc malloc
#define ckfree free
#define TclCopyAndCollapse(size,src,dest) memcpy(dest,src,size); *(dest+size)=0
int TclFindElement(
CONST char *list, /* Points to the first byte of a string
* containing a Tcl list with zero or more
* elements (possibly in braces). */
int listLength, /* Number of bytes in the list's string. */
CONST char **elementPtr, /* Where to put address of first significant
* character in first element of list. */
CONST char **nextPtr, /* Fill in with location of character just
* after all white space following end of
* argument (next arg or end of list). */
int *sizePtr, /* If non-zero, fill in with size of
* element. */
int *bracePtr) /* If non-zero, fill in with non-zero/zero to
* indicate that arg was/wasn't in braces. */
{
CONST char *p = list;
CONST char *elemStart; /* Points to first byte of first element. */
CONST char *limit; /* Points just after list's last byte. */
int openBraces = 0; /* Brace nesting level during parse. */
int inQuotes = 0;
int size = 0; /* lint. */
//RZ int numChars;
/*
* Skim off leading white space and check for an opening brace or quote.
* We treat embedded NULLs in the list as bytes belonging to a list
* element.
*/
limit = (list + listLength);
while ((p < limit) && (isspace(UCHAR(*p))))
{ /* INTL: ISO space. */
p++;
}
if (p == limit)
{ /* no element found */
elemStart = limit;
goto done;
}
if (*p == '{')
{
openBraces = 1;
p++;
}
else if (*p == '"')
{
inQuotes = 1;
p++;
}
elemStart = p;
if (bracePtr != 0)
{
*bracePtr = openBraces;
}
/*
* Find element's end (a space, close brace, or the end of the string).
*/
while (p < limit)
{
switch (*p)
{
/*
* Open brace: don't treat specially unless the element is in
* braces. In this case, keep a nesting count.
*/
case '{':
if (openBraces != 0)
{
openBraces++;
}
break;
/*
* Close brace: if element is in braces, keep nesting count and
* quit when the last close brace is seen.
*/
case '}':
if (openBraces > 1)
{
openBraces--;
}
else if (openBraces == 1)
{
size = (p - elemStart);
p++;
if ((p >= limit) || isspace(UCHAR(*p)))
{ /* INTL: ISO space. */
goto done;
}
/*
* Garbage after the closing brace; return an error.
*/
return TCL_ERROR;
}
break;
/*
* Backslash: skip over everything up to the end of the backslash
* sequence.
*/
case '\\':
//RZ Tcl_UtfBackslash(p, &numChars, NULL);
//RZ p += (numChars - 1);
p++; //RZ
break;
/*
* Space: ignore if element is in braces or quotes; otherwise
* terminate element.
*/
case ' ':
case '\f':
case '\n':
case '\r':
case '\t':
case '\v':
if ((openBraces == 0) && !inQuotes)
{
size = (p - elemStart);
goto done;
}
break;
/*
* Double-quote: if element is in quotes then terminate it.
*/
case '"':
if (inQuotes)
{
size = (p - elemStart);
p++;
if ((p >= limit) || isspace(UCHAR(*p)))
{ /* INTL: ISO space */
goto done;
}
/*
* Garbage after the closing quote; return an error.
*/
return TCL_ERROR;
}
break;
}
p++;
}
/*
* End of list: terminate element.
*/
if (p == limit)
{
if (openBraces != 0)
{
return TCL_ERROR;
}
else if (inQuotes)
{
return TCL_ERROR;
}
size = (p - elemStart);
}
done:
while ((p < limit) && (isspace(UCHAR(*p))))
{ /* INTL: ISO space. */
p++;
}
*elementPtr = elemStart;
*nextPtr = p;
if (sizePtr != 0)
{
*sizePtr = size;
}
return TCL_OK;
}
int Tcl_SplitList(
CONST char *list, /* Pointer to string with list structure. */
int *argcPtr, /* Pointer to location to fill in with the
* number of elements in the list. */
CONST char ***argvPtr) /* Pointer to place to store pointer to array
* of pointers to list elements. */
{
CONST char **argv, *l, *element;
char *p;
int length, size, i, result, elSize, brace;
/*
* Figure out how much space to allocate. There must be enough space for
* both the array of pointers and also for a copy of the list. To estimate
* the number of pointers needed, count the number of space characters in
* the list.
*/
for (size = 2, l = list; *l != 0; l++)
{
if (isspace(UCHAR(*l)))
{ /* INTL: ISO space. */
size++;
/*
* Consecutive space can only count as a single list delimiter.
*/
while (1)
{
char next = *(l + 1);
if (next == '\0')
{
break;
}
++l;
if (isspace(UCHAR(next)))
{ /* INTL: ISO space. */
continue;
}
break;
}
}
}
length = l - list;
argv = (CONST char **) ckalloc((unsigned)
((size * sizeof(char *)) + length + 1));
for (i = 0, p = ((char *) argv) + size*sizeof(char *);
*list != 0; i++)
{
CONST char *prevList = list;
result = TclFindElement(list, length, &element, &list,
&elSize, &brace);
length -= (list - prevList);
if (result != TCL_OK)
{
ckfree((char *) argv);
return result;
}
if (*element == 0)
{
break;
}
if (i >= size)
{
ckfree((char *) argv);
return TCL_ERROR;
}
argv[i] = p;
if (brace)
{
memcpy(p, element, (size_t) elSize);
p += elSize;
*p = 0;
p++;
}
else
{
TclCopyAndCollapse(elSize, element, p);
p += elSize+1;
}
}
argv[i] = NULL;
*argvPtr = argv;
*argcPtr = i;
return TCL_OK;
}
// END of tclUtil.c
void tcl_split_list(QString &str, QStringList &list)
{
int argc;
const char **argv;
list.clear();
if (str.left(1)=="{" && str.right(1)=="}")
{
str=str.mid(1,str.length()-2);
}
else if (str.left(1)=="\"" && str.right(1)=="\"")
{
str=str.mid(1,str.length()-2);
}
if (Tcl_SplitList(str.ascii(),&argc,&argv) != TCL_OK)
{
list.append(str);
}
else
{
for (int i = 0; i < argc; i++)
{
list.append(argv[i]);
}
ckfree((char *) argv);
}
}
//! Structure containing information about current scan context.
typedef struct
{
char type[2]; // type of scan context: "\"" "{" "[" "?" " "
int line0; // start line of scan context
int line1; // end line of scan context
YY_BUFFER_STATE buffer_state; // value of scan context
QCString ns; // current namespace
Entry *entry_fn; // if set contains the current proc/method/constructor/destructor
Entry *entry_cl; // if set contain the current class
Entry *entry_scan; // current scan entry
Protection protection; // current protections state
QStringList after; // option/value list (options: NULL comment keyword script)
} tcl_scan;
//* Structure containing all internal global variables.
static struct
{
CodeOutputInterface * code; // if set then we are codifying the file
int code_line; // current line of code
int code_linenumbers; // if true create line numbers in code
const char *code_font; // used font to codify
bool config_autobrief; // value of configuration option
QMap<QString,QString> config_subst; // map of configuration option values
QCString input_string; // file contents
int input_position; // position in file
QCString file_name; // name of used file
ParserInterface *this_parser; // myself
int command; // true if command was found
int comment; // set true if comment was scaned
int brace_level; // bookkeeping of braces
int bracket_level; // bookkeeping of brackets
int bracket_quote; // bookkeeping of quotes (toggles)
char word_is; // type of current word: "\"" "{" "[" "?" " "
int line_comment; // line number of comment
int line_commentline; // line number of comment after command
int line_command; // line number of command
int line_body0; // start line of body
int line_body1; // end line of body
QCString string_command; // contain current command
QCString string_commentline; // contain current comment after command
QCString string_commentcodify; // current comment string used in codifying
QCString string_comment; // contain current comment
QCString string_last; // contain last read word or part of word
QCString string; // temporary string value
Entry* entry_main; // top level entry
Entry* entry_file; // entry of current file
Entry* entry_current; // currently used entry
Entry* entry_inside; // contain entry of current scan context
QStringList list_commandwords; // list of command words
QList<tcl_scan> scan; // stack of scan contexts
QAsciiDict<Entry> ns; // all read namespace entries
QAsciiDict<Entry> cl; // all read class entries
QAsciiDict<Entry> fn; // all read function entries
QList<Entry> entry; // list of all created entries, will be deleted after codifying
Protection protection; // current protections state
MemberDef *memberdef; // contain current MemberDef when codifying
} tcl;
// scanner functions
static int yyread(char *buf,int max_size);
static tcl_scan *tcl_scan_start(char type, QString content, QCString ns, Entry *entry_cls, Entry *entry_fn);
static void tcl_scan_end();
static void tcl_comment(int what,const char *text);
static void tcl_word(int what,const char *text);
static void tcl_command(int what,const char *text);
// helper functions
//! Create new entry.
// @return new initialised entry
Entry* tcl_entry_new()
{
Entry *myEntry = new Entry;
myEntry->section = Entry::EMPTY_SEC;
myEntry->name = "";
// myEntry->type = "";
myEntry->brief = "";
// myEntry->doc = "";
myEntry->protection = Public;
// myEntry->mtype = Method;
// myEntry->virt = Normal;
// myEntry->stat = FALSE;
myEntry->fileName = tcl.file_name;
myEntry->lang = SrcLangExt_Tcl;
initGroupInfo(myEntry);
// collect entries
if (tcl.code==NULL)
{
tcl.entry.insert(0,myEntry);
}
return myEntry;
}
//! Set protection level.
void tcl_protection(Entry *entry)
{
if (entry->protection!=Public&&entry->protection!=Protected&&entry->protection!=Private)
{
entry->protection = tcl.protection;
}
if (entry->protection!=Protected&&entry->protection!=Private)
{
entry->protection = Public;
}
}
//! Check name.
// @return 'ns' and 'name' of given current 'ns0' and 'name0'
static void tcl_name(const QCString &ns0, const QCString &name0, QCString &ns, QCString &name)
{
QCString myNm;
int myStart;
if (strncmp(name0.data(),"::",2)==0)
{
myNm = name0.mid(2);
}
else if (ns0.length() && ns0 != " ")
{
myNm = ns0 + "::" + name0;
}
else
{
myNm = name0;
}
myStart = myNm.findRev("::");
if (myStart == -1)
{
ns = "";
name = myNm;
}
else
{
ns = myNm.mid(0,myStart);
name = myNm.mid(myStart+2);
}
}
// Check and return namespace entry.
// @return namespace entry
Entry* tcl_entry_namespace(const QCString ns)
{
Entry *myEntry;
if (ns.length())
{
myEntry = tcl.ns.find(ns);
}
else
{
myEntry = tcl.ns.find("::");
}
if (myEntry == NULL)
{
myEntry = tcl_entry_new();
myEntry->section = Entry::NAMESPACE_SEC;
myEntry->name = ns;
tcl.entry_main->addSubEntry(myEntry);
tcl.ns.insert(ns,myEntry);
}
return myEntry;
}
// Check and return class entry.
// @return class entry
Entry* tcl_entry_class(const QCString cl)
{
Entry *myEntry;
if (!cl.length()) return(NULL);
myEntry = tcl.cl.find(cl);
if (myEntry == NULL)
{
myEntry = tcl_entry_new();
myEntry->section = Entry::CLASS_SEC;
myEntry->name = cl;
tcl.entry_main->addSubEntry(myEntry);
tcl.cl.insert(cl,myEntry);
}
return myEntry;
}
//! Check for keywords.
// @return 1 if keyword and 0 otherwise
static int tcl_keyword(QCString str)
{
static QStringList myList;
static int myInit=1;
if (myInit)
{
// tcl keywords
myList <<"append"<<"apply"<<"array"<<"auto_execok"<<"auto_import"<<"auto_load"<<"auto_mkindex"<<"auto_qualify"<<"auto_reset";
myList <<"binary";
myList <<"catch"<<"cd"<<"close"<<"clock"<<"concat";
myList <<"eof"<<"eval"<<"exec"<<"exit"<<"expr";
myList <<"fblocked"<<"fconfigure"<<"file"<<"fileevent"<<"flush"<<"for"<<"foreach"<<"format";
myList <<"gets"<<"global";
myList <<"http";
myList <<"if"<<"incr"<<"info"<<"interp";
myList <<"join";
myList <<"lappend"<<"lassign"<<"lindex"<<"linsert"<<"llength"<<"load"<<"lrange"<<"lrepeat"<<"lreplace"<<"lreverse"<<"lset";
myList <<"namespace";
myList <<"package"<<"parray"<<"pid"<<"pkg_mkIndex"<<"proc"<<"puts"<<"pwd";
myList <<"registry"<<"rename"<<"return";
myList <<"scan"<<"set"<<"split"<<"string"<<"switch";
myList <<"tclLog"<<"tcl_endOfWord"<<"tcl_findLibrary"<<"tcl_startOfNextWord"<<"tcl_startOfPreviousWord"<<"tcl_wordBreakAfter"<<"tcl_wordBreakBefore"<<"tell"<<"time";
myList <<"unknown"<<"upvar";
myList <<"variable"<<"vwait";
// tk keywords
myList <<"bell"<<"bind"<<"bindtags";
myList <<"clipboard"<<"console"<<"consoleinterp";
myList <<"destroy";
myList <<"event";
myList <<"focus";
myList <<"grid";
myList <<"lower";
myList <<"option";
myList <<"pack"<<"place";
myList <<"raise";
myList <<"send";
myList <<"tkerror"<<"tkwait"<<"tk_bisque"<<"tk_focusNext"<<"tk_focusPrev"<<"tk_focusFollowsMouse"<<"tk_popup"<<"tk_setPalette"<<"tk_textCut"<<"tk_TextCopy"<<"tk_textPaste"<<"chooseColor"<<"tk_chooseColor"<<"tk_chooseDirectory"<<"tk_dialog"<<"tk_getOpenFile"<<"tkDialog"<<"tk_getSaveFile"<<"tk_messageBox";
myList <<"winfo"<<"wm";
myList <<"button"<<"canvas"<<"checkbutton"<<"entry"<<"frame"<<"image"<<"label"<<"labelframe"<<"listbox"<<"menu"<<"menubutton"<<"message"<<"panedwindow"<<"radiobutton"<<"scale"<<"scrollbar"<<"spinbox"<<"toplevel";
myList.sort();
myInit=0;
}
str=str.stripWhiteSpace();
if (str.left(2)=="::") {str=str.mid(2);}
if (myList.findIndex(str) != -1) return(1);
return 0;
}
//! End codifying with special font class.
static void tcl_font_end()
{
if (tcl.code==NULL) return;
if (tcl.code_font)
{
tcl.code->endFontClass();
tcl.code_font=NULL;
}
}
//! Codify 'str' with special font class 's'.
static void tcl_codify(const char *s,char *str)
{
if (tcl.code==NULL||str==NULL) return;
if (s && strcmp(s,"NULL")!=0)
{
tcl_font_end();
tcl.code->startFontClass(s);
tcl.code_font=s;
}
char *p=str,*sp=p;
char c;
bool done=FALSE;
while (!done)
{
sp=p;
while ((c=*p++) && c!='\n') {}
if (c=='\n')
{
tcl.code_line++;
*(p-1)='\0';
tcl.code->codify(sp);
//tcl_font_end();
tcl.code->endCodeLine();
if (tcl.code_linenumbers)
{
if (tcl.code_font!=NULL)
{
tcl.code->endFontClass();
tcl.code->writeLineNumber(0,0,0,tcl.code_line);
tcl.code->startFontClass(tcl.code_font);
}
else
{
tcl.code->writeLineNumber(0,0,0,tcl.code_line);
}
}
}
else
{
tcl.code->codify(sp);
done=TRUE;
}
}
tcl_font_end();
}
#if 0
//! Codify 'str' with special font class 's'.
static void tcl_codify(const char *s,const char *str)
{
if (tcl.code==NULL) return;
char *tmp= (char *) malloc(strlen(str)+1);
strcpy(tmp, str);
tcl_codify(s,tmp);
free(tmp);
}
//! Codify 'str' with special font class 's'.
static void tcl_codify(const char *s,const QString &str)
{
if (tcl.code==NULL) return;
tcl_codify(s,str.utf8());
}
#endif
//! Codify 'str' with special font class 's'.
static void tcl_codify(const char *s,const QCString &str)
{
if (tcl.code==NULL) return;
tcl_codify(s,str.data());
}
static void tcl_codify_cmd(const char *s,int i)
{
tcl_codify(s,(*tcl.list_commandwords.at(i)).utf8());
}
//-----------------------------------------------------------------------------
#undef YY_INPUT
#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size);
//-----------------------------------------------------------------------------
#line 1430 "<stdout>"
#define INITIAL 0
#define ERROR 1
#define TOP 2
#define COMMAND 3
#define WORD 4
#define COMMENT 5
#define COMMENT_NL 6
#define COMMENT_CODE 7
#define COMMENT_VERB 8
#define COMMENTLINE 9
#define COMMENTLINE_NL 10
#ifndef YY_NO_UNISTD_H
/* Special case for "unistd.h", since it is non-ANSI. We include it way
* down here because we want the user's section 1 to have been scanned first.
* The user has a chance to override it with an option.
*/
#include <unistd.h>
#endif
#ifndef YY_EXTRA_TYPE
#define YY_EXTRA_TYPE void *
#endif
static int yy_init_globals (void );
/* Accessor methods to globals.
These are made visible to non-reentrant scanners for convenience. */
int tclscanYYlex_destroy (void );
int tclscanYYget_debug (void );
void tclscanYYset_debug (int debug_flag );
YY_EXTRA_TYPE tclscanYYget_extra (void );
void tclscanYYset_extra (YY_EXTRA_TYPE user_defined );
FILE *tclscanYYget_in (void );
void tclscanYYset_in (FILE * in_str );
FILE *tclscanYYget_out (void );
void tclscanYYset_out (FILE * out_str );
yy_size_t tclscanYYget_leng (void );
char *tclscanYYget_text (void );
int tclscanYYget_lineno (void );
void tclscanYYset_lineno (int line_number );
/* Macros after this point can all be overridden by user definitions in
* section 1.
*/
#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
extern "C" int tclscanYYwrap (void );
#else
extern int tclscanYYwrap (void );
#endif
#endif
static void yyunput (int c,char *buf_ptr );
#ifndef yytext_ptr
static void yy_flex_strncpy (char *,yyconst char *,int );
#endif
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * );
#endif
#ifndef YY_NO_INPUT
#ifdef __cplusplus
static int yyinput (void );
#else
static int input (void );
#endif
#endif
static int yy_start_stack_ptr = 0;
static int yy_start_stack_depth = 0;
static int *yy_start_stack = NULL;
static void yy_push_state (int new_state );
static void yy_pop_state (void );
static int yy_top_state (void );
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#define YY_READ_BUF_SIZE 262144
#endif
/* Copy whatever the last rule matched to the standard output. */
#ifndef ECHO
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
#define ECHO fwrite( tclscanYYtext, tclscanYYleng, 1, tclscanYYout )
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
* is returned in "result".
*/
#ifndef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \
int c = '*'; \
yy_size_t n; \
for ( n = 0; n < max_size && \
(c = getc( tclscanYYin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
if ( c == '\n' ) \
buf[n++] = (char) c; \
if ( c == EOF && ferror( tclscanYYin ) ) \
YY_FATAL_ERROR( "input in flex scanner failed" ); \
result = n; \
} \
else \
{ \
errno=0; \
while ( (result = fread(buf, 1, max_size, tclscanYYin))==0 && ferror(tclscanYYin)) \
{ \
if( errno != EINTR) \
{ \
YY_FATAL_ERROR( "input in flex scanner failed" ); \
break; \
} \
errno=0; \
clearerr(tclscanYYin); \
} \
}\
\
#endif
/* No semi-colon after return; correct usage is to write "yyterminate();" -
* we don't want an extra ';' after the "return" because that will cause
* some compilers to complain about unreachable statements.
*/
#ifndef yyterminate
#define yyterminate() return YY_NULL
#endif
/* Number of entries by which start-condition stack grows. */
#ifndef YY_START_STACK_INCR
#define YY_START_STACK_INCR 25
#endif
/* Report a fatal error. */
#ifndef YY_FATAL_ERROR
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
#endif
/* end tables serialization structures and prototypes */
/* Default declaration of generated scanner - a define so the user can
* easily add parameters.
*/
#ifndef YY_DECL
#define YY_DECL_IS_OURS 1
extern int tclscanYYlex (void);
#define YY_DECL int tclscanYYlex (void)
#endif /* !YY_DECL */
/* Code executed at the beginning of each rule, after tclscanYYtext and tclscanYYleng
* have been set up.
*/
#ifndef YY_USER_ACTION
#define YY_USER_ACTION
#endif
/* Code executed at the end of each rule. */
#ifndef YY_BREAK
#define YY_BREAK break;
#endif
#define YY_RULE_SETUP \
YY_USER_ACTION
/** The main scanner function which does all the work.
*/
YY_DECL
{
register yy_state_type yy_current_state;
register char *yy_cp, *yy_bp;
register int yy_act;
#line 736 "tclscanner.l"
#line 1634 "<stdout>"
if ( !(yy_init) )
{
(yy_init) = 1;
#ifdef YY_USER_INIT
YY_USER_INIT;
#endif
if ( ! (yy_start) )
(yy_start) = 1; /* first start state */
if ( ! tclscanYYin )
tclscanYYin = stdin;
if ( ! tclscanYYout )
tclscanYYout = stdout;
if ( ! YY_CURRENT_BUFFER ) {
tclscanYYensure_buffer_stack ();
YY_CURRENT_BUFFER_LVALUE =
tclscanYY_create_buffer(tclscanYYin,YY_BUF_SIZE );
}
tclscanYY_load_buffer_state( );
}
while ( 1 ) /* loops until end-of-file is reached */
{
(yy_more_len) = 0;
if ( (yy_more_flag) )
{
(yy_more_len) = (yy_c_buf_p) - (yytext_ptr);
(yy_more_flag) = 0;
}
yy_cp = (yy_c_buf_p);
/* Support of tclscanYYtext. */
*yy_cp = (yy_hold_char);
/* yy_bp points to the position in yy_ch_buf of the start of
* the current run.
*/
yy_bp = yy_cp;
yy_current_state = (yy_start);
yy_match:
do
{
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
(yy_last_accepting_cpos) = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 179 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
while ( yy_base[yy_current_state] != 615 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
if ( yy_act == 0 )
{ /* have to back up */
yy_cp = (yy_last_accepting_cpos);
yy_current_state = (yy_last_accepting_state);
yy_act = yy_accept[yy_current_state];
}
YY_DO_BEFORE_ACTION;
if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
{
yy_size_t yyl;
for ( yyl = (yy_more_len); yyl < tclscanYYleng; ++yyl )
if ( tclscanYYtext[yyl] == '\n' )
tclscanYYlineno++;
;
}
do_action: /* This label is used only to access EOF actions. */
switch ( yy_act )
{ /* beginning of action switch */
case 0: /* must back up */
/* undo the effects of YY_DO_BEFORE_ACTION */
*yy_cp = (yy_hold_char);
yy_cp = (yy_last_accepting_cpos);
yy_current_state = (yy_last_accepting_state);
goto yy_find_action;
case 1:
YY_RULE_SETUP
#line 737 "tclscanner.l"
{
D
yyterminate();
}
YY_BREAK
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(ERROR):
case YY_STATE_EOF(TOP):
case YY_STATE_EOF(COMMAND):
case YY_STATE_EOF(WORD):
case YY_STATE_EOF(COMMENT):
case YY_STATE_EOF(COMMENT_NL):
case YY_STATE_EOF(COMMENT_CODE):
case YY_STATE_EOF(COMMENT_VERB):
case YY_STATE_EOF(COMMENTLINE):
case YY_STATE_EOF(COMMENTLINE_NL):
#line 741 "tclscanner.l"
{
D
if (tcl.scan.count()<1)
{// error
D
tcl_err("Tcl parser stack empty! Parser error in file '%s'.\n",tcl.file_name.data());
yyterminate();
}
else if (tcl.scan.count()==1)
{// exit, check on input?
D
yyterminate();
}
else
{// continue
D
tcl_command(-1,"");
tcl_scan_end();
}
}
YY_BREAK
case 2:
YY_RULE_SETUP
#line 761 "tclscanner.l"
{
D
yyless(0);
tcl.line_comment=tclscanYYlineno;
tcl_comment(0,"");
}
YY_BREAK
case 3:
/* rule 3 can match eol */
YY_RULE_SETUP
#line 767 "tclscanner.l"
{
D
tcl_codify(NULL,tclscanYYtext);
}
YY_BREAK
case 4:
YY_RULE_SETUP
#line 771 "tclscanner.l"
{
D
yyless(0);
tcl.line_command=tclscanYYlineno;
tcl_command(0,"");
}
YY_BREAK
case 5:
YY_RULE_SETUP
#line 778 "tclscanner.l"
{
D
tcl_codify("comment",tclscanYYtext);
}
YY_BREAK
case 6:
/* rule 6 can match eol */
YY_RULE_SETUP
#line 782 "tclscanner.l"
{
D
tcl_codify("comment",tclscanYYtext);
tcl_comment(2,tclscanYYtext+1);
}
YY_BREAK
case 7:
/* rule 7 can match eol */
YY_RULE_SETUP
#line 787 "tclscanner.l"
{
D
tcl_codify("comment",tclscanYYtext);
QCString t=tclscanYYtext;
t = t.mid(2,t.length()-3);
t.append("\n");
tcl_comment(1,t.data());
yy_push_state(COMMENT_NL);
}
YY_BREAK
case 8:
/* rule 8 can match eol */
YY_RULE_SETUP
#line 796 "tclscanner.l"
{
D
tcl_codify("comment",tclscanYYtext);
tcl_comment(1,tclscanYYtext+2);
}
YY_BREAK
case 9:
/* rule 9 can match eol */
YY_RULE_SETUP
#line 801 "tclscanner.l"
{
D
QCString t=tclscanYYtext;
tcl_codify("comment",t.left(7));
tcl_comment(2,"\n@code\n");
yyless(7);
yy_push_state(COMMENT_CODE);
}
YY_BREAK
case 10:
/* rule 10 can match eol */
YY_RULE_SETUP
#line 809 "tclscanner.l"
{
D
QCString t=tclscanYYtext;
tcl_codify("comment",t.left(11));
tcl_comment(2,"\n@verbatim\n");
yyless(11);
yy_push_state(COMMENT_VERB);
}
YY_BREAK
case 11:
/* rule 11 can match eol */
YY_RULE_SETUP
#line 817 "tclscanner.l"
{
D
tcl_codify("comment",tclscanYYtext);
QCString t=tclscanYYtext;
t = t.mid(1,t.length()-3);
t.append("\n");
tcl_comment(2,t.data());
yy_push_state(COMMENT_NL);
}
YY_BREAK
case 12:
/* rule 12 can match eol */
YY_RULE_SETUP
#line 826 "tclscanner.l"
{
D
tcl_codify("comment",tclscanYYtext);
tcl_comment(2,tclscanYYtext+1);
}
YY_BREAK
case 13:
YY_RULE_SETUP
#line 831 "tclscanner.l"
{
D
QCString t=tclscanYYtext;
t = t.mid(0,t.length()-1);
tcl_codify("comment",t.data());
t = t.mid(1,t.length());
tcl_comment(-2,t.data());
unput(0x1A);
}
YY_BREAK
case 14:
YY_RULE_SETUP
#line 840 "tclscanner.l"
{
D
tcl_comment(-2,"");
unput(0x1A);
}
YY_BREAK
case 15:
/* rule 15 can match eol */
YY_RULE_SETUP
#line 845 "tclscanner.l"
{
D
tcl_comment(-2,tclscanYYtext);
yyless(0);
}
YY_BREAK
case 16:
/* rule 16 can match eol */
YY_RULE_SETUP
#line 851 "tclscanner.l"
{
D
QCString t=tclscanYYtext;
t = t.left(t.length()-10);
tcl_comment(2,t.data());
tcl_comment(2,"\n@endcode\n");
yy_pop_state();
yyless(0);
}
YY_BREAK
case 17:
/* rule 17 can match eol */
YY_RULE_SETUP
#line 860 "tclscanner.l"
{
D
yymore();
}
YY_BREAK
case 18:
YY_RULE_SETUP
#line 864 "tclscanner.l"
{
D
yy_pop_state();
yyless(0);
}
YY_BREAK
case 19:
/* rule 19 can match eol */
YY_RULE_SETUP
#line 870 "tclscanner.l"
{
D
QCString t=tclscanYYtext;
t = t.left(t.length()-14);
tcl_comment(2,t.data());
tcl_comment(2,"\n@endverbatim\n");
yy_pop_state();
yyless(0);
}
YY_BREAK
case 20:
/* rule 20 can match eol */
YY_RULE_SETUP
#line 879 "tclscanner.l"
{
D
yymore();
}
YY_BREAK
case 21:
YY_RULE_SETUP
#line 883 "tclscanner.l"
{
D
yy_pop_state();
yyless(0);
}
YY_BREAK
case 22:
/* rule 22 can match eol */
YY_RULE_SETUP
#line 889 "tclscanner.l"
{
D
tcl_codify("comment",tclscanYYtext);
tcl_comment(2,tclscanYYtext);
}
YY_BREAK
case 23:
/* rule 23 can match eol */
YY_RULE_SETUP
#line 894 "tclscanner.l"
{
D
tcl_codify("comment",tclscanYYtext);
tcl_comment(2,tclscanYYtext);
yy_pop_state();
}
YY_BREAK
case 24:
YY_RULE_SETUP
#line 900 "tclscanner.l"
{
D
yy_pop_state();
yyless(0);
}
YY_BREAK
case 25:
YY_RULE_SETUP
#line 906 "tclscanner.l"
{
D
yy_pop_state();
yyless(0);
}
YY_BREAK
case 26:
YY_RULE_SETUP
#line 911 "tclscanner.l"
{
D
tcl.string_commentcodify += tclscanYYtext;
}
YY_BREAK
case 27:
/* rule 27 can match eol */
YY_RULE_SETUP
#line 915 "tclscanner.l"
{
D
tcl.string_commentcodify += tclscanYYtext;
QCString t=tclscanYYtext;
t = t.mid(2,t.length()-4);
t.append("\n");
tcl.string_commentline += t;
yy_push_state(COMMENTLINE_NL);
}
YY_BREAK
case 28:
/* rule 28 can match eol */
YY_RULE_SETUP
#line 924 "tclscanner.l"
{
D
tcl.string_commentcodify += tclscanYYtext;
tcl.string_commentline += (tclscanYYtext+2);
}
YY_BREAK
case 29:
/* rule 29 can match eol */
YY_RULE_SETUP
#line 929 "tclscanner.l"
{
D
yy_pop_state();
if (tcl.string_commentline.length())
{
tcl.entry_current->brief = tcl.string_commentline;
tcl.entry_current->briefLine = tcl.line_commentline;
tcl.entry_current->briefFile = tcl.file_name;
}
yyless(0);
tcl_command(-1,tcl.string_commentcodify.data());
tcl.string_commentline="";
tcl.string_commentcodify="";
}
YY_BREAK
case 30:
/* rule 30 can match eol */
YY_RULE_SETUP
#line 944 "tclscanner.l"
{
D
tcl.string_commentcodify += tclscanYYtext;
QCString t=tclscanYYtext;
t = t.left(t.length()-3);
t.append("\n");
tcl.string_commentline += t;
}
YY_BREAK
case 31:
/* rule 31 can match eol */
YY_RULE_SETUP
#line 952 "tclscanner.l"
{
D
tcl.string_commentcodify += tclscanYYtext;
tcl.string_commentline += tclscanYYtext;
yy_pop_state();
}
YY_BREAK
case 32:
YY_RULE_SETUP
#line 958 "tclscanner.l"
{
D
QCString t=tclscanYYtext;
t = t.left(t.length()-1);
tcl.string_commentcodify += t;
tcl.string_commentline += t;
yy_pop_state();
unput(0x1A);
}
YY_BREAK
case 33:
/* rule 33 can match eol */
YY_RULE_SETUP
#line 968 "tclscanner.l"
{
D
tcl.string_commentcodify = tclscanYYtext;
tcl.string_commentcodify = tcl.string_commentcodify.left(tcl.string_commentcodify.length()-2);
tcl.string_commentline = "";
tcl.line_commentline = tclscanYYlineno;
tcl.line_body1=tclscanYYlineno;
unput('<');
unput('#');
yy_push_state(COMMENTLINE);
}
YY_BREAK
case 34:
/* rule 34 can match eol */
YY_RULE_SETUP
#line 979 "tclscanner.l"
{
D
tcl.string_commentcodify = "";
tcl.string_commentline = "";
tcl.line_body1=tclscanYYlineno;
tcl_command(-1,"");
}
YY_BREAK
case 35:
/* rule 35 can match eol */
YY_RULE_SETUP
#line 986 "tclscanner.l"
{
D
tcl.string_commentcodify = "";
tcl.string_commentline = "";
tcl.line_body1=tclscanYYlineno;
tcl_command(-1,tclscanYYtext);
}
YY_BREAK
case 36:
/* rule 36 can match eol */
YY_RULE_SETUP
#line 993 "tclscanner.l"
{
D
tcl.string_commentcodify = "";
tcl.string_commentline = "";
tcl.line_body1=tclscanYYlineno-1;
tcl_command(-1,tclscanYYtext);
}
YY_BREAK
case 37:
/* rule 37 can match eol */
YY_RULE_SETUP
#line 1000 "tclscanner.l"
{
D
tcl_command(1,tclscanYYtext);
}
YY_BREAK
case 38:
YY_RULE_SETUP
#line 1004 "tclscanner.l"
{
D
tcl.word_is = ' ';
tcl.string_last = "{*}";
tcl_word(0,&tclscanYYtext[3]);
}
YY_BREAK
case 39:
YY_RULE_SETUP
#line 1010 "tclscanner.l"
{
D
tcl.word_is=' ';
tcl.string_last = "";
tcl_word(0,tclscanYYtext);
}
YY_BREAK
case 40:
YY_RULE_SETUP
#line 1016 "tclscanner.l"
{
D
tcl.word_is=' ';
if (tclscanYYtext[0]=='{'||tclscanYYtext[0]=='['||tclscanYYtext[0]=='"') tcl.word_is = tclscanYYtext[0];
tcl.string_last = "";
tcl_word(0,tclscanYYtext);
}
YY_BREAK
case 41:
#line 1025 "tclscanner.l"
case 42:
YY_RULE_SETUP
#line 1025 "tclscanner.l"
{
tcl_word(1,tclscanYYtext);
}
YY_BREAK
case 43:
/* rule 43 can match eol */
YY_RULE_SETUP
#line 1028 "tclscanner.l"
{
tcl_word(2,tclscanYYtext);
}
YY_BREAK
case 44:
YY_RULE_SETUP
#line 1031 "tclscanner.l"
{
tcl_word(3,tclscanYYtext);
}
YY_BREAK
case 45:
YY_RULE_SETUP
#line 1034 "tclscanner.l"
{
tcl_word(4,tclscanYYtext);
}
YY_BREAK
case 46:
YY_RULE_SETUP
#line 1037 "tclscanner.l"
{
tcl_word(5,tclscanYYtext);
}
YY_BREAK
case 47:
YY_RULE_SETUP
#line 1040 "tclscanner.l"
{
tcl_word(6,tclscanYYtext);
}
YY_BREAK
case 48:
YY_RULE_SETUP
#line 1043 "tclscanner.l"
{
tcl_word(7,tclscanYYtext);
}
YY_BREAK
case 49:
YY_RULE_SETUP
#line 1046 "tclscanner.l"
{
tcl_word(8,tclscanYYtext);
}
YY_BREAK
case 50:
YY_RULE_SETUP
#line 1049 "tclscanner.l"
{
tcl_word(9,tclscanYYtext);
}
YY_BREAK
case 51:
YY_RULE_SETUP
#line 1052 "tclscanner.l"
{
tcl_word(10,tclscanYYtext);
}
YY_BREAK
case 52:
/* rule 52 can match eol */
YY_RULE_SETUP
#line 1055 "tclscanner.l"
{
tcl_word(11,tclscanYYtext);
}
YY_BREAK
case 53:
YY_RULE_SETUP
#line 1058 "tclscanner.l"
{
tcl_word(12,tclscanYYtext);
}
YY_BREAK
case 54:
YY_RULE_SETUP
#line 1061 "tclscanner.l"
{
tcl_word(1,tclscanYYtext);
}
YY_BREAK
case 55:
YY_RULE_SETUP
#line 1064 "tclscanner.l"
ECHO;
YY_BREAK
#line 2310 "<stdout>"
case YY_END_OF_BUFFER:
{
/* Amount of text matched not including the EOB char. */
int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
/* Undo the effects of YY_DO_BEFORE_ACTION. */
*yy_cp = (yy_hold_char);
YY_RESTORE_YY_MORE_OFFSET
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
{
/* We're scanning a new file or input source. It's
* possible that this happened because the user
* just pointed tclscanYYin at a new source and called
* tclscanYYlex(). If so, then we have to assure
* consistency between YY_CURRENT_BUFFER and our
* globals. Here is the right place to do so, because
* this is the first action (other than possibly a
* back-up) that will match for the new input source.
*/
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
YY_CURRENT_BUFFER_LVALUE->yy_input_file = tclscanYYin;
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
}
/* Note that here we test for yy_c_buf_p "<=" to the position
* of the first EOB in the buffer, since yy_c_buf_p will
* already have been incremented past the NUL character
* (since all states make transitions on EOB to the
* end-of-buffer state). Contrast this with the test
* in input().
*/
if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
{ /* This was really a NUL. */
yy_state_type yy_next_state;
(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
yy_current_state = yy_get_previous_state( );
/* Okay, we're now positioned to make the NUL
* transition. We couldn't have
* yy_get_previous_state() go ahead and do it
* for us because it doesn't know how to deal
* with the possibility of jamming (and we don't
* want to build jamming into it because then it
* will run more slowly).
*/
yy_next_state = yy_try_NUL_trans( yy_current_state );
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
if ( yy_next_state )
{
/* Consume the NUL. */
yy_cp = ++(yy_c_buf_p);
yy_current_state = yy_next_state;
goto yy_match;
}
else
{
yy_cp = (yy_c_buf_p);
goto yy_find_action;
}
}
else switch ( yy_get_next_buffer( ) )
{
case EOB_ACT_END_OF_FILE:
{
(yy_did_buffer_switch_on_eof) = 0;
if ( tclscanYYwrap( ) )
{
/* Note: because we've taken care in
* yy_get_next_buffer() to have set up
* tclscanYYtext, we can now set up
* yy_c_buf_p so that if some total
* hoser (like flex itself) wants to
* call the scanner after we return the
* YY_NULL, it'll still work - another
* YY_NULL will get returned.
*/
(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
yy_act = YY_STATE_EOF(YY_START);
goto do_action;
}
else
{
if ( ! (yy_did_buffer_switch_on_eof) )
YY_NEW_FILE;
}
break;
}
case EOB_ACT_CONTINUE_SCAN:
(yy_c_buf_p) =
(yytext_ptr) + yy_amount_of_matched_text;
yy_current_state = yy_get_previous_state( );
yy_cp = (yy_c_buf_p);
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
goto yy_match;
case EOB_ACT_LAST_MATCH:
(yy_c_buf_p) =
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
yy_current_state = yy_get_previous_state( );
yy_cp = (yy_c_buf_p);
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
goto yy_find_action;
}
break;
}
default:
YY_FATAL_ERROR(
"fatal flex scanner internal error--no action found" );
} /* end of action switch */
} /* end of scanning one token */
} /* end of tclscanYYlex */
/* yy_get_next_buffer - try to read in a new buffer
*
* Returns a code representing an action:
* EOB_ACT_LAST_MATCH -
* EOB_ACT_CONTINUE_SCAN - continue scanning from current position
* EOB_ACT_END_OF_FILE - end of file
*/
static int yy_get_next_buffer (void)
{
register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
register char *source = (yytext_ptr);
register int number_to_move, i;
int ret_val;
if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
YY_FATAL_ERROR(
"fatal flex scanner internal error--end of buffer missed" );
if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
{ /* Don't try to fill the buffer, so this is an EOF. */
if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
{
/* We matched a single character, the EOB, so
* treat this as a final EOF.
*/
return EOB_ACT_END_OF_FILE;
}
else
{
/* We matched some text prior to the EOB, first
* process it.
*/
return EOB_ACT_LAST_MATCH;
}
}
/* Try to read more data. */
/* First move last chars to start of buffer. */
number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
for ( i = 0; i < number_to_move; ++i )
*(dest++) = *(source++);
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
/* don't do the read, it's not guaranteed to return an EOF,
* just force an EOF
*/
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
else
{
yy_size_t num_to_read =
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
while ( num_to_read <= 0 )
{ /* Not enough room in the buffer - grow it. */
/* just a shorter name for the current buffer */
YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
int yy_c_buf_p_offset =
(int) ((yy_c_buf_p) - b->yy_ch_buf);
if ( b->yy_is_our_buffer )
{
yy_size_t new_size = b->yy_buf_size * 2;
if ( new_size <= 0 )
b->yy_buf_size += b->yy_buf_size / 8;
else
b->yy_buf_size *= 2;
b->yy_ch_buf = (char *)
/* Include room in for 2 EOB chars. */
tclscanYYrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
}
else
/* Can't grow it, we don't own it. */
b->yy_ch_buf = 0;
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR(
"fatal error - scanner input buffer overflow" );
(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
number_to_move - 1;
}
if ( num_to_read > YY_READ_BUF_SIZE )
num_to_read = YY_READ_BUF_SIZE;
/* Read in more data. */
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
(yy_n_chars), num_to_read );
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
}
if ( (yy_n_chars) == 0 )
{
if ( number_to_move == YY_MORE_ADJ )
{
ret_val = EOB_ACT_END_OF_FILE;
tclscanYYrestart(tclscanYYin );
}
else
{
ret_val = EOB_ACT_LAST_MATCH;
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
YY_BUFFER_EOF_PENDING;
}
}
else
ret_val = EOB_ACT_CONTINUE_SCAN;
if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
/* Extend the array by 50%, plus the number we really need. */
yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) tclscanYYrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
}
(yy_n_chars) += number_to_move;
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
return ret_val;
}
/* yy_get_previous_state - get the state just before the EOB char was reached */
static yy_state_type yy_get_previous_state (void)
{
register yy_state_type yy_current_state;
register char *yy_cp;
yy_current_state = (yy_start);
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
{
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
(yy_last_accepting_cpos) = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 179 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
}
return yy_current_state;
}
/* yy_try_NUL_trans - try to make a transition on the NUL character
*
* synopsis
* next_state = yy_try_NUL_trans( current_state );
*/
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
{
register int yy_is_jam;
register char *yy_cp = (yy_c_buf_p);
register YY_CHAR yy_c = 1;
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
(yy_last_accepting_cpos) = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 179 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
yy_is_jam = (yy_current_state == 178);
return yy_is_jam ? 0 : yy_current_state;
}
static void yyunput (int c, register char * yy_bp )
{
register char *yy_cp;
yy_cp = (yy_c_buf_p);
/* undo effects of setting up tclscanYYtext */
*yy_cp = (yy_hold_char);
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
{ /* need to shift things up to make room */
/* +2 for EOB chars. */
register yy_size_t number_to_move = (yy_n_chars) + 2;
register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
register char *source =
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
*--dest = *--source;
yy_cp += (int) (dest - source);
yy_bp += (int) (dest - source);
YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
YY_FATAL_ERROR( "flex scanner push-back overflow" );
}
*--yy_cp = (char) c;
if ( c == '\n' ){
--tclscanYYlineno;
}
(yytext_ptr) = yy_bp;
(yy_hold_char) = *yy_cp;
(yy_c_buf_p) = yy_cp;
}
#ifndef YY_NO_INPUT
#ifdef __cplusplus
static int yyinput (void)
#else
static int input (void)
#endif
{
int c;
*(yy_c_buf_p) = (yy_hold_char);
if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
{
/* yy_c_buf_p now points to the character we want to return.
* If this occurs *before* the EOB characters, then it's a
* valid NUL; if not, then we've hit the end of the buffer.
*/
if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
/* This was really a NUL. */
*(yy_c_buf_p) = '\0';
else
{ /* need more input */
yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
++(yy_c_buf_p);
switch ( yy_get_next_buffer( ) )
{
case EOB_ACT_LAST_MATCH:
/* This happens because yy_g_n_b()
* sees that we've accumulated a
* token and flags that we need to
* try matching the token before
* proceeding. But for input(),
* there's no matching to consider.
* So convert the EOB_ACT_LAST_MATCH
* to EOB_ACT_END_OF_FILE.
*/
/* Reset buffer status. */
tclscanYYrestart(tclscanYYin );
/*FALLTHROUGH*/
case EOB_ACT_END_OF_FILE:
{
if ( tclscanYYwrap( ) )
return 0;
if ( ! (yy_did_buffer_switch_on_eof) )
YY_NEW_FILE;
#ifdef __cplusplus
return yyinput();
#else
return input();
#endif
}
case EOB_ACT_CONTINUE_SCAN:
(yy_c_buf_p) = (yytext_ptr) + offset;
break;
}
}
}
c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
*(yy_c_buf_p) = '\0'; /* preserve tclscanYYtext */
(yy_hold_char) = *++(yy_c_buf_p);
if ( c == '\n' )
tclscanYYlineno++;
;
return c;
}
#endif /* ifndef YY_NO_INPUT */
/** Immediately switch to a different input stream.
* @param input_file A readable stream.
*
* @note This function does not reset the start condition to @c INITIAL .
*/
void tclscanYYrestart (FILE * input_file )
{
if ( ! YY_CURRENT_BUFFER ){
tclscanYYensure_buffer_stack ();
YY_CURRENT_BUFFER_LVALUE =
tclscanYY_create_buffer(tclscanYYin,YY_BUF_SIZE );
}
tclscanYY_init_buffer(YY_CURRENT_BUFFER,input_file );
tclscanYY_load_buffer_state( );
}
/** Switch to a different input buffer.
* @param new_buffer The new input buffer.
*
*/
void tclscanYY_switch_to_buffer (YY_BUFFER_STATE new_buffer )
{
/* TODO. We should be able to replace this entire function body
* with
* tclscanYYpop_buffer_state();
* tclscanYYpush_buffer_state(new_buffer);
*/
tclscanYYensure_buffer_stack ();
if ( YY_CURRENT_BUFFER == new_buffer )
return;
if ( YY_CURRENT_BUFFER )
{
/* Flush out information for old buffer. */
*(yy_c_buf_p) = (yy_hold_char);
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
}
YY_CURRENT_BUFFER_LVALUE = new_buffer;
tclscanYY_load_buffer_state( );
/* We don't actually know whether we did this switch during
* EOF (tclscanYYwrap()) processing, but the only time this flag
* is looked at is after tclscanYYwrap() is called, so it's safe
* to go ahead and always set it.
*/
(yy_did_buffer_switch_on_eof) = 1;
}
static void tclscanYY_load_buffer_state (void)
{
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
tclscanYYin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
(yy_hold_char) = *(yy_c_buf_p);
}
/** Allocate and initialize an input buffer state.
* @param file A readable stream.
* @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
*
* @return the allocated buffer state.
*/
YY_BUFFER_STATE tclscanYY_create_buffer (FILE * file, int size )
{
YY_BUFFER_STATE b;
b = (YY_BUFFER_STATE) tclscanYYalloc(sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in tclscanYY_create_buffer()" );
b->yy_buf_size = size;
/* yy_ch_buf has to be 2 characters longer than the size given because
* we need to put in 2 end-of-buffer characters.
*/
b->yy_ch_buf = (char *) tclscanYYalloc(b->yy_buf_size + 2 );
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in tclscanYY_create_buffer()" );
b->yy_is_our_buffer = 1;
tclscanYY_init_buffer(b,file );
return b;
}
/** Destroy the buffer.
* @param b a buffer created with tclscanYY_create_buffer()
*
*/
void tclscanYY_delete_buffer (YY_BUFFER_STATE b )
{
if ( ! b )
return;
if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
if ( b->yy_is_our_buffer )
tclscanYYfree((void *) b->yy_ch_buf );
tclscanYYfree((void *) b );
}
#ifndef __cplusplus
extern int isatty (int );
#endif /* __cplusplus */
/* Initializes or reinitializes a buffer.
* This function is sometimes called more than once on the same buffer,
* such as during a tclscanYYrestart() or at EOF.
*/
static void tclscanYY_init_buffer (YY_BUFFER_STATE b, FILE * file )
{
int oerrno = errno;
tclscanYY_flush_buffer(b );
b->yy_input_file = file;
b->yy_fill_buffer = 1;
/* If b is the current buffer, then tclscanYY_init_buffer was _probably_
* called from tclscanYYrestart() or through yy_get_next_buffer.
* In that case, we don't want to reset the lineno or column.
*/
if (b != YY_CURRENT_BUFFER){
b->yy_bs_lineno = 1;
b->yy_bs_column = 0;
}
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
errno = oerrno;
}
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
* @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
*
*/
void tclscanYY_flush_buffer (YY_BUFFER_STATE b )
{
if ( ! b )
return;
b->yy_n_chars = 0;
/* We always need two end-of-buffer characters. The first causes
* a transition to the end-of-buffer state. The second causes
* a jam in that state.
*/
b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
b->yy_buf_pos = &b->yy_ch_buf[0];
b->yy_at_bol = 1;
b->yy_buffer_status = YY_BUFFER_NEW;
if ( b == YY_CURRENT_BUFFER )
tclscanYY_load_buffer_state( );
}
/** Pushes the new state onto the stack. The new state becomes
* the current state. This function will allocate the stack
* if necessary.
* @param new_buffer The new state.
*
*/
void tclscanYYpush_buffer_state (YY_BUFFER_STATE new_buffer )
{
if (new_buffer == NULL)
return;
tclscanYYensure_buffer_stack();
/* This block is copied from tclscanYY_switch_to_buffer. */
if ( YY_CURRENT_BUFFER )
{
/* Flush out information for old buffer. */
*(yy_c_buf_p) = (yy_hold_char);
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
}
/* Only push if top exists. Otherwise, replace top. */
if (YY_CURRENT_BUFFER)
(yy_buffer_stack_top)++;
YY_CURRENT_BUFFER_LVALUE = new_buffer;
/* copied from tclscanYY_switch_to_buffer. */
tclscanYY_load_buffer_state( );
(yy_did_buffer_switch_on_eof) = 1;
}
/** Removes and deletes the top of the stack, if present.
* The next element becomes the new top.
*
*/
void tclscanYYpop_buffer_state (void)
{
if (!YY_CURRENT_BUFFER)
return;
tclscanYY_delete_buffer(YY_CURRENT_BUFFER );
YY_CURRENT_BUFFER_LVALUE = NULL;
if ((yy_buffer_stack_top) > 0)
--(yy_buffer_stack_top);
if (YY_CURRENT_BUFFER) {
tclscanYY_load_buffer_state( );
(yy_did_buffer_switch_on_eof) = 1;
}
}
/* Allocates the stack if it does not exist.
* Guarantees space for at least one push.
*/
static void tclscanYYensure_buffer_stack (void)
{
yy_size_t num_to_alloc;
if (!(yy_buffer_stack)) {
/* First allocation is just for 2 elements, since we don't know if this
* scanner will even need a stack. We use 2 instead of 1 to avoid an
* immediate realloc on the next call.
*/
num_to_alloc = 1;
(yy_buffer_stack) = (struct yy_buffer_state**)tclscanYYalloc
(num_to_alloc * sizeof(struct yy_buffer_state*)
);
if ( ! (yy_buffer_stack) )
YY_FATAL_ERROR( "out of dynamic memory in tclscanYYensure_buffer_stack()" );
memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
(yy_buffer_stack_max) = num_to_alloc;
(yy_buffer_stack_top) = 0;
return;
}
if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
/* Increase the buffer to prepare for a possible push. */
int grow_size = 8 /* arbitrary grow size */;
num_to_alloc = (yy_buffer_stack_max) + grow_size;
(yy_buffer_stack) = (struct yy_buffer_state**)tclscanYYrealloc
((yy_buffer_stack),
num_to_alloc * sizeof(struct yy_buffer_state*)
);
if ( ! (yy_buffer_stack) )
YY_FATAL_ERROR( "out of dynamic memory in tclscanYYensure_buffer_stack()" );
/* zero only the new slots.*/
memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
(yy_buffer_stack_max) = num_to_alloc;
}
}
/** Setup the input buffer state to scan directly from a user-specified character buffer.
* @param base the character buffer
* @param size the size in bytes of the character buffer
*
* @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE tclscanYY_scan_buffer (char * base, yy_size_t size )
{
YY_BUFFER_STATE b;
if ( size < 2 ||
base[size-2] != YY_END_OF_BUFFER_CHAR ||
base[size-1] != YY_END_OF_BUFFER_CHAR )
/* They forgot to leave room for the EOB's. */
return 0;
b = (YY_BUFFER_STATE) tclscanYYalloc(sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in tclscanYY_scan_buffer()" );
b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
b->yy_buf_pos = b->yy_ch_buf = base;
b->yy_is_our_buffer = 0;
b->yy_input_file = 0;
b->yy_n_chars = b->yy_buf_size;
b->yy_is_interactive = 0;
b->yy_at_bol = 1;
b->yy_fill_buffer = 0;
b->yy_buffer_status = YY_BUFFER_NEW;
tclscanYY_switch_to_buffer(b );
return b;
}
/** Setup the input buffer state to scan a string. The next call to tclscanYYlex() will
* scan from a @e copy of @a str.
* @param yystr a NUL-terminated string to scan
*
* @return the newly allocated buffer state object.
* @note If you want to scan bytes that may contain NUL values, then use
* tclscanYY_scan_bytes() instead.
*/
YY_BUFFER_STATE tclscanYY_scan_string (yyconst char * yystr )
{
return tclscanYY_scan_bytes(yystr,strlen(yystr) );
}
/** Setup the input buffer state to scan the given bytes. The next call to tclscanYYlex() will
* scan from a @e copy of @a bytes.
* @param bytes the byte buffer to scan
* @param len the number of bytes in the buffer pointed to by @a bytes.
*
* @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE tclscanYY_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
{
YY_BUFFER_STATE b;
char *buf;
yy_size_t n, i;
/* Get memory for full buffer, including space for trailing EOB's. */
n = _yybytes_len + 2;
buf = (char *) tclscanYYalloc(n );
if ( ! buf )
YY_FATAL_ERROR( "out of dynamic memory in tclscanYY_scan_bytes()" );
for ( i = 0; i < _yybytes_len; ++i )
buf[i] = yybytes[i];
buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
b = tclscanYY_scan_buffer(buf,n );
if ( ! b )
YY_FATAL_ERROR( "bad buffer in tclscanYY_scan_bytes()" );
/* It's okay to grow etc. this buffer, and we should throw it
* away when we're done.
*/
b->yy_is_our_buffer = 1;
return b;
}
static void yy_push_state (int new_state )
{
if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
{
yy_size_t new_size;
(yy_start_stack_depth) += YY_START_STACK_INCR;
new_size = (yy_start_stack_depth) * sizeof( int );
if ( ! (yy_start_stack) )
(yy_start_stack) = (int *) tclscanYYalloc(new_size );
else
(yy_start_stack) = (int *) tclscanYYrealloc((void *) (yy_start_stack),new_size );
if ( ! (yy_start_stack) )
YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
}
(yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
BEGIN(new_state);
}
static void yy_pop_state (void)
{
if ( --(yy_start_stack_ptr) < 0 )
YY_FATAL_ERROR( "start-condition stack underflow" );
BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
}
static int yy_top_state (void)
{
return (yy_start_stack)[(yy_start_stack_ptr) - 1];
}
#ifndef YY_EXIT_FAILURE
#define YY_EXIT_FAILURE 2
#endif
static void yy_fatal_error (yyconst char* msg )
{
(void) fprintf( stderr, "%s\n", msg );
exit( YY_EXIT_FAILURE );
}
/* Redefine yyless() so it works in section 3 code. */
#undef yyless
#define yyless(n) \
do \
{ \
/* Undo effects of setting up tclscanYYtext. */ \
int yyless_macro_arg = (n); \
YY_LESS_LINENO(yyless_macro_arg);\
tclscanYYtext[tclscanYYleng] = (yy_hold_char); \
(yy_c_buf_p) = tclscanYYtext + yyless_macro_arg; \
(yy_hold_char) = *(yy_c_buf_p); \
*(yy_c_buf_p) = '\0'; \
tclscanYYleng = yyless_macro_arg; \
} \
while ( 0 )
/* Accessor methods (get/set functions) to struct members. */
/** Get the current line number.
*
*/
int tclscanYYget_lineno (void)
{
return tclscanYYlineno;
}
/** Get the input stream.
*
*/
FILE *tclscanYYget_in (void)
{
return tclscanYYin;
}
/** Get the output stream.
*
*/
FILE *tclscanYYget_out (void)
{
return tclscanYYout;
}
/** Get the length of the current token.
*
*/
yy_size_t tclscanYYget_leng (void)
{
return tclscanYYleng;
}
/** Get the current token.
*
*/
char *tclscanYYget_text (void)
{
return tclscanYYtext;
}
/** Set the current line number.
* @param line_number
*
*/
void tclscanYYset_lineno (int line_number )
{
tclscanYYlineno = line_number;
}
/** Set the input stream. This does not discard the current
* input buffer.
* @param in_str A readable stream.
*
* @see tclscanYY_switch_to_buffer
*/
void tclscanYYset_in (FILE * in_str )
{
tclscanYYin = in_str ;
}
void tclscanYYset_out (FILE * out_str )
{
tclscanYYout = out_str ;
}
int tclscanYYget_debug (void)
{
return tclscanYY_flex_debug;
}
void tclscanYYset_debug (int bdebug )
{
tclscanYY_flex_debug = bdebug ;
}
static int yy_init_globals (void)
{
/* Initialization is the same as for the non-reentrant scanner.
* This function is called from tclscanYYlex_destroy(), so don't allocate here.
*/
/* We do not touch tclscanYYlineno unless the option is enabled. */
tclscanYYlineno = 1;
(yy_buffer_stack) = 0;
(yy_buffer_stack_top) = 0;
(yy_buffer_stack_max) = 0;
(yy_c_buf_p) = (char *) 0;
(yy_init) = 0;
(yy_start) = 0;
(yy_start_stack_ptr) = 0;
(yy_start_stack_depth) = 0;
(yy_start_stack) = NULL;
/* Defined in main.c */
#ifdef YY_STDINIT
tclscanYYin = stdin;
tclscanYYout = stdout;
#else
tclscanYYin = (FILE *) 0;
tclscanYYout = (FILE *) 0;
#endif
/* For future reference: Set errno on error, since we are called by
* tclscanYYlex_init()
*/
return 0;
}
/* tclscanYYlex_destroy is for both reentrant and non-reentrant scanners. */
int tclscanYYlex_destroy (void)
{
/* Pop the buffer stack, destroying each element. */
while(YY_CURRENT_BUFFER){
tclscanYY_delete_buffer(YY_CURRENT_BUFFER );
YY_CURRENT_BUFFER_LVALUE = NULL;
tclscanYYpop_buffer_state();
}
/* Destroy the stack itself. */
tclscanYYfree((yy_buffer_stack) );
(yy_buffer_stack) = NULL;
/* Destroy the start condition stack. */
tclscanYYfree((yy_start_stack) );
(yy_start_stack) = NULL;
/* Reset the globals. This is important in a non-reentrant scanner so the next time
* tclscanYYlex() is called, initialization will occur. */
yy_init_globals( );
return 0;
}
/*
* Internal utility routines.
*/
#ifndef yytext_ptr
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
{
register int i;
for ( i = 0; i < n; ++i )
s1[i] = s2[i];
}
#endif
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * s )
{
register int n;
for ( n = 0; s[n]; ++n )
;
return n;
}
#endif
void *tclscanYYalloc (yy_size_t size )
{
return (void *) malloc( size );
}
void *tclscanYYrealloc (void * ptr, yy_size_t size )
{
/* The cast to (char *) in the following accommodates both
* implementations that use char* generic pointers, and those
* that use void* generic pointers. It works with the latter
* because both ANSI C and C++ allow castless assignment from
* any pointer type to void*, and deal with argument conversions
* as though doing an assignment.
*/
return (void *) realloc( (char *) ptr, size );
}
void tclscanYYfree (void * ptr )
{
free( (char *) ptr ); /* see tclscanYYrealloc() for (char *) cast */
}
#define YYTABLES_NAME "yytables"
#line 1064 "tclscanner.l"
//! Start new scan context for given 'content'.
// @return created new scan context.
static tcl_scan *tcl_scan_start(char type, QString content, QCString ns, Entry *entry_cl, Entry *entry_fn)
{
tcl_scan *myScan=tcl.scan.at(0);
QCString myName;
tcl_inf("line=%d type=%d '%s'\n",tcl.line_body0,type,content.ascii());
myScan->line1=tclscanYYlineno;
yy_push_state(TOP);
myScan=new tcl_scan;
myScan->type[0] =' ';
myScan->type[1] = '\0';
switch (type) {
case '"':
case '{':
case '[':
myScan->type[0] = type;
break;
case '?':
if (content[0]=='"' && content[content.length()-1]=='"') myScan->type[0]='"';
if (content[0]=='{' && content[content.length()-1]=='}') myScan->type[0]='{';
if (content[0]=='[' && content[content.length()-1]==']') myScan->type[0]='[';
}
if (myScan->type[0]!=' ')
{
tcl_codify(NULL,&myScan->type[0]);
content = content.mid(1,content.length()-2);
}
content += (char)0x1A;// for detection end of scan context
myScan->ns = ns;
myScan->entry_cl = entry_cl;
myScan->entry_fn = entry_fn;
myScan->entry_scan = tcl.entry_current;
myScan->buffer_state=tclscanYY_scan_string(content.ascii());
myScan->line0=tcl.line_body0;
myScan->line1=tcl.line_body1;
myScan->after.clear();
tclscanYYlineno=myScan->line0;
myScan->protection = tcl.protection;
tcl.entry_inside = myScan->entry_scan;
tcl.entry_current = tcl_entry_new();
tcl.scan.insert(0,myScan);
tclscanYY_switch_to_buffer(myScan->buffer_state);
return (myScan);
}
//! Close current scan context.
static void tcl_scan_end()
{
tcl_scan *myScan=tcl.scan.at(0);
tcl_scan *myScan1=tcl.scan.at(1);
tcl_inf("line=%d\n",myScan->line1);
if (myScan->type[0]=='{') myScan->type[0]='}';
if (myScan->type[0]=='[') myScan->type[0]=']';
if (myScan->type[0]!=' ') tcl_codify(NULL,&myScan->type[0]);
int myStart=-1;
for (unsigned int i=0;i<myScan->after.count();i=i+2)
{
if (myScan->after[i]=="script") {
myStart=i;
break;
}
tcl_codify(myScan->after[i].utf8(),myScan->after[i+1].utf8());
}
tclscanYY_delete_buffer(myScan->buffer_state);
yy_pop_state();
tcl.entry_inside = myScan1->entry_scan;
tclscanYY_switch_to_buffer(myScan1->buffer_state);
tclscanYYlineno=myScan1->line1;
tcl.protection = myScan1->protection;
if (myStart>=0)
{
myScan1 = tcl_scan_start('?', myScan->after[myStart+1], myScan->ns, myScan->entry_cl, myScan->entry_fn);
for (unsigned int i=myStart+2;i<myScan->after.count();i++)
{
myScan1->after.append(myScan->after[i]);
}
tcl.scan.remove(1);
}
else
{
tcl.scan.removeFirst();
}
}
//! Handling of word parsing.
static void tcl_word(int what,const char *text)
{
static char myList[1024]="";// nesting level list
static int myLevel=0;// number of current nesting level
static int myWhite=0;// set true when next char should be whitespace
static char myWord;// internal state
switch (what)
{
case 0:// start
yy_push_state(WORD);
switch (text[0])
{
case '{':
case '[':
case '"': myWord = text[0]; break;
default: myWord = '.';
}
myList[0]=myWord;
myLevel=1;
myWhite=0;
break;
case 1:// all other chars
if (myWhite)
{// {x}y "x"y
tcl_err("expected word separator: %s\n",text);
return;
}
if (myLevel==0)
{
myWord='.';
myList[0]=myWord;
myLevel=1;
}
break;
case 2:// \\\n
if (myLevel==0)
{
myWord=' ';
yy_pop_state();
yyless(0);
tcl_inf("(\\\n) ?%s?\n",tcl.string_last.data());
return;
}
switch (myList[myLevel-1])
{
case '{':
case '[':
case '"':
break;
case '.':
if (myLevel==1)
{
myWord=' ';
yy_pop_state();
yyless(0);
tcl_inf("(\\\n) ?%s?\n",tcl.string_last.data());
return;
}
break;
}
myWhite=0;
break;
case 3:// {
if (myWhite)
{// {x}{ "x"{
tcl_err("expected word separator: %s\n",text);
return;
}
switch (myList[myLevel-1])
{
case '{':
case '[':
myList[myLevel++]='{';
break;
case '"':
case '.':
break;
}
myWhite=0;
break;
case 4:// }
if (myWhite)
{// {x}{ "x"{
tcl_err("expected word separator: %s\n",text);
return;
}
switch (myList[myLevel-1])
{
case '{':// {{x}}
myLevel--;
if (myLevel==0 && tcl.code==NULL)
{
myWhite=1;
}
break;
case '[':
case '"':
case '.':
break;
}
break;
case 5:// [
if (myWhite)
{// {x}[
tcl_err("expected word separator: %s\n",text);
return;
}
switch (myList[myLevel-1])
{
case '{':
break;
case '[':
case '"':
case '.':
myList[myLevel++]='[';
break;
}
myWhite=0;
break;
case 6:// ]
if (myWhite)
{// {x}]
tcl_err("expected word separator: %s\n",text);
return;
}
switch (myList[myLevel-1])
{
case '{':
break;
case '[':
myLevel--;
break;
case '"':
case '.':
break;
}
myWhite=0;
break;
case 7:// "
if (myWhite)
{// {x}"
tcl_err("expected word separator: %s\n",text);
return;
}
switch (myList[myLevel-1])
{
case '{':
break;
case '[':
myList[myLevel++]='"';
break;
case '"':
myLevel--;
case '.':
break;
}
break;
case 8:// ' '
case 9:// \t
case 10:// ;
case 11:// \n
if (myLevel==0)
{
myWord=' ';
yy_pop_state();
yyless(0);
tcl_inf("(%d) ?%s?\n",what,tcl.string_last.data());
return;
}
switch (myList[myLevel-1])
{
case '{':
case '[':
case '"':
break;
case '.':
if (myLevel==1)
{
myWord=' ';
yy_pop_state();
yyless(0);
tcl_inf("(.%d) ?%s?\n",what,tcl.string_last.data());
return;
}
else
{
myLevel--;
}
break;
}
myWhite=0;
break;
case 12:// \x1A
if (myLevel==0)
{
myWord=' ';
yy_pop_state();
yyless(0);
tcl_inf("(%d) ?%s?\n",what,tcl.string_last.data());
return;
}
if (myLevel!=1 || myList[0] != '.')
{
tcl_war("level=%d expected=%c\n",myLevel,myList[myLevel-1]);
}
myWord=' ';
yy_pop_state();
yyless(0);
tcl_inf("(.%d) ?%s?\n",what,tcl.string_last.data());
return;
myWhite=0;
break;
default:
tcl_err("wrong state: %d\n",what);
return;
}
tcl.string_last += text;
}
//! Handling of comment parsing.
static void tcl_comment(int what,const char *text)
{
if (what==0)
{ // begin of comment
if (tcl.comment)
{
tcl_err("comment in comment\n");
return;
}
yy_push_state(COMMENT);
tcl_inf("<- %s\n",text);
tcl.string_comment="";
tcl.comment=0;
}
else if (what==1)
{ // start new comment
if (tcl.comment)
{
tcl_comment(99,""); // inbody
}
tcl.string_comment=text;
tcl.comment=1;
}
else if (what==2)
{ // add to comment
if (tcl.comment)
{
tcl.string_comment+=text;
}
}
else if (what==-1 || what == -2)
{ // end of comment without/with command
if (tcl.comment)
{
tcl.string_last=tcl.string_comment;
tcl_comment(100+what,"");
}
else
{
tcl.string_last = "";
tcl_inf("-> %s\n",(const char *)tcl.string_comment);
}
yy_pop_state();
tcl.string_comment="";
tcl.comment=0;
}
else if (what==98 || what==99)
{ // 98=new 99=inbody
if (tcl.this_parser && tcl.string_comment.length())
{
tcl_inf("-> %s\n",(const char *)tcl.string_comment);
int myPos=0;
bool myNew=0;
int myLine=tcl.line_comment;
BufStr myI(1024);
BufStr myO(1024);
Protection myProt=tcl.protection;
// resolve ALIASES
myI.addArray("/*!",3);
myI.addArray(tcl.string_comment.data(),tcl.string_comment.length());
myI.addArray("*/",2);
convertCppComments(&myI,&myO,tcl.file_name);
myO.dropFromStart(3);
myO.shrink(myO.curPos()-2);
myO.addChar('\0');
QCString myDoc = myO.data();
if (what==99)
{ // inbody comment file or namespace or class or proc/method
int myPos0;
int myLine0;
Entry myEntry0; // used to test parsing
Entry *myEntry;
Entry *myEntry1=NULL;
if (tcl.scan.at(0)->entry_fn)
{
myEntry1=tcl.scan.at(0)->entry_fn;
}
else if (tcl.scan.at(0)->entry_cl)
{
myEntry1=tcl.scan.at(0)->entry_cl;
}
myPos0=myPos;
myLine0=myLine;
while (parseCommentBlock(tcl.this_parser, &myEntry0, myDoc, tcl.file_name,
myLine, FALSE, tcl.config_autobrief, FALSE, myProt, myPos, myNew))
{
if (myNew)
{ // we need a new entry in this case
myNew=0;
myEntry = tcl_entry_new();
parseCommentBlock(tcl.this_parser, myEntry, myDoc, tcl.file_name,
myLine0, FALSE, tcl.config_autobrief, FALSE, myProt, myPos0, myNew);
tcl.entry_inside->addSubEntry(myEntry);
}
else
{ // we can add to current entry in this case
if (myEntry1==NULL)
{
myEntry1=tcl_entry_namespace(tcl.scan.at(0)->ns);
}
parseCommentBlock(tcl.this_parser, myEntry1, myDoc, tcl.file_name,
myLine0, FALSE, tcl.config_autobrief, FALSE, myProt, myPos0, myNew);
}
myPos0=myPos;
myLine0=myLine;
}
if (myNew)
{ // we need a new entry
myNew=0;
myEntry = tcl_entry_new();
parseCommentBlock(tcl.this_parser, myEntry, myDoc, tcl.file_name,
myLine0, FALSE, tcl.config_autobrief, FALSE, myProt, myPos0, myNew);
tcl.entry_inside->addSubEntry(myEntry);
}
else
{ // we can add to current entry
if (myEntry1==NULL)
{
myEntry1=tcl_entry_namespace(tcl.scan.at(0)->ns);
}
parseCommentBlock(tcl.this_parser, myEntry1, myDoc, tcl.file_name,
myLine0, FALSE, tcl.config_autobrief, FALSE, myProt, myPos0, myNew);
}
}
else
{ // new entry
tcl.entry_current = tcl_entry_new();
while (parseCommentBlock(tcl.this_parser, tcl.entry_current, myDoc,
tcl.file_name, myLine, FALSE, tcl.config_autobrief, FALSE,
myProt, myPos, myNew))
{
if (myNew)
{
tcl.entry_inside->addSubEntry(tcl.entry_current);
tcl.entry_current = tcl_entry_new();
}
else
{
tcl.entry_current->section = tcl.entry_inside->section;
tcl.entry_current->name = tcl.entry_inside->name;
}
}
if (myNew)
{
tcl.entry_inside->addSubEntry(tcl.entry_current);
tcl.entry_current = tcl_entry_new();
}
else
{
tcl.entry_current->section = tcl.entry_inside->section;
tcl.entry_current->name = tcl.entry_inside->name;
}
}
if (tcl.protection != myProt)
{
tcl.scan.at(0)->protection = tcl.protection = myProt;
}
}
}
else
{
tcl_err("what %d\n",what);
return;
}
}
//! Parse given \c arglist .
static void tcl_command_ARGLIST(QString &arglist)
{
D
Argument *myArg;
QStringList myArgs;
QString myArglist="";
if (tcl.entry_current->argList==NULL)
{
tcl.entry_current->argList=new ArgumentList;
}
tcl_split_list(arglist,myArgs);
for (uint i=0;i<myArgs.count();i++)
{
QStringList myArgs1;
myArg=new Argument;
tcl_split_list(*myArgs.at(i),myArgs1);
if (myArgs1.count()==2)
{
myArg->name= (*myArgs1.at(0)).utf8();
myArg->defval= (*myArgs1.at(1)).utf8();
if (myArg->defval.isEmpty())
{
myArg->defval = " ";
}
myArglist += "?" + QCString(myArg->name) + "? ";
}
else
{
myArg->name= (*myArgs.at(i)).utf8();
myArglist += QString(myArg->name) + " ";
}
tcl.entry_current->argList->append(myArg);
}
arglist = myArglist;
tcl.entry_current->args = arglist.utf8();
}
//! Create link.
static void tcl_codify_link(QCString name)
{
if (tcl.code == NULL || name.isEmpty()) return;
static int init=0;
static QAsciiDict<MemberDef> fn;
if (init==0)
{
init=1;
MemberNameSDict::Iterator mni(*Doxygen::memberNameSDict);
MemberNameSDict::Iterator fni(*Doxygen::functionNameSDict);
MemberName *mn=0;
MemberDef *md;
for (mni.toFirst();(mn=mni.current());++mni)
{
MemberNameIterator mi(*mn);
for (mi.toFirst();(md=mi.current());++mi)
{
fn.insert(md->qualifiedName(),md);
}
}
for (fni.toFirst();(mn=fni.current());++fni)
{
MemberNameIterator fi(*mn);
for (fi.toFirst();(md=fi.current());++fi)
{
fn.insert(md->qualifiedName(),md);
}
}
}
MemberDef *myDef;
QCString myName=name;
if (name.mid(0,2)=="::") // fully qualified global command
{
myName = myName.mid(2);
myDef = fn.find(myName);
}
else // not qualified name
{
QCString myName1=myName;
myDef = NULL;
myName1 = tcl.scan.at(0)->ns;
if (myName1 == " " || myName1 == "")
{
myName1 = myName;
}
else
{
myName1 = myName1 + "::" + myName;
}
myDef = fn.find(myName1); // search namespace command
if (myDef == NULL)
{
myDef = fn.find(myName); // search global command
}
}
if (myDef != NULL) // documented command
{
tcl.code->writeCodeLink(myDef->getReference().data(),
myDef->getOutputFileBase().data(),
myDef->anchor().data(),
name,
myDef->qualifiedName().data());
if (tcl.memberdef)
{
myDef->addSourceReferencedBy(tcl.memberdef);
tcl.memberdef->addSourceReferences(myDef);
}
}
else if (tcl_keyword(myName)) // check keyword
{
tcl_codify("keyword",name);
}
else
{
tcl_codify(NULL,name); // something else
}
}
//! Handle internal tcl commands.
// "if expr1 ?then? body1 elseif expr2 ?then? body2 elseif ... ?else? ?bodyN?"
static void tcl_command_IF(QStringList type)
{
D
tcl_codify_cmd("keyword",0);
tcl_codify_cmd(NULL,1);
tcl_scan *myScan=tcl.scan.at(0);
myScan = tcl_scan_start('?',*tcl.list_commandwords.at(2),
myScan->ns,myScan->entry_cl,myScan->entry_fn);
for (unsigned int i = 3;i<tcl.list_commandwords.count();i++)
{
myScan->after << type[i] << tcl.list_commandwords[i];
}
}
//! Handle internal tcl commands.
// "for start test next body"
static void tcl_command_FOR()
{
D
tcl_codify_cmd("keyword",0);
tcl_codify_cmd(NULL,1);
tcl_scan *myScan=tcl.scan.at(0);
myScan = tcl_scan_start('?',*tcl.list_commandwords.at(2),
myScan->ns,myScan->entry_cl,myScan->entry_fn);
myScan->after << "NULL" << tcl.list_commandwords[3];
myScan->after << "script" << tcl.list_commandwords[4];
myScan->after << "NULL" << tcl.list_commandwords[5];
myScan->after << "script" << tcl.list_commandwords[6];
myScan->after << "NULL" << tcl.list_commandwords[7];
myScan->after << "script" << tcl.list_commandwords[8];
}
///! Handle internal tcl commands.
// "foreach varname list body" and
// "foreach varlist1 list1 ?varlist2 list2 ...? body"
static void tcl_command_FOREACH()
{
D
unsigned int i;
tcl_codify_cmd("keyword",0);
for (i = 1;i<tcl.list_commandwords.count()-1;i++)
{
tcl_codify_cmd(NULL,i);
}
tcl_scan *myScan=tcl.scan.at(0);
myScan = tcl_scan_start('?',*tcl.list_commandwords.at(tcl.list_commandwords.count()-1),
myScan->ns,myScan->entry_cl,myScan->entry_fn);
}
///! Handle internal tcl commands.
// "while test body"
static void tcl_command_WHILE()
{
D
tcl_codify_cmd("keyword",0);
tcl_codify_cmd(NULL,1);
tcl_scan *myScan=tcl.scan.at(0);
myScan = tcl_scan_start('?',*tcl.list_commandwords.at(2),
myScan->ns,myScan->entry_cl,myScan->entry_fn);
myScan->after << "NULL" << tcl.list_commandwords[3];
myScan->after << "script" << tcl.list_commandwords[4];
}
//! Handle all other commands.
// Create links of first command word or first command word inside [].
static void tcl_command_OTHER()
{
if (tcl.code == NULL) return;
D
QCString myName;
for (unsigned int i=0; i< tcl.list_commandwords.count(); i++)
{
myName = (*tcl.list_commandwords.at(i)).utf8();
if (i==0)
{
tcl_codify_link(myName);
}
else if (i%2 != 0)
{
tcl_codify(NULL,myName);
}
else
{
QCString myStr="";
int myCmd=0;
unsigned int i;
for (i=0;i<myName.length();i++)
{
QChar c = myName[i];
if (myCmd)
{
if (c==' '||c=='\t'||c=='\n'||c==']')
{//end of command
tcl_codify_link(myStr);
myStr="";
myCmd=0;
}
myStr+=c;
}
else
{
myStr+=c;
if (c=='[')
{//start of command
for (;i<myName.length();i++)
{
c = myName[i+1];
if (c!=' ' && c!='\t' && c!='\n') break;
myStr+=c;
}
tcl_codify(NULL,myStr);
myStr="";
myCmd=1;
}
}
}
tcl_codify(NULL,myStr);
}
}
}
//! Handle \c proc statements.
static void tcl_command_PROC()
{
D
QCString myNs, myName;
Entry *myEntryNs;
Entry *myEntry;
tcl_scan *myScan = tcl.scan.at(0);
tcl_codify_cmd("keyword",0);
tcl_codify_cmd(NULL,1);
tcl_codify_cmd(NULL,2);
tcl_codify_cmd(NULL,3);
tcl_codify_cmd(NULL,4);
tcl_codify_cmd(NULL,5);
tcl_name(myScan->ns,(*tcl.list_commandwords.at(2)).utf8(),myNs,myName);
if (myNs.length())
{
myEntryNs = tcl_entry_namespace(myNs);
}
else
{
myEntryNs = tcl_entry_namespace(myScan->ns);
}
//why not needed here? tcl.fn.remove(myName);
tcl.entry_current->section = Entry::FUNCTION_SEC;
tcl.entry_current->mtype = Method;
tcl.entry_current->name = myName;
tcl.entry_current->startLine = tcl.line_command;
tcl.entry_current->bodyLine = tcl.line_body0;
tcl.entry_current->endBodyLine = tcl.line_body1;
tcl_protection(tcl.entry_current);
tcl_command_ARGLIST(*tcl.list_commandwords.at(4));
myEntryNs->addSubEntry(tcl.entry_current);
myEntry = tcl.entry_current;
tcl.fn.insert(myName,myEntry);
myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(6),
myEntryNs->name,NULL,myEntry);
}
//! Handle \c itcl::body statements and \c oo::define method and method inside \c itcl::class statements.
static void tcl_command_METHOD()
{
D
QCString myNs, myName;
Entry *myEntryCl, *myEntry;
tcl_scan *myScan = tcl.scan.at(0);
tcl_codify_cmd("keyword",0);
tcl_codify_cmd(NULL,1);
tcl_codify_cmd(NULL,2);
tcl_codify_cmd(NULL,3);
tcl_codify_cmd(NULL,4);
tcl_codify_cmd(NULL,5);
tcl_name(myScan->ns,(*tcl.list_commandwords.at(2)).utf8(),myNs,myName);
if (myNs.length())
{
myEntryCl = tcl_entry_class(myNs);
}
else
{
myNs = myScan->ns;
myEntryCl = myScan->entry_cl;
}
// needed in case of more then one definition p.e. itcl::method and itcl::body
// see also bug #
tcl.fn.remove(myName);
tcl.entry_current->section = Entry::FUNCTION_SEC;
tcl.entry_current->mtype = Method;
tcl.entry_current->name = myName;
tcl.entry_current->startLine = tcl.line_command;
tcl.entry_current->bodyLine = tcl.line_body0;
tcl.entry_current->endBodyLine = tcl.line_body1;
tcl_protection(tcl.entry_current);
tcl_command_ARGLIST(*tcl.list_commandwords.at(4));
myEntryCl->addSubEntry(tcl.entry_current);
tcl.fn.insert(myName,tcl.entry_current);
myEntry = tcl.entry_current;
myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(6),
myNs, myEntryCl, myEntry);
}
//! Handle \c constructor statements inside class definitions.
static void tcl_command_CONSTRUCTOR()
{
D
QCString myNs, myName;
Entry *myEntryCl, *myEntry;
tcl_scan *myScan = tcl.scan.at(0);
tcl_codify_cmd("keyword",0);
tcl_codify_cmd(NULL,1);
tcl_codify_cmd(NULL,2);
tcl_codify_cmd(NULL,3);
tcl_name(myScan->ns,(*tcl.list_commandwords.at(0)).utf8(),myNs,myName);
if (myNs.length())
{
myEntryCl = tcl_entry_class(myNs);
}
else
{
myNs = myScan->ns;
myEntryCl = myScan->entry_cl;
}
tcl.entry_current->section = Entry::FUNCTION_SEC;
tcl.entry_current->mtype = Method;
tcl.entry_current->name = myName;
tcl.entry_current->startLine = tcl.line_command;
tcl.entry_current->bodyLine = tcl.line_body0;
tcl.entry_current->endBodyLine = tcl.line_body1;
tcl_protection(tcl.entry_current);
tcl_command_ARGLIST(*tcl.list_commandwords.at(2));
myEntryCl->addSubEntry(tcl.entry_current);
myEntry = tcl.entry_current;
tcl.fn.insert(myName,myEntry);
myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(4),
myNs, myEntryCl, myEntry);
}
//! Handle \c destructor statements inside class definitions.
static void tcl_command_DESTRUCTOR()
{
D
QCString myNs, myName;
Entry *myEntryCl, *myEntry;
tcl_scan *myScan = tcl.scan.at(0);
tcl_codify_cmd("keyword",0);
tcl_codify_cmd(NULL,1);
tcl_name(myScan->ns,(*tcl.list_commandwords.at(0)).utf8(),myNs,myName);
if (myNs.length())
{
myEntryCl = tcl_entry_class(myNs);
}
else
{
myNs = myScan->ns;
myEntryCl = myScan->entry_cl;
}
tcl.entry_current->section = Entry::FUNCTION_SEC;
tcl.entry_current->mtype = Method;
tcl.entry_current->name = myName;
tcl.entry_current->startLine = tcl.line_command;
tcl.entry_current->bodyLine = tcl.line_body0;
tcl.entry_current->endBodyLine = tcl.line_body1;
tcl_protection(tcl.entry_current);
myEntryCl->addSubEntry(tcl.entry_current);
myEntry = tcl.entry_current;
tcl.fn.insert(myName,myEntry);
myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(2),
myNs, myEntryCl, myEntry);
}
//! Handle \c namespace statements.
static void tcl_command_NAMESPACE()
{
D
QCString myNs, myName, myStr;
Entry *myEntryNs=NULL;
tcl_scan *myScan = tcl.scan.at(0);
tcl_codify_cmd("keyword",0);
tcl_codify_cmd(NULL,1);
tcl_codify_cmd("keyword",2);
tcl_codify_cmd(NULL,3);
tcl_codify_cmd(NULL,4);
tcl_codify_cmd(NULL,5);
tcl_name(myScan->ns,(*tcl.list_commandwords.at(4)).utf8(),myNs,myName);
if (myNs.length())
{
myName = myNs+"::"+myName;
}
tcl.entry_current->section = Entry::NAMESPACE_SEC;
tcl.entry_current->name = myName;
tcl.entry_current->startLine = tcl.line_command;
tcl.entry_current->bodyLine = tcl.line_body0;
tcl.entry_current->endBodyLine = tcl.line_body1;
tcl.entry_main->addSubEntry(tcl.entry_current);
tcl.ns.insert(myName,tcl.entry_current);
myEntryNs = tcl.entry_current;
myStr = (*tcl.list_commandwords.at(6)).utf8();
if (tcl.list_commandwords.count() > 7)
{
for (uint i=7;i<tcl.list_commandwords.count();i++)
{
myStr.append((*tcl.list_commandwords.at(i)).utf8());
}
tcl.word_is=' ';
}
myScan = tcl_scan_start(tcl.word_is,myStr, myName, NULL, NULL);
}
//! Handle \c itcl::class statements.
static void tcl_command_ITCL_CLASS()
{
D
QCString myNs, myName, myStr;
Entry *myEntryCl;
tcl_scan *myScan = tcl.scan.at(0);
tcl_codify_cmd("keyword",0);
tcl_codify_cmd(NULL,1);
tcl_codify_cmd("NULL",2);
tcl_codify_cmd("NULL",3);
tcl_name(myScan->ns,(*tcl.list_commandwords.at(2)).utf8(),myNs,myName);
if (myNs.length())
{
myName = myNs+"::"+myName;
}
tcl.entry_current->section = Entry::CLASS_SEC;
tcl.entry_current->name = myName;
tcl.entry_current->startLine = tcl.line_command;
tcl.entry_current->bodyLine = tcl.line_body0;
tcl.entry_current->endBodyLine = tcl.line_body1;
tcl.entry_main->addSubEntry(tcl.entry_current);
tcl.cl.insert(myName,tcl.entry_current);
myEntryCl = tcl.entry_current;
myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(4),
myName, myEntryCl, NULL);
}
//! Handle \c oo::class statements.
static void tcl_command_OO_CLASS()
{
D
QCString myNs, myName, myStr;
//Entry *myEntryNs;
Entry *myEntryCl;
tcl_scan *myScan = tcl.scan.at(0);
tcl_codify_cmd("keyword",0);
tcl_codify_cmd(NULL,1);
tcl_codify_cmd("NULL",2);
tcl_codify_cmd("NULL",3);
tcl_codify_cmd("NULL",4);
tcl_codify_cmd("NULL",5);
tcl_name(myScan->ns,(*tcl.list_commandwords.at(4)).utf8(),myNs,myName);
if (myNs.length())
{
myName = myNs+"::"+myName;
}
tcl.entry_current->section = Entry::CLASS_SEC;
tcl.entry_current->name = myName;
tcl.entry_current->startLine = tcl.line_command;
tcl.entry_current->bodyLine = tcl.line_body0;
tcl.entry_current->endBodyLine = tcl.line_body1;
tcl.entry_main->addSubEntry(tcl.entry_current);
//myEntryNs = tcl_entry_namespace(myName);
tcl.cl.insert(myName,tcl.entry_current);
myEntryCl = tcl.entry_current;
myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(6),
myName, myEntryCl, NULL);
}
//! Handle \c oo::define statements.
static void tcl_command_OO_DEFINE()
{
D
QCString myNs, myName, myStr;
Entry *myEntryCl;
tcl_scan *myScan = tcl.scan.at(0);
tcl_codify_cmd("keyword",0);
tcl_codify_cmd(NULL,1);
tcl_codify_cmd("NULL",2);
tcl_codify_cmd("NULL",3);
tcl_name(myScan->ns,(*tcl.list_commandwords.at(2)).utf8(),myNs,myName);
if (myNs.length())
{
myName = myNs+"::"+myName;
}
myEntryCl = tcl_entry_class(myName);
myStr = (*tcl.list_commandwords.at(4)).utf8();
if (tcl.list_commandwords.count() > 5)
{
for (uint i=5;i<tcl.list_commandwords.count();i++)
{
myStr.append((*tcl.list_commandwords.at(i)).utf8());
}
tcl.word_is=' ';
}
myScan = tcl_scan_start(tcl.word_is,myStr,myName,myEntryCl,NULL);
}
//! Handle \c variable statements.
static void tcl_command_VARIABLE(int inclass)
{
D
QCString myNs, myName;
Entry *myEntry;
tcl_scan *myScan = tcl.scan.at(0);
tcl_codify_cmd("keyword",0);
for (unsigned int i=1; i< tcl.list_commandwords.count(); i++)
{
tcl_codify_cmd(NULL,i);
}
tcl_name(myScan->ns,(*tcl.list_commandwords.at(2)).utf8(),myNs,myName);
if (myNs.length())
{// qualified variables go into namespace
myEntry = tcl_entry_namespace(myNs);
tcl.entry_current->stat = true;
}
else
{
if (inclass)
{
myEntry = myScan->entry_cl;
tcl.entry_current->stat = false;
}
else
{
myEntry = tcl_entry_namespace(myScan->ns);
tcl.entry_current->stat = true;
}
}
tcl.entry_current->section = Entry::VARIABLE_SEC;
tcl.entry_current->name = myName;
tcl.entry_current->startLine = tcl.line_command;
tcl.entry_current->bodyLine = tcl.line_body0;
tcl.entry_current->endBodyLine = tcl.line_body1;
tcl_protection(tcl.entry_current);
myEntry->addSubEntry(tcl.entry_current);
tcl.entry_current = tcl_entry_new();
}
//! Handling of command parsing.
//! what=0 -> ...
//! what=1 -> ...
//! what=-1 -> ...
static void tcl_command(int what,const char *text)
{
int myLine=0;
if (what==0)
{
tcl.scan.at(0)->line1=tclscanYYlineno;// current line in scan context
tcl.line_body0=tclscanYYlineno;// start line of command
tcl_inf("<- %s\n",text);
yy_push_state(COMMAND);
tcl.list_commandwords.clear();
tcl.string_command="";
tcl.string_last="";
tcl.command=1;
return;
}
else if (what==1)
{
if (tcl.string_last.length())
{
tcl.list_commandwords.append(tcl.string_last);
tcl.string_last="";
}
if (text)
{
tcl.list_commandwords.append(text);
}
return;
}
else if (what!=-1)
{// should not happen
tcl_err("what %d\n",what);
return;
}
QCString myText = text;
tcl_inf("->\n");
if (tcl.command==0)
{
return; //TODO check on inside comment
}
if (tcl.string_last != "")
{// get last word
tcl.list_commandwords.append(tcl.string_last);
tcl.string_last="";
}
yy_pop_state();
// check command
QCString myStr = (*tcl.list_commandwords.at(0)).utf8();
int myLevel = 0;
Protection myProt = tcl.protection;
if (tcl.list_commandwords.count() < 3)
{
tcl_command_OTHER();
goto command_text;
}
// remove leading "::" and apply TCL_SUBST
if (myStr.left(2)=="::") myStr = myStr.mid(2);
if (tcl.config_subst.contains(myStr))
{
myStr=tcl.config_subst[myStr].utf8();
}
if (myStr=="private")
{
tcl.protection = Private;
myLevel = 1;
}
else if (myStr=="protected")
{
tcl.protection = Protected;
myLevel = 1;
}
else if (myStr=="public")
{
tcl.protection = Public;
myLevel = 1;
}
if (myLevel)
{
tcl_codify_cmd("keyword",0);
tcl_codify_cmd(NULL,1);
tcl.list_commandwords.remove(tcl.list_commandwords.at(1));
tcl.list_commandwords.remove(tcl.list_commandwords.at(0));
if (tcl.list_commandwords.count()==1)
{
tcl_scan *myScan = tcl.scan.at(0);
myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(0),
myScan->ns,myScan->entry_cl,myScan->entry_fn);
myProt = tcl.protection;
goto command_end;
}
myStr = (*tcl.list_commandwords.at(0)).utf8();
// remove leading "::" and apply TCL_SUBST
if (myStr.left(2)=="::") myStr = myStr.mid(2);
if (tcl.config_subst.contains(myStr))
{
myStr=tcl.config_subst[myStr].utf8();
}
}
if (myStr=="proc")
{
if (tcl.list_commandwords.count() == 5)
{// itcl::proc
tcl.list_commandwords.append("");
tcl.list_commandwords.append("");
}
if (tcl.list_commandwords.count() != 7) {myLine=__LINE__;goto command_warn;}
tcl_command_PROC();
goto command_end;
}
if (myStr=="method")
{
if (tcl.list_commandwords.count() == 5)
{// itcl::method
tcl.list_commandwords.append("");
tcl.list_commandwords.append("");
}
if (tcl.list_commandwords.count() != 7) {myLine=__LINE__;goto command_warn;}
tcl_command_METHOD();
goto command_end;
}
if (myStr=="constructor")
{
if (tcl.list_commandwords.count() != 5) {myLine=__LINE__;goto command_warn;}
tcl_command_CONSTRUCTOR();
goto command_end;
}
if (myStr=="destructor")
{
if (tcl.list_commandwords.count() != 3) {myLine=__LINE__;goto command_warn;}
tcl_command_DESTRUCTOR();
goto command_end;
}
if (myStr=="namespace")
{
if ((*tcl.list_commandwords.at(2)).utf8()=="eval")
{
if (tcl.list_commandwords.count() < 7) {myLine=__LINE__;goto command_warn;}
tcl_command_NAMESPACE();
goto command_end;
}
tcl_command_OTHER();
goto command_text;
}
if (myStr=="itcl::class")
{
if (tcl.list_commandwords.count() != 5) {myLine=__LINE__;goto command_warn;}
tcl_command_ITCL_CLASS();
goto command_end;
}
if (myStr=="itcl::body")
{
if (tcl.list_commandwords.count() != 7) {myLine=__LINE__;goto command_warn;}
tcl_command_METHOD();
goto command_end;
}
if (myStr=="oo::class")
{
if ((*tcl.list_commandwords.at(2)).utf8()=="create")
{
if (tcl.list_commandwords.count() != 7) {myLine=__LINE__;goto command_warn;}
tcl_command_OO_CLASS();
goto command_end;
}
tcl_command_OTHER();
goto command_text;
}
if (myStr=="oo::define")
{
if (tcl.list_commandwords.count() < 5) {myLine=__LINE__;goto command_warn;}
tcl_command_OO_DEFINE();
goto command_end;
}
if (myStr=="variable")
{
if (tcl.list_commandwords.count() < 3) {myLine=__LINE__;goto command_warn;}
if (tcl.scan.at(0)->entry_fn == NULL)
{// only parsed outside functions
tcl_command_VARIABLE(tcl.scan.at(0)->entry_cl!=NULL&&tcl.scan.at(0)->entry_cl->name!="");
goto command_text;
}
}
if (myStr=="common")
{
if (tcl.list_commandwords.count() < 3) {myLine=__LINE__;goto command_warn;}
if (tcl.scan.at(0)->entry_fn == NULL)
{// only parsed outside functions
tcl_command_VARIABLE(0);
goto command_text;
}
}
if (myStr=="inherit" || myStr=="superclass")
{
if (tcl.list_commandwords.count() < 3) {myLine=__LINE__;goto command_warn;}
if (tcl.scan.at(0)->entry_cl!=NULL&&tcl.scan.at(0)->entry_cl->name!="")
{
for (unsigned int i = 2; i < tcl.list_commandwords.count(); i = i + 2)
{
tcl.scan.at(0)->entry_cl->extends->append(new BaseInfo((*tcl.list_commandwords.at(i)).utf8(),Public,Normal));
}
}
goto command_end;
}
/*
* Start of internal tcl keywords
* Ready: if, for, foreach, while
* TODO: switch, eval, ?
*/
if (myStr=="for")
{
if (tcl.list_commandwords.count() != 9) {myLine=__LINE__;goto command_warn;}
tcl_command_FOR();
goto command_end;
}
if (myStr=="foreach")
{
if (tcl.list_commandwords.count() < 7 || tcl.list_commandwords.count()%2==0) {myLine=__LINE__;goto command_warn;}
tcl_command_FOREACH();
goto command_end;
}
/*
if expr1 ?then? body1 elseif expr2 ?then? body2 elseif ... ?else? ?bodyN?
*/
if (myStr=="if" && tcl.list_commandwords.count() > 4)
{
QStringList myType;
myType << "keyword" << "NULL" << "script" << "NULL";
char myState='x';// last word: e'x'pr 't'hen 'b'ody 'e'lse else'i'f..
for (unsigned int i = 4; i < tcl.list_commandwords.count(); i = i + 2)
{
QCString myStr=(*tcl.list_commandwords.at(i)).utf8();
if (myState=='x')
{
if (myStr=="then")
{
myState='t';
myType << "keyword" << "NULL";
}
else
{
myState='b';
myType << "script" << "NULL";
}
}
else if (myState=='t')
{
myState='b';
myType << "script" << "NULL";
}
else if (myState=='b')
{
if (myStr=="elseif") {
myState='i';
myType << "keyword" << "NULL";
}
else if (myStr=="else" && i==tcl.list_commandwords.count()-3)
{
myState = 'b';
myType << "keyword" << "NULL" << "script";
i = tcl.list_commandwords.count();
}
else if (i==tcl.list_commandwords.count()-1)
{
myState = 'b';
myType << "script";
i = tcl.list_commandwords.count();
}
else
{
myLine=__LINE__;goto command_warn;
}
}
else if (myState=='i')
{
myState='x';
myType << "script" << "NULL";
}
}
if (myState != 'b') {myLine=__LINE__;goto command_warn;}
tcl_command_IF(myType);
goto command_end;
}
if (myStr=="while")
{
if (tcl.list_commandwords.count() != 5) {myLine=__LINE__;goto command_warn;}
tcl_command_WHILE();
goto command_end;
}
tcl_command_OTHER();
goto command_text;
command_warn:// print warning message because of wrong used syntax
tcl_war("%d count=%d: %s\n",myLine,tcl.list_commandwords.count(),tcl.list_commandwords.join(" ").ascii());
tcl_command_OTHER();
command_text:// print remaining text as comment
if (!myText.isEmpty()) tcl_codify("comment",myText);
myText = "";
command_end:// add remaining text to current context
if (!myText.isEmpty()) tcl.scan.at(0)->after << "comment" << myText;
tcl.list_commandwords.clear();
tcl.command = 0;
tcl.protection = myProt;
}
//----------------------------------------------------------------------------
//! Common initializations.
static void tcl_init()
{
// Get values from option TCL_SUBST
tcl.config_subst.clear();
if (Config::instance()->get("TCL_SUBST"))
{
QStrList myStrList = Config_getList("TCL_SUBST");
const char *s=myStrList.first();
while (s)
{
QCString myStr=s;
int i=myStr.find('=');
if (i>0)
{
QCString myName=myStr.left(i).stripWhiteSpace();
QCString myValue=myStr.right(myStr.length()-i-1).stripWhiteSpace();
if (!myName.isEmpty() && !myValue.isEmpty())
tcl_inf("TCL_SUBST: use '%s'\n",s);
tcl.config_subst[myName] = myValue;
}
s = myStrList.next();
}
}
if (tcl.input_string.at(tcl.input_string.length()-1) == '\n')
{
tcl.input_string[tcl.input_string.length()-1] = 0x1A;
}
else
{
tcl.input_string += 0x1A;
}
tcl.code = NULL;
tcl.code_font=NULL;
tcl.code_line=1;
tcl.code_linenumbers=1;
tcl.config_autobrief = Config_getBool("JAVADOC_AUTOBRIEF");
tcl.input_position = 0;
tcl.file_name = NULL;
tcl.this_parser = NULL;
tcl.command=0;
tcl.comment=0;
tcl.brace_level=0;
tcl.bracket_level=0;
tcl.bracket_quote=0;
tcl.word_is=' ';
tcl.string_command="";
tcl.string_commentline="";
tcl.string_commentcodify="";
tcl.string_comment = "";
tcl.string_last = "";
tcl.entry_main = NULL;
tcl.entry_file = NULL;
tcl.entry_current = NULL;
tcl.entry_inside = NULL;
tcl.list_commandwords.clear();
tcl.scan.clear();
tcl.ns.clear();
tcl.cl.clear();
tcl.fn.clear();
tclscanYYlineno = 1;
tcl.protection = Public;
tcl.memberdef = NULL;
}
//! Start parsing.
static void tcl_parse(const QCString ns, const QCString cls)
{
tcl_scan *myScan;
tcl.entry_file = tcl_entry_new();
tcl.entry_file->name = tcl.file_name;
tcl.entry_file->section = Entry::SOURCE_SEC;
tcl.entry_file->protection = Public;
tcl.entry_main->addSubEntry(tcl.entry_file);
Entry *myEntry=tcl_entry_new();
myEntry->name="";
tcl.entry_main->addSubEntry(myEntry);
tcl.ns.insert("::",myEntry);
tcl.entry_current = tcl_entry_new();
tclscanYYrestart( tclscanYYin );
BEGIN( TOP );
tclscanYYlineno=1;
myScan = new tcl_scan;
myScan->type[0]=' ';myScan->type[1]='\n';
myScan->after.clear();
myScan->line0=tclscanYYlineno;
myScan->line1=tclscanYYlineno;
myScan->buffer_state=YY_CURRENT_BUFFER;
myScan->ns=ns;
myScan->entry_cl=tcl_entry_class(cls);
myScan->entry_fn=NULL;
tcl.entry_inside = tcl.entry_file;
myScan->entry_scan = tcl.entry_inside;
tcl.scan.insert(0,myScan);
tclscanYYlex();
tcl.scan.clear();
tcl.ns.clear();
tcl.cl.clear();
tcl.fn.clear();
tcl.entry.clear();
}
//! Parse text file and build up entry tree.
void TclLanguageScanner::parseInput(const char *fileName,const char *input,Entry *root)
{
QFile myFile;
tcl_inf("%s\n",fileName);
myFile.setName(fileName);
if (!myFile.open(IO_ReadOnly)) return;
if (strlen(input)<1) return;
tcl.input_string = input;
if (tcl.input_string.length()<1) return;
msg("Parsing %s...\n",fileName);
groupEnterFile(fileName,tclscanYYlineno);
tcl_init();
tcl.code = NULL;
tcl.file_name = fileName;
tcl.this_parser = this;
tcl.entry_main = root; /* toplevel entry */
tcl_parse("","");
groupLeaveFile(tcl.file_name,tclscanYYlineno);
root->program.resize(0);
myFile.close();
}
//! Parse file and codify.
void TclLanguageScanner::parseCode(CodeOutputInterface & codeOutIntf,
const char * scopeName,
const QCString & input,
bool isExampleBlock,
const char * exampleName,
FileDef * fileDef,
int startLine,
int endLine,
bool inlineFragment,
MemberDef *memberDef,
bool showLineNumbers,
Definition *searchCtx
)
{
(void)scopeName;
(void)exampleName;
(void)fileDef;
(void)endLine;
(void)inlineFragment;
(void)searchCtx;
if (input.length()<1) return;
tcl.input_string = input;
QCString myNs="";
QCString myCls="";
if (memberDef)
{
if (memberDef->getClassDef())
{
myCls = memberDef->getClassDef()->displayName();
myNs = myCls;
}
else if (memberDef->getNamespaceDef())
{
myNs = memberDef->getNamespaceDef()->displayName();
}
}
QString myStr="Codifying..";
if (scopeName)
{
myStr +=" scope=";
myStr+=scopeName;
}
if (exampleName)
{
myStr+=" example=";
myStr+=exampleName;
}
if (memberDef)
{
myStr+=" member=";
myStr+=memberDef->memberTypeName();
myStr+=" ";
myStr+=memberDef->qualifiedName();
}
if (fileDef)
{
myStr+=" file=";
myStr+=fileDef->fileName();
}
tcl_inf("%s (%d,%d) %d %d\n",myStr.ascii(),startLine,endLine,isExampleBlock,inlineFragment);
//tcl_inf("%s\n"input.data());
if (isExampleBlock)
{
tcl_codify(NULL,input);
return;
}
tcl_init();
tcl.memberdef = memberDef;
tcl.code = &codeOutIntf;
if (startLine<0)
{
startLine=1;
}
tclscanYYlineno=startLine;
tcl.code_linenumbers = showLineNumbers;
tcl.code_line=tclscanYYlineno;
if (tcl.code_linenumbers)
{
tcl.code->writeLineNumber(0,0,0,tcl.code_line);
}
tcl.file_name = "";
tcl.this_parser = NULL;
tcl.entry_main = tcl_entry_new();
tcl_parse(myNs,myCls);
tcl.scan.clear();
tcl.ns.clear();
tcl.cl.clear();
tcl.fn.clear();
tcl.entry.clear();
}
bool TclLanguageScanner::needsPreprocessing(const QCString &extension)
{
(void)extension;
return FALSE;
}
void TclLanguageScanner::resetCodeParserState()
{
}
void TclLanguageScanner::parsePrototype(const char *text)
{
(void)text;
}
static int yyread(char *buf,int max_size)
{
int c=0;
*buf = '\0';
while ( c < max_size && tcl.input_string.at(tcl.input_position) )
{
*buf = tcl.input_string.at(tcl.input_position++) ;
c++; buf++;
}
//printf("Read from=%d size=%d max=%d c=%d\n",tcl.input_position,strlen(&tcl.input_string[tcl.input_position]),max_size,c);
return c;
}
//----------------------------------------------------------------------------
// to avoid a warning
void tclDummy()
{
yy_top_state();
}
#if !defined(YY_FLEX_SUBMINOR_VERSION)
//----------------------------------------------------------------------------
extern "C" { // some bogus code to keep the compiler happy
void tclscannerYYdummy() { yy_flex_realloc(0,0); }
}
#endif
|