File: source_trav.adb

package info (click to toggle)
asis 2007-4
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 7,832 kB
  • ctags: 34
  • sloc: ada: 93,665; makefile: 225
file content (2792 lines) | stat: -rw-r--r-- 120,401 bytes parent folder | download
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
------------------------------------------------------------------------------
--                                                                          --
--                      DISPLAY_SOURCE COMPONENTS                           --
--                                                                          --
--                         S O U R C E _ T R A V                            --
--                                                                          --
--                                 B o d y                                  --
--                                                                          --
--                            $Revision: 15040 $
--                                                                          --
--            Copyright (c) 1995-2002, Free Software Foundation, Inc.       --
--                                                                          --
-- Display_Source is free software; you can redistribute it and/or modify it--
-- under terms of the  GNU General Public License  as published by the Free --
-- Software Foundation;  either version 2,  or  (at your option)  any later --
-- version. Display_Source is distributed in the hope  that it will be use- --
-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
-- CHANTABILITY or  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General  --
-- Public License for more details. You should have received a copy of the  --
-- GNU General Public License distributed with GNAT; see file COPYING. If   --
-- not, write to the Free Software Foundation, 59 Temple Place Suite 330,   --
-- Boston, MA 02111-1307, USA.                                              --
--                                                                          --
-- Display_Source is distributed as a part of the ASIS implementation for   --
-- GNAT (ASIS-for-GNAT).                                                     --
--                                                                          --
-- The   original   version   of  Display_Source  has  been  developed  by  --
-- Jean-Charles  Marteau and Serge Reboul,  ENSIMAG  High School Graduates  --
-- (Computer sciences)  Grenoble,  France  in  Sema Group Grenoble, France. --
--                                                                          --
-- Display_Source is now maintained by Ada Core Technologies Inc            --
-- (http://www.gnat.com).                                                   --
------------------------------------------------------------------------------

-----------------------------------------------------------------
-- This package is part of the ASIS application display_source --
-----------------------------------------------------------------
with Ada;
with Ada.Text_IO;

with Ada.Characters.Handling; use Ada.Characters.Handling; --  ???

with Asis;

with Asis.Compilation_Units;
with Asis.Clauses;
with Asis.Declarations;
with Asis.Definitions;
with Asis.Elements;
with Asis.Expressions;
with Asis.Statements;

package body Source_Trav is

   use Asis;
   --  to make all the literals from Element classification hierarchy
   --  directly visible

   -----------------------
   -- Local subprograms --
   -----------------------

   --  some basic tool procedures ...

   function First_Element (List : Asis.Element_List) return Asis.Element;

   function Is_Here (Element : Asis.Element) return Boolean;

   function Count (List : Asis.Element_List) return Natural;

   function First_Element (List : Asis.Element_List) return Asis.Element is
   begin
      return (List (List'First));
   end First_Element;

   function Is_Here (Element : Asis.Element) return Boolean is
   begin
      return (Asis.Elements.Element_Kind (Element) /= Not_An_Element);
   end Is_Here;

   function Count (List : Asis.Element_List) return Natural is
   begin
      return List'Length;
   end Count;

   function Is_Private_Unit (Unit : Asis.Declaration) return Boolean;
   --  This function checks if Unit is declaration of a private library
   --  unit (if it is, the keyword "private" should be sent in the
   --  output of Display sourse.
   --  !!!
   --  Note,  that it would make sense to merge this function with
   --  sending the "private" string in the output stream

   function Unit_Body_Beginning
     (Unit   : Asis.Declaration;
      U_Kind : Asis.Declaration_Kinds)
      return String;
   --  forms and returns the starting part of the subprogram body declaration
   --  it may be
   --     "procedure "
   --  or
   --      "separate (<parent_unit_name>)
   --       procedure "
   --
   --  The second parameter indicates whether "procedure" or "function" keyword
   --  should be outputted.
   --  This is the fix for outputting the
   --  subunit having pragmas in context clause, the original code
   --  outputting "separate (<parent unit name>)" & ASCII.CR is commented
   --  out in Initiate_Source below

   ---------------------
   -- Is_Private_Unit --
   ---------------------

   function Is_Private_Unit (Unit : Asis.Declaration) return Boolean is
      U_Kind  : Asis.Declaration_Kinds :=
                             Asis.Elements.Declaration_Kind (Unit);
      Encl_CU : Asis.Compilation_Unit  :=
                             Asis.Elements.Enclosing_Compilation_Unit (Unit);
   begin
      return
        (U_Kind = A_Package_Declaration           or else
         U_Kind = A_Procedure_Declaration         or else
         U_Kind = A_Function_Declaration          or else
         U_Kind = A_Generic_Procedure_Declaration or else
         U_Kind = A_Generic_Function_Declaration  or else
         U_Kind = A_Generic_Package_Declaration)            and then
         Asis.Elements.Is_Equal
            (Unit, Asis.Elements.Unit_Declaration (Encl_CU))      and then
         Asis.Compilation_Units.Unit_Class (Encl_CU) = A_Private_Declaration;
   end Is_Private_Unit;

   --------------------------
   -- Unit_Body_Beginning --
   --------------------------

   function Unit_Body_Beginning
     (Unit   : Asis.Declaration;
      U_Kind : Asis.Declaration_Kinds)
      return String
   is
      Encl_CU : Asis.Compilation_Unit  :=
                             Asis.Elements.Enclosing_Compilation_Unit (Unit);

      function Parent_Prefix (Full_Name : String) return String;
      --  returns the name of the parent body from a full expanded Ada name
      --  of a subunit

      function Starting_Keyword
        (U_Kind : Asis.Declaration_Kinds)
         return String;
      --  returns "procedure " or "function ", depending on U_Kind
      --  ???!!! THE CODE IS VERY FAR FROM BEING GOOD

      function Parent_Prefix (Full_Name : String) return String is
         Index : Integer;
      begin
         if Full_Name = "" then
            return "";
            --  just in case
         end if;
         Index := Full_Name'Last;
         for I in reverse Full_Name'Range loop
            if Full_Name (I) = '.' then
               Index := I - 1;
               exit;
            end if;
         end loop;
         return Full_Name (Full_Name'First .. Index);
      end Parent_Prefix;

      function Starting_Keyword (U_Kind : Asis.Declaration_Kinds) return String
      is
      begin
         if U_Kind = A_Procedure_Body_Declaration then
            return "procedure ";
         elsif U_Kind = A_Package_Body_Declaration then
            return "package body ";
         elsif U_Kind = A_Task_Body_Declaration then
            return "task body ";
         elsif U_Kind = A_Protected_Body_Declaration then
            return "protected body ";
         elsif U_Kind = A_Function_Body_Declaration then
            return "function ";
         end if;

         --  just to avoid GNAT warnings
         return "";

      end Starting_Keyword;


   begin
      if (Asis.Elements.Is_Equal
           (Unit, Asis.Elements.Unit_Declaration (Encl_CU)))
            and then
         (Asis.Compilation_Units.Unit_Class (Encl_CU) = A_Separate_Body)
      then
         --  outputting the "separate (<parent unit name>)"
         return "separate (" &
                 Parent_Prefix (To_String
                   (Asis.Compilation_Units.Unit_Full_Name (Encl_CU))) &
                 ")" &
                 ASCII.CR &
                 Starting_Keyword (U_Kind);

      else
         return Starting_Keyword (U_Kind);
      end if;
   end Unit_Body_Beginning;

--------------------------------------------
--                                        --
--  Here is the pre procedure to provide  --
--  to Traverse_Element to make a source  --
--  display.                              --
--                                        --
--------------------------------------------

   ----------------------------------------------------------------
   --                                                            --
   -- Pre_Source user's guide :                                  --
   --                                                            --
   --  In this function, you'll use 3 procedures :               --
   --   - Send (String) that will send immediatly the          --
   --     string passed in argument.                             --
   --   - Push [(String, [ List_Kind, [Number of elements]])]  --
   --     which means : when you have passed Number of elements  --
   --     elements, print the String ... The List_Kind says if   --
   --     the program needs to print paranthesis or separator,   --
   --     (see the array Separator).                             --
   --   - Indent [ (Number_Of_Space) ] , when you use this    --
   --     procedure after a Push, it means that you want the     --
   --     corresponding element(s) to have one more indentation  --
   --     unit.                                                  --
   --   - Count (Asis.Element_List), He he, this a very basic  --
   --     function that returns the number of elements in a list --
   --   - Is_Here (Asis.Element), another basic one that       --
   --     returns a boolean  True : Element is realy An_Element  --
   --                        False : Element is Not_An_Element   --
   --                                                            --
   --  Of course you can still use any Asis function needed, for --
   --  instance to determine the number of element in a list.    --
   --                                                            --
   ----------------------------------------------------------------

   procedure Pre_Source
     (Element : in     Asis.Element;
      Control : in out Asis.Traverse_Control;
      State   : in out Info_Source) is

      ---------------------------------------
      --                                   --
      -- Some tool procedures to make cool --
      -- display of the sources.           --
      --                                   --
      ---------------------------------------

      -------------------------------------------------------------------
      --  Commit is called just before exiting of Pre_Source, if you look
      --  well you'll see that the Push procedure pushes them on a temporary
      --  stack (Tmp_Stack), that allows programmer to write his pushes in the
      --  logical (lexical) order. Then, the commit pours the Tmp_Stack into
      --  the main stack (Lexical_Stack) which reverses the order of the
      --  elements.
      procedure Commit;

      procedure Commit is
         Lex : Lexical_Node;
      begin
         while not Node_Stack.Is_Empty (State.Tmp_Stack) loop
            Node_Stack.Pop (State.Tmp_Stack, Lex);
            Node_Stack.Push (State.Lexical_Stack, Lex);
         end loop;
      exception
         when others =>
            Ada.Text_IO.Put_Line (" Exception raised in Commit");
            raise;
      end Commit;

      -------------------------------------------------------------------
      --  Indent is to be called just after having Pushed an element on the
      --  lexical stack. It specifies that you want to see more spaces
      --  Ada.Text_IO.Put in begining of line for the last
      --  lexical node you pushed. (The parameter is optional)
      procedure Indent
         (Number_Of_Space : Positive := State.Default_Indentation_Element);

      procedure Indent
         (Number_Of_Space : Positive := State.Default_Indentation_Element)
      is
         Lex : A_Lexical_Node := Node_Stack.Upper (State.Tmp_Stack);
      begin
         Lex.Indentation := State.Current_Indentation_Reference;
         Lex.Indentation_Reference :=
            Lex.Indentation_Reference + Number_Of_Space;
      exception
         when others =>
            Ada.Text_IO.Put_Line (" Exception raised in Indent");
            raise;
      end Indent;

      -------------------------------------------------------------------
      --  No_Space is used in the same way as Indent, after a Push, it says
      --  that there must be no space after the last element of the list.
      --  It is used by things like A.B.C  A'First and so on ....
      procedure No_Space;

      procedure No_Space is
         Lex : A_Lexical_Node := Node_Stack.Upper (State.Tmp_Stack);
      begin
         if Lex = null then
            return;
         else
            Lex.No_Space := True;
         end if;
      exception
         when others =>
            Ada.Text_IO.Put_Line (" Exception raised in No_Space");
            raise;
      end No_Space;

      -------------------------------------------------------------------
      --  indicates that it is a return_list if the first line number of
      --  the first element of the list is the same as the last line
      --  number of the last element of the list.
      --  We use it to deal with long list .... This way we display them
      --  the same way than in the original source ...
      procedure Check_If_Return_Separator (List : Asis.Element_List);

      procedure Check_If_Return_Separator (List : Asis.Element_List) is
         pragma Unreferenced (List);
         Lex : A_Lexical_Node := Node_Stack.Upper (State.Tmp_Stack);
      begin
         if Lex = null then
            return;
         else
   --       Lex.Return_List :=
   --         Asis.Text.First_Line_Number (List (List'First)) /=
   --         Asis.Text.Last_Line_Number  (List (List'Last));
            Lex.Return_List := False;
         end if;
      exception
         when others =>
            Ada.Text_IO.Put_Line (" Exception raised in Return_Separator");
            raise;
      end Check_If_Return_Separator;

      -------------------------------------------------------------------
      --  This function is not designed to be used a lot ...
      --  In fact it is used only in A_Function_Call to deal with
      --  Infixed operators ...
      procedure Infix;

      procedure Infix is
         Lex : A_Lexical_Node := Node_Stack.Upper (State.Tmp_Stack);
      begin
         if Lex = null then
            return;
         else
            Lex.Infixed_Operator := True;
         end if;
      exception
         when others =>
            Ada.Text_IO.Put_Line (" Exception raised in Infix");
            raise;
      end Infix;

      -------------------------------------------------------------------
      --  This function is only used in An_Operator_Symbol to know what to do,
      --  i.e if the operator is to be sent or pushed and if the quotes have
      --  to be Ada.Text_IO.Put or not ...
      function Is_Infix return Boolean;

      function Is_Infix return Boolean is
         Lex : A_Lexical_Node := Node_Stack.Upper (State.Lexical_Stack);
      begin
         if Lex = null then
            return False;
         else
            return Lex.Infixed_Operator;
         end if;
      exception
         when others =>
            Ada.Text_IO.Put_Line (" Exception raised in Is_Infix");
            raise;
      end Is_Infix;

      -------------------------------------------------------------------
      --  Push is to be used in the main procedure Pre_Source to push elements
      --  in the stack to say what to do. These elements are poped by the
      --  Pass_Element function.
      procedure Push
        (A_lexem              : String     := "";
         A_List_Kind          : List_Kinds := Not_In_A_List;
         A_Number_Of_Elements : Natural    := 1);

      procedure Push (A_lexem : String := "";
                      A_List_Kind : List_Kinds := Not_In_A_List;
                      A_Number_Of_Elements : Natural := 1) is

         Tmp_Lex : Lexical_Node :=
           (Lexem => new String'(A_lexem),
            List_Kind => A_List_Kind,
            Number_Of_Elements => A_Number_Of_Elements,
            --  The following are the default components
            First_Passed => False,
            Indentation => State.Current_Indentation_Reference,
            Indentation_Reference => State.Current_Indentation_Reference,
            No_Space => False,
            Return_List => False,
            Infixed_Operator => False);
      begin
         Node_Stack.Push (State.Tmp_Stack, Tmp_Lex);
      exception
         when others =>
            Ada.Text_IO.Put_Line (" Exception raised in Push");
            raise;
      end Push;

      -------------------------------------------------------------------
      --  Send is the text outAda.Text_IO.Put procedure
      --  The paramater Parametre_Indentation should not be set
      --  when used in procedure Pre_Source ...
      procedure Send
        (Text : String;
         Indentation_Parameter : Integer :=
            State.Current_Indentation_Reference;
         No_Space : Boolean := False);

      procedure Send
        (Text : String;
         Indentation_Parameter : Integer :=
            State.Current_Indentation_Reference;
         No_Space : Boolean := False) is
         Last : Natural := Text'First; -- it is the index of last CR found
      begin
         --  We don't print a final space, we'll do it after if it is
         --  allowed by the no_space parameter.

         if Text'Length = 0 then
            return;
            --  we need this for the fix for separate bodies
         end if;

         if Text'Last - Text'First + 1 > 0 and then
           Text (Text'Last) = ' '
         then
            Send
              (Text (Text'First .. Text'Last - 1),
               Indentation_Parameter,
               No_Space);
            State.Last_Char_Was_Space := True;
            return;
         end if;

         if State.Last_Char_Was_Space then
            if not No_Space then
               Ada.Text_IO.Put (" ");
               State.Horizontal_Position := State.Horizontal_Position + 1;
            end if;
            State.Last_Char_Was_Space := False;
         end if;

         --  Sends the text on the standard outAda.Text_IO.Put
         --  When a ASCII.CR is found it is replaced by a
         --  Ada.Text_IO.Put_Line  (which is in fact ASCII.CR & ASCII.LF),
         --  moreover the indentation is added
         for Index in Text'Range loop
            if Text (Index) = ASCII.CR then
               --  Let's print the indentation
               if State.Last_Char_Was_Return then
                  for Space in 1 .. Indentation_Parameter loop
                     Ada.Text_IO.Put (" ");
                  end loop;
                  State.Horizontal_Position := State.Horizontal_Position +
                    Indentation_Parameter;
                  --  no need to reset Last_Char_Was_Return to false ...
               end if;
               Ada.Text_IO.Put_Line (Text (Last .. Index - 1));
                  Last := Index + 1;
               State.Last_Char_Was_Return := True;
               State.Horizontal_Position := 0;
               State.Vertical_Position := State.Vertical_Position + 1;
            end if;
         end loop;

         if Last in Text'Range then
            --  Let's print the indentation
            if State.Last_Char_Was_Return then
               for Space in 1 .. Indentation_Parameter loop
                  Ada.Text_IO.Put (" ");
               end loop;
               State.Horizontal_Position := State.Horizontal_Position +
                 Indentation_Parameter;
               State.Last_Char_Was_Return := False;
            end if;
            Ada.Text_IO.Put (Text (Last .. Text'Last));
            State.Horizontal_Position := State.Horizontal_Position +
              Text'Last - Last + 1;
            if State.Horizontal_Position > State.Max_Line_Length then
               Ada.Text_IO.New_Line;
               State.Last_Char_Was_Return := True;
               State.Horizontal_Position := 0;
               State.Vertical_Position := State.Vertical_Position + 1;
            end if;
         end if;

      exception
         when others =>
            Ada.Text_IO.Put_Line (" Exception raised in Send");
            raise;
      end Send;

      -------------------------------------------------------------------
      procedure Pass_Element;
      procedure Pass_Element_1;


      --  Pass_Element is called each time we process an element, it counts
      --  them and displays the lexem when needed

      procedure Pass_Element is

         --  Processes any element of the stack with a
         --  number of elements equal to zero and
         --  decreases of one the first non null it finds.
         --  Eventualy sets First_Passed to False and sends
         --  the corresponding separator if needed ...
         Up : A_Lexical_Node := Node_Stack.Upper (State.Lexical_Stack);
         Trash : Lexical_Node;

      begin
         --  In that mode, it's not possible to handle the comments :
         --  for example what difference could be done between those
         --  situations :
         --
         --  procedure Hello  -- comment
         --  is begin  .....
         --
         --  procedure Hello is
         --  -- comment
         --  begin
         --    ...
         --

         if Up = null then
            --  This happens when the stack is empty
            return;
         end if;
         State.Current_Indentation_Reference := Up.Indentation_Reference;
         --  If there is NO element in the list :
         --   First_Passed = True and there is no point in printing
         --                       the separator (no remaining element)
         --   First_Passed = False and there is no point in printing
         --                        an opening parenthesis (no element in list)
         if Up.List_Kind = Is_Comma_Range_List and
           Up.First_Passed
         then
            Send ("range <> ");
         end if;

         if Up.Number_Of_Elements /= 0 then
            if Up.First_Passed and
              Up.List_Kind /= Not_In_A_List
            then
               --  Let's print the separator because there is an element after
               if Up.Return_List then
                  Send (Separator (Up.List_Kind).all & ASCII.CR);
               else
                  Send (Separator (Up.List_Kind).all & " ");
               end if;

            elsif Up.List_Kind in Parenthesized_List then
               --  Let's print the opening parenthesis
               Send ("(");
               Up.Indentation_Reference := State.Horizontal_Position + 1;
            end if;
            --  Now we'll see if we have to print a closing parenthesis
         elsif Up.First_Passed and
           Up.List_Kind in Parenthesized_List
         then
            --  Let's print the opening parenthesis
            Send (") ");
         end if;

         --  OK then now we are sure we have passed the first one ...
         Up.First_Passed := True;

         --  Now, let's see if we have to print the after string ...
         if Up.Number_Of_Elements = 0 then
            --  If so we print the lexem that was designed for that purpose.
            if Up.Lexem.all /= "" then
               Send (Up.Lexem.all,
                      Up.Indentation,
                      Up.No_Space);
            end if;
            --  And we get rid of it
            Node_Stack.Pop (State.Lexical_Stack, Trash);
            --  Beware !! after that Up is not available !!
            --  (in fact it is but only bad guys would use it ..)
            Up := null;
            --  as the counter was 0, we pass another one ...
            Pass_Element_1;
         else
            Up.Number_Of_Elements := Up.Number_Of_Elements - 1;
         end if;
      exception
         when others =>
            Ada.Text_IO.Put_Line (" Exception raised in Pass_Element");
            raise;
      end Pass_Element;

      procedure Pass_Element_1 is
      begin
         Pass_Element;
      end Pass_Element_1;

      --  The following procedures are 'user defined' they are here only
      --  to make things simplier ....
      function Function_Call_Operator return String;

      function Function_Call_Operator return String is
         Op : String := To_String (Asis.Expressions.Name_Image (Element));
      begin
         return Op (Op'First + 1 .. Op'Last - 1) & " ";
      end Function_Call_Operator;

      --  Helps displaying labels before statements ..
      --  Element should be a Statement ..
      --  if not, an Inapropriate_Element is raised
      procedure Send_Label (Text : String);

      procedure Send_Label (Text : String) is
         Nb_Labels : Natural := Count (Asis.Statements.Label_Names (Element));
      begin
         if Nb_Labels > 0 then
            Send ("<< ");

            for Index in 2 .. Nb_Labels loop
               Push (">>" & ASCII.CR & "<< ");
            end loop;
            Push (">>" & ASCII.CR & Text);
         else
            Send (Text);
         end if;
      end Send_Label;

      --  Element is a global variable here .. :)
      --  use the parameter Text when you need to insert a 'tagged' keyword
      --  in the trait string.
      function Trait_String
        (Text : String := "")
         return String;

      function Trait_String (Text : String := "")
                             return String is
      begin
         case Asis.Elements.Trait_Kind (Element) is
            when Not_A_Trait =>
               --   return "<<Node Not_A_Trait>> ";
               return ""; -- because i'm fed up with the component bug ...
            when An_Ordinary_Trait =>
               return Text;
            when An_Aliased_Trait =>
               return "aliased ";
            when An_Access_Definition_Trait =>
               return "access ";
            when A_Reverse_Trait =>
               return "reverse ";
            when A_Private_Trait =>
               return Text & "private ";
            when A_Limited_Trait =>
               return Text & "limited ";
            when A_Limited_Private_Trait =>
               return Text & "limited private ";
            when An_Abstract_Trait =>
               return "abstract " & Text;
            when An_Abstract_Private_Trait =>
               return "abstract " & Text & "private ";
            when An_Abstract_Limited_Trait =>
               return "abstract " & Text & "limited ";
            when An_Abstract_Limited_Private_Trait =>
               return "abstract " & Text & "limited private ";
         end case;
      end Trait_String;

      --  to keep the size of some lists
      L, M, N : Integer := 0;

   begin
      Pass_Element;
      if State.Finishing_Traversal then
         return;
      end if;

      case Asis.Elements.Element_Kind (Element) is
         when Not_An_Element =>
            null;
         when A_Pragma =>
            case Asis.Elements.Pragma_Kind (Element) is
               when Not_A_Pragma =>
                  Ada.Text_IO.Put ("<<Node Not_A_Pragma>>");
               when others =>
                  Send
                    ("pragma " &
                      To_String (Asis.Elements.Pragma_Name_Image (Element)) &
                     " ");

                  L := Count (Asis.Elements.Pragma_Argument_Associations
                         (Element));

                  Push (";" & ASCII.CR,
                        Is_Comma_List,
                        L);
            end case;
         when A_Defining_Name =>
            case Asis.Elements.Defining_Name_Kind (Element) is
               when Not_A_Defining_Name =>
                  Ada.Text_IO.Put ("<<Node Not_A_Defining_Name>>");
               when A_Defining_Identifier |
                 A_Defining_Character_Literal |
                 A_Defining_Enumeration_Literal =>
                  Send
                    (To_String (Asis.Declarations.Defining_Name_Image
                       (Element))
                     & " ");
               when A_Defining_Operator_Symbol =>
                  Send
                     (To_String (Asis.Declarations.Defining_Name_Image
                        (Element))
                      & " ");
               when A_Defining_Expanded_Name =>
                  Send
                    (To_String (Asis.Declarations.Defining_Name_Image
                       (Element))
                     & " ");
                  --  don't process the prefix and selector ...
                  Control := Asis.Abandon_Children;
            end case;
         when A_Declaration =>
            case Asis.Elements.Declaration_Kind (Element) is
               when Not_A_Declaration =>
                  --  An unexpected element
                  Ada.Text_IO.Put ("<<Node Not_A_Declaration>>");
               when An_Ordinary_Type_Declaration =>             -- 3.2.1
                  Send ("type ");
                  if Is_Here (Asis.Declarations.Discriminant_Part
                       (Element))
                  then
                     Push;
                  end if;
                  Push ("is ");
                  Push (";" & ASCII.CR);
               when A_Task_Type_Declaration =>                  -- 3.2.1
                  Send ("task type ");
                  if Is_Here (Asis.Declarations.Discriminant_Part
                     (Element))
                  then
                     Push;
                  end if;
                  if Is_Here (Asis.Declarations.Type_Declaration_View
                     (Element))
                  then
                     Push ("is" & ASCII.CR);
                     Push (To_String (Asis.Declarations.Defining_Name_Image
                             (First_Element (Asis.Declarations.Names
                                (Element)))) &
                           ";" & ASCII.CR); -- There is at least the name
                  else
                     Push (";" & ASCII.CR); -- There is at least the name
                  end if;
               when A_Protected_Type_Declaration =>             -- 3.2.1
                  Send ("protected type ");
                  if Is_Here (Asis.Declarations.Discriminant_Part
                     (Element))
                  then
                     Push;
                  end if;
                  Push ("is" & ASCII.CR);
                  Push (To_String (Asis.Declarations.Defining_Name_Image
                        (First_Element (Asis.Declarations.Names (Element)))) &
                        ";" & ASCII.CR);
               when An_Incomplete_Type_Declaration =>           -- 3.2.1
                  Send ("type ");
                  if Is_Here (Asis.Declarations.Discriminant_Part
                       (Element))
                  then
                     Push;
                  end if;
                  Push (";" & ASCII.CR);
               when A_Private_Type_Declaration =>
                  --  3.2.1 -> Trait_Kinds
                  Send ("type ");
                  if Is_Here (Asis.Declarations.Discriminant_Part
                        (Element))
                  then
                     Push;
                  end if;
                  Push ("is "); -- The trait is writen after ....
                  Push (";" & ASCII.CR);
               when A_Private_Extension_Declaration =>
                  --  3.2.1 -> Trait_Kinds
                  Send ("type ");
                  if Is_Here (Asis.Declarations.Discriminant_Part
                        (Element))
                  then
                     Push;
                  end if;
                  case Asis.Elements.Trait_Kind (Element) is
                     when An_Abstract_Trait |
                       An_Abstract_Private_Trait |
                       An_Abstract_Limited_Trait |
                       An_Abstract_Limited_Private_Trait =>
                        Push ("is abstract new ");
                     when others =>
                        Push ("is new ");
                  end case;
                  Push (";" & ASCII.CR);

               when A_Subtype_Declaration =>                    -- 3.2.2
                  Send ("subtype ");
                  Push ("is ");
                  Push (";" & ASCII.CR);
               when A_Variable_Declaration =>
                  --  3.3.1 -> Trait_Kinds
                  Push (": " & Trait_String,
                        Is_Comma_No_Parenthesis_List,
                        Count (Asis.Declarations.Names (Element)));

                  if Is_Here (Asis.Declarations.Initialization_Expression
                                (Element))
                  then
                     Push (":= ");
                  end if;

                  Push (";" & ASCII.CR);
               when A_Constant_Declaration =>
                  --  3.3.1 -> Trait_Kinds
                  Push (": " & Trait_String & "constant ",
                        Is_Comma_No_Parenthesis_List,
                        Count (Asis.Declarations.Names (Element)));

                  if Is_Here (Asis.Declarations.Initialization_Expression
                       (Element))
                  then
                     Push (":= ");
                  end if;

                  Push (";" & ASCII.CR);
               when A_Deferred_Constant_Declaration =>
                  --  3.3.1 -> Trait_Kinds
                  Push (": " & Trait_String & "constant ",
                        Is_Comma_No_Parenthesis_List,
                        Count (Asis.Declarations.Names (Element)));
                  Push (";" & ASCII.CR);
               when A_Single_Task_Declaration =>                  -- 3.3.1
                  Send ("task ");

                  if Is_Here (Asis.Declarations.Object_Declaration_View
                     (Element))
                  then
                     Push ("is" & ASCII.CR);

                     Push
                       (To_String (Asis.Declarations.Defining_Name_Image
                        (First_Element (Asis.Declarations.Names (Element)))) &
                         ";" & ASCII.CR);
                  else
                     Push (";" & ASCII.CR);
                  end if;
               when A_Single_Protected_Declaration =>           -- 3.3.1
                  Send ("protected ");
                  Push ("is" & ASCII.CR);
                  Indent;
                  Push (To_String (Asis.Declarations.Defining_Name_Image
                         (First_Element (Asis.Declarations.Names (Element))))
                         & ";" & ASCII.CR);
               when An_Integer_Number_Declaration =>            -- 3.3.2
                  Push (": constant :=  ",
                        Is_Comma_No_Parenthesis_List,
                        Count (Asis.Declarations.Names (Element)));
                  Push (";" & ASCII.CR);
               when A_Real_Number_Declaration =>                -- 3.3.2
                  Push (": constant :=  ",
                        Is_Comma_No_Parenthesis_List,
                        Count (Asis.Declarations.Names (Element)));
                  Push (";" & ASCII.CR);
               when An_Enumeration_Literal_Specification =>     -- 3.5.1
                  Push;
               when A_Discriminant_Specification =>
                  --  3.7   -> Trait_Kinds
                  Push (": " & Trait_String,
                        Is_Comma_No_Parenthesis_List,
                        Count (Asis.Declarations.Names (Element)));

                  if Is_Here (Asis.Declarations.Initialization_Expression
                     (Element))
                  then
                     Push (":= ");
                  end if;

                  Push;
               when A_Component_Declaration =>                  -- 3.8
                  Push (": ",
                        Is_Comma_No_Parenthesis_List,
                        Count (Asis.Declarations.Names (Element)));

                  if Is_Here (Asis.Declarations.Initialization_Expression
                       (Element))
                  then
                     Push (":= ");
                  end if;

                  Push (";" & ASCII.CR);
               when A_Loop_Parameter_Specification =>
                  --  5.5   -> Trait_Kinds
                  Push ("in " & Trait_String);
                  Push;
               when A_Procedure_Declaration =>
                  --  6.1   -> Trait_Kinds
                  if Is_Private_Unit (Element) then
                     Send ("private ");
                  end if;

                  Send ("procedure ");
                  Push;
                  case Asis.Elements.Trait_Kind (Element) is
                     when Not_A_Trait =>
                        Ada.Text_IO.Put
                          ("<<Node Not_A_Trait in A_Procedure_Declaration>>");
                     when An_Abstract_Trait =>
                        Push
                          ("is abstract;" & ASCII.CR,
                            Is_Semi_Colon_List,
                            Count (Asis.Declarations.Parameter_Profile
                               (Element)));
                     when others =>
                        Push
                          (";" & ASCII.CR,
                           Is_Semi_Colon_List,
                           Count (Asis.Declarations.Parameter_Profile
                              (Element)));
                  end case;
               when A_Function_Declaration =>
                  --  6.1   -> Trait_Kinds
                  if Is_Private_Unit (Element) then
                     Send ("private ");
                  end if;
                  Send ("function ");
                  Push ("");
                  Push ("return ",
                        Is_Semi_Colon_List,
                    Count (Asis.Declarations.Parameter_Profile (Element)));
                  case Asis.Elements.Trait_Kind (Element) is
                     when Not_A_Trait =>
                        Ada.Text_IO.Put
                          ("<<Node Not_A_Trait in A_Procedure_Declaration>>");
                     when An_Abstract_Trait =>
                        Push ("is abstract;" & ASCII.CR);
                     when others =>
                        Push (";" & ASCII.CR);
                  end case;
               when A_Parameter_Specification =>
                  --  6.1   -> Trait_Kinds
                  case Asis.Elements.Mode_Kind (Element) is
                     when Not_A_Mode =>
                        Push ("<<Not_A_Mode !!!>>");
                     when A_Default_In_Mode =>
                        --  it is the only mode that can be access...
                        Push (": " & Trait_String,
                               Is_Comma_No_Parenthesis_List,
                               Count (Asis.Declarations.Names (Element)));
                     when An_In_Mode =>
                        Push (": in ",
                               Is_Comma_No_Parenthesis_List,
                               Count (Asis.Declarations.Names (Element)));
                     when An_Out_Mode =>
                        Push (": out ",
                               Is_Comma_No_Parenthesis_List,
                               Count (Asis.Declarations.Names (Element)));
                     when An_In_Out_Mode =>
                        Push (": in out ",
                               Is_Comma_No_Parenthesis_List,
                               Count (Asis.Declarations.Names (Element)));
                  end case;
                  if (Is_Here (Asis.Declarations.Initialization_Expression
                     (Element)))
                  then
                     Push (":= ");
                  end if;
                  Push;
               when A_Procedure_Body_Declaration =>             -- 6.3
                  Send
                    (Unit_Body_Beginning
                      (Element,
                       A_Procedure_Body_Declaration));
                  --  Send ("procedure ");
                  Push ("");
                  Push ("is" & ASCII.CR,
                        Is_Semi_Colon_List,
                        Count (Asis.Declarations.Parameter_Profile (Element)));
                  Indent;
                  Push ("begin" & ASCII.CR,
                       Not_In_A_List,
                       Count
                         (Asis.Declarations.Body_Declarative_Items
                           (Element, True)));
                  Indent;
                  L := Count (Asis.Declarations.Body_Statements
                         (Element, True));
                  M := Count (Asis.Declarations.Body_Exception_Handlers
                         (Element, True));
                  --  Is_Name_Repeated is not implemented???
                  if M = 0 then
                     Push
                       ("end " &
                        To_String (Asis.Declarations.Defining_Name_Image
                        (First_Element (Asis.Declarations.Names (Element)))) &
                        ";" & ASCII.CR,
                        Not_In_A_List,
                        L);
                  else
                     Push ("exception" & ASCII.CR,
                           Not_In_A_List,
                           L);
                     Indent;
                     Push
                       ("end " &
                        To_String (Asis.Declarations.Defining_Name_Image
                        (First_Element (Asis.Declarations.Names (Element)))) &
                        ";" & ASCII.CR,
                        Not_In_A_List,
                        M);
                  end if;
                  Indent;

               when A_Function_Body_Declaration =>              -- 6.3
                  Send (Unit_Body_Beginning
                     (Element, A_Function_Body_Declaration));
                  --  Send ("function ");
                  Push ("");
                  Push ("return ",
                        Is_Semi_Colon_List,
                        Count (Asis.Declarations.Parameter_Profile (Element)));
                  Push ("is" & ASCII.CR);
                  Indent;
                  Push ("begin" & ASCII.CR,
                       Not_In_A_List,
                       Count (Asis.Declarations.Body_Declarative_Items
                          (Element, True)));
                  Indent;
                  L := Count (Asis.Declarations.Body_Statements
                         (Element, True));
                  M := Count (Asis.Declarations.Body_Exception_Handlers
                    (Element, True));
                  --  Is_Name_Repeated is not implemented???
                  if M = 0 then
                     Push
                       ("end " &
                        To_String (Asis.Declarations.Defining_Name_Image
                        (First_Element (Asis.Declarations.Names (Element)))) &
                        ";" & ASCII.CR,
                        Not_In_A_List,
                        L);
                  else
                     Push ("exception" & ASCII.CR,
                       Not_In_A_List,
                           L);
                     Indent;
                     Push
                       ("end " &
                        To_String (Asis.Declarations.Defining_Name_Image
                        (First_Element (Asis.Declarations.Names (Element)))) &
                        ";" & ASCII.CR,
                        Not_In_A_List,
                        M);
                  end if;
                  Indent;

               when A_Package_Declaration =>                    -- 7.1
                  if Is_Private_Unit (Element) then
                     Send ("private ");
                  end if;
                  Send ("package ");
                  Push ("is" & ASCII.CR);

                  L := Count
                        (Asis.Declarations.Visible_Part_Declarative_Items
                           (Element, True));

                  if Asis.Declarations.Is_Private_Present (Element) then
                     Push ("private" & ASCII.CR,
                           Not_In_A_List,
                       L);
                     Indent;
                     Push
                       ("end " &
                        To_String (Asis.Declarations.Defining_Name_Image
                        (First_Element (Asis.Declarations.Names (Element)))) &
                        ";" & ASCII.CR,
                        Not_In_A_List,
                        Count
                          (Asis.Declarations.Private_Part_Declarative_Items
                            (Element, True)));
                  else
                     Push
                       ("end " &
                        To_String (Asis.Declarations.Defining_Name_Image
                        (First_Element (Asis.Declarations.Names (Element)))) &
                        ";" & ASCII.CR,
                        Not_In_A_List,
                        L);
                  end if;
                  Indent;
               when A_Package_Body_Declaration =>               -- 7.2

                  Send (Unit_Body_Beginning
                    (Element,
                     A_Package_Body_Declaration));
                  --  Send ("package body ");

                  L := Count (Asis.Declarations.Body_Declarative_Items
                         (Element, True));
                  M := Count (Asis.Declarations.Body_Statements
                         (Element, True));
                  N := Count (Asis.Declarations.Body_Exception_Handlers
                         (Element, True));

                  declare
                     End_String : String := "end " &
                       To_String (Asis.Declarations.Defining_Name_Image
                       (First_Element (Asis.Declarations.Names (Element)))) &
                       ";" & ASCII.CR;
                  begin
                     if L = 0 then
                        if M = 0 then
                           --  then N = 0 too
                           Push ("is" & ASCII.CR & ASCII.CR & End_String);
                        else
                           Push ("is" & ASCII.CR & "begin" & ASCII.CR);
                           if N = 0 then
                              Push (End_String, Not_In_A_List, M);
                              Indent;
                           else
                              Push ("exception" & ASCII.CR, Not_In_A_List, M);
                              Indent;
                              Push (End_String, Not_In_A_List, N);
                              Indent;
                           end if;
                        end if;
                     else
                        Push ("is" & ASCII.CR);
                        if M = 0 then
                           Push (End_String, Not_In_A_List, L);
                           Indent;
                        else
                           Push ("begin" & ASCII.CR, Not_In_A_List, L);
                           Indent;
                           if N = 0 then
                              Push (End_String, Not_In_A_List, M);
                              Indent;
                           else
                              Push ("exception" & ASCII.CR, Not_In_A_List, M);
                              Indent;
                              Push (End_String, Not_In_A_List, N);
                              Indent;
                           end if;
                        end if;
                     end if;
                  end;
               when An_Object_Renaming_Declaration =>           -- 8.5.1
                  Push (": ");
                  Push ("renames ");
                  Push (";" & ASCII.CR);
               when An_Exception_Renaming_Declaration =>        -- 8.5.2
                  Push (": exception renames ");
                  Push (";" & ASCII.CR);
               when A_Package_Renaming_Declaration =>           -- 8.5.3
                  Send ("package ");
                  Push ("renames ");
                  Push (";" & ASCII.CR);
               when A_Procedure_Renaming_Declaration =>         -- 8.5.4
                  Send ("procedure ");
                  Push;
                  Push ("renames ",
                        Is_Semi_Colon_List,
                        Count (Asis.Declarations.Parameter_Profile (Element)));
                  Push (";" & ASCII.CR);
               when A_Function_Renaming_Declaration =>          -- 8.5.4
                  Send ("function ");
                  Push;
                  Push ("return ",
                        Is_Semi_Colon_List,
                        Count (Asis.Declarations.Parameter_Profile (Element)));
                  Push ("renames ");
                  Push (";" & ASCII.CR);
               when A_Generic_Package_Renaming_Declaration =>   -- 8.5.5
                  Send ("generic package ");
                  Push ("renames ");
                  Push (";" & ASCII.CR);
               when A_Generic_Procedure_Renaming_Declaration => -- 8.5.5
                  Send ("generic procedure ");
                  Push ("renames ");
                  Push (";" & ASCII.CR);
               when A_Generic_Function_Renaming_Declaration =>  -- 8.5.5
                  Send ("generic function ");
                  Push ("renames ");
                  Push (";" & ASCII.CR);
               when A_Task_Body_Declaration =>                 -- 9.1
                  Send (Unit_Body_Beginning
                     (Element, A_Task_Body_Declaration));
                  --  Send ("task body ");
                  Push ("is" & ASCII.CR);

                  Push
                    ("begin" & ASCII.CR,
                     Not_In_A_List,
                     Count (Asis.Declarations.Body_Declarative_Items
                        (Element, True)));

                  Indent;
                  L := Count (Asis.Declarations.Body_Statements
                         (Element, True));
                  M := Count (Asis.Declarations.Body_Exception_Handlers
                         (Element, True));
                  --  Is_Name_Repeated is not implemented???
                  if M = 0 then
                     Push
                       ("end " &
                       To_String (Asis.Declarations.Defining_Name_Image
                         (First_Element (Asis.Declarations.Names (Element))))
                        &  ";" & ASCII.CR,
                        Not_In_A_List,
                        L);
                  else
                     Push ("exception" & ASCII.CR,
                           Not_In_A_List,
                           L);
                     Indent;
                     Push
                       ("end " &
                        To_String (Asis.Declarations.Defining_Name_Image
                        (First_Element (Asis.Declarations.Names (Element)))) &
                       ";" & ASCII.CR,
                        Not_In_A_List,
                        M);
                  end if;
                  Indent;

               when A_Protected_Body_Declaration =>               -- 9.4
                  Send (Unit_Body_Beginning
                    (Element, A_Protected_Body_Declaration));
                  --  Send ("protected body ");
                  Push ("is" & ASCII.CR);
                  Push
                    ("end " &
                     To_String (Asis.Declarations.Defining_Name_Image
                     (First_Element (Asis.Declarations.Names (Element)))) &
                     ";" & ASCII.CR,
                     Not_In_A_List,
                     Count (Asis.Declarations.Protected_Operation_Items
                       (Element, True)));
                  Indent;
               when An_Entry_Declaration =>                     -- 9.5.2
                  Send ("entry ");
                  L := Count (Asis.Declarations.Parameter_Profile (Element));
                  if L /= 0 then
                     Push;
                     if Is_Here (Asis.Declarations.Entry_Family_Definition
                        (Element))
                     then
                        Push ("", Is_Comma_List);
                        --  we say comma list in order to have the parenthesis
                     end if;
                     Push (";" & ASCII.CR,
                           Is_Semi_Colon_List, L);
                  else
                     if Is_Here (Asis.Declarations.Entry_Family_Definition
                       (Element))
                     then
                        Push;
                        Push (";" & ASCII.CR, Is_Comma_List);
                        --  we say comma list in order to have the parenthesis
                     else
                        Push (";" & ASCII.CR);
                     end if;
                  end if;
               when An_Entry_Body_Declaration =>          -- 9.5.2
                  Send ("entry ");
                  if Is_Here (Asis.Declarations.Entry_Index_Specification
                    (Element))
                  then
                     Push;
                     Push ("", Is_Comma_List);
                  else
                     Push;
                  end if;
                  Push ("when ",
                        Is_Semi_Colon_List,
                        Count (Asis.Declarations.Parameter_Profile (Element)));
                  Push ("is" & ASCII.CR);

                  Push ("begin" & ASCII.CR,
                        Not_In_A_List,
                        Count (Asis.Declarations.Body_Declarative_Items
                           (Element, True)));

                  Push (""); --  <<<RYBIN
                  Indent;
                  L := Count (Asis.Declarations.Body_Statements (Element));
                  M := Count (Asis.Declarations.Body_Exception_Handlers
                         (Element));

                  if M = 0 then
                     Push
                       ("end " &
                        To_String (Asis.Declarations.Defining_Name_Image
                        (First_Element (Asis.Declarations.Names (Element)))) &
                        ";" & ASCII.CR,
                        Not_In_A_List,
                        L);
                     Indent;
                  else
                     Push ("exception" & ASCII.CR,
                           Not_In_A_List,
                           L);
                     Indent;
                     Push
                       ("end " &
                        To_String (Asis.Declarations.Defining_Name_Image
                        (First_Element (Asis.Declarations.Names (Element)))) &
                        ";" & ASCII.CR,
                        Not_In_A_List,
                        M);
                     Indent;
                  end if;
               when An_Entry_Index_Specification =>               -- 9.5.2
                  Send ("for ");
                  Push ("in ");
                  Push;
               when A_Procedure_Body_Stub =>                    -- 10.1.3
                  Send ("procedure ");
                  Push;
                  Push
                    ("is separate;" & ASCII.CR,
                     Is_Semi_Colon_List,
                     Count (Asis.Declarations.Parameter_Profile (Element)));
               when A_Function_Body_Stub =>                     -- 10.1.3
                  Send ("function ");
                  Push ("");
                  Push ("return ",
                        Is_Semi_Colon_List,
                        Count (Asis.Declarations.Parameter_Profile (Element)));
                  Push ("is separate;" & ASCII.CR);
               when A_Package_Body_Stub =>                      -- 10.1.3
                  Send ("package body ");
                  Push ("is separate;" & ASCII.CR);
               when A_Task_Body_Stub =>                         -- 10.1.3
                  Send ("task body ");
                  Push ("is separate;" & ASCII.CR);
               when A_Protected_Body_Stub =>                      -- 10.1.3
                  Send ("protected body ");
                  Push ("is separate;" & ASCII.CR);
               when An_Exception_Declaration =>                 -- 11.1
                  Push (": exception;" & ASCII.CR,
                        Is_Comma_No_Parenthesis_List,
                        Count (Asis.Declarations.Names (Element)));
               when A_Choice_Parameter_Specification =>         -- 11.2
                  Push (": "); -- in exception handler ...
               when A_Generic_Procedure_Declaration =>          -- 12.1
                  if Is_Private_Unit (Element) then
                     Send ("private" & ASCII.CR);
                  end if;
                  Send ("generic" & ASCII.CR);
                  Push ("procedure ",
                        Not_In_A_List,
                        Count (Asis.Declarations.Generic_Formal_Part
                          (Element, True)));
                  Indent;
                  Push;
                  Push
                    (";" & ASCII.CR,
                     Is_Semi_Colon_List,
                     Count (Asis.Declarations.Parameter_Profile (Element)));
               when A_Generic_Function_Declaration =>           -- 12.1
                  if Is_Private_Unit (Element) then
                     Send ("private" & ASCII.CR);
                  end if;
                  Send ("generic" & ASCII.CR);
                  Push
                    ("function ",
                     Not_In_A_List,
                     Count (Asis.Declarations.Generic_Formal_Part
                       (Element, True)));
                  Indent;
                  Push;
                  Push ("return ",
                         Is_Semi_Colon_List,
                         Count (Asis.Declarations.Parameter_Profile
                           (Element)));
                  Push (";" & ASCII.CR);
               when A_Generic_Package_Declaration =>            -- 12.1
                  if Is_Private_Unit (Element) then
                     Send ("private" & ASCII.CR);
                  end if;
                  Send ("generic" & ASCII.CR);
                  Push ("package ",
                        Not_In_A_List,
                        Count (Asis.Declarations.Generic_Formal_Part
                          (Element, True)));
                  Indent;
                  Push ("is" & ASCII.CR);
                  L := Count (Asis.Declarations.Visible_Part_Declarative_Items
                     (Element, True));
                  if Asis.Declarations.Is_Private_Present (Element) then
                     Push ("private" & ASCII.CR,
                           Not_In_A_List,
                           L);
                     Indent;
                     Push
                       ("end " &
                        To_String (Asis.Declarations.Defining_Name_Image
                        (First_Element (Asis.Declarations.Names (Element)))) &
                       ";" & ASCII.CR,
                        Not_In_A_List,
                        Count (Asis.Declarations.Private_Part_Declarative_Items
                           (Element, True)));
                  else
                     Push ("end " &
                           To_String (Asis.Declarations.Defining_Name_Image
                       (First_Element (Asis.Declarations.Names (Element)))) &
                       ";" & ASCII.CR,
                           Not_In_A_List,
                           L);
                  end if;
                  Indent;

               when A_Package_Instantiation =>                  -- 12.3
                  Send ("package ");
                  Push ("is new ");
                  Push;
                  Push (";" & ASCII.CR,
                        Is_Comma_List,
                        Count (Asis.Declarations.Generic_Actual_Part
                          (Element, False)));
               when A_Procedure_Instantiation =>                -- 12.3
                  Send ("procedure ");
                  Push ("is new ");
                  Push;
                  Push (";" & ASCII.CR,
                        Is_Comma_List,
                        Count (Asis.Declarations.Generic_Actual_Part
                          (Element, False)));
               when A_Function_Instantiation =>                 -- 12.3
                  Send ("function ");
                  Push ("is new ");
                  Push;
                  Push (";" & ASCII.CR,
                        Is_Comma_List,
                        Count (Asis.Declarations.Generic_Actual_Part
                          (Element, False)));
               when A_Formal_Object_Declaration =>
                  --  12.4  -> Mode_Kinds
                  case Asis.Elements.Mode_Kind (Element) is
                     when Not_A_Mode =>
                        Push ("<<Not_A_Mode !!!>>");
                     when A_Default_In_Mode =>
                        --  it is the only mode that can be access...
                        Push (": " & Trait_String,
                               Is_Comma_No_Parenthesis_List,
                               Count (Asis.Declarations.Names (Element)));
                     when An_In_Mode =>
                        Push (": in ",
                               Is_Comma_No_Parenthesis_List,
                               Count (Asis.Declarations.Names (Element)));
                     when An_Out_Mode =>
                        Push (": out ",
                               Is_Comma_No_Parenthesis_List,
                               Count (Asis.Declarations.Names (Element)));
                     when An_In_Out_Mode =>
                        Push (": in out ",
                               Is_Comma_No_Parenthesis_List,
                               Count (Asis.Declarations.Names (Element)));
                  end case;

                  if (Is_Here (Asis.Declarations.Initialization_Expression
                    (Element))) then
                     Push (":= ");
                     Push (";" & ASCII.CR);
                  else
                     Push (";" & ASCII.CR);
                  end if;
               when A_Formal_Type_Declaration =>                -- 12.5
                  Send ("type ");
                  if Is_Here (Asis.Declarations.Discriminant_Part
                    (Element))
                  then
                     Push;
                  end if;
                  Push ("is ");
                  Push (";" & ASCII.CR);
               when A_Formal_Procedure_Declaration =>
                  --  12.6  -> Default_Kinds
                  Send ("with procedure ");
                  Push;
                  case (Asis.Elements.Default_Kind (Element)) is
                     when Not_A_Default =>
                        Ada.Text_IO.Put ("<<Node Not_A_Default>>");
                     when A_Name_Default =>
                           Push
                             ("is ",
                              Is_Semi_Colon_List,
                              Count (Asis.Declarations.Parameter_Profile
                                (Element)));
                           Push (";" & ASCII.CR);
                     when A_Box_Default =>
                        Push
                          ("is <>;" & ASCII.CR,
                           Is_Semi_Colon_List,
                           Count (Asis.Declarations.Parameter_Profile
                             (Element)));
                     when A_Nil_Default =>
                        Push (";" & ASCII.CR,
                              Is_Semi_Colon_List,
                              Count (Asis.Declarations.Parameter_Profile
                                (Element)));
                  end case;
               when A_Formal_Function_Declaration =>
                  --  12.6  -> Default_Kinds
                  Send ("with function ");
                  Push;
                  Push ("return ",
                        Is_Semi_Colon_List,
                        Count (Asis.Declarations.Parameter_Profile (Element)));
                  case (Asis.Elements.Default_Kind (Element)) is
                     when Not_A_Default =>
                        Ada.Text_IO.Put ("<<Node Not_A_Default>>");
                     when A_Name_Default =>
                           Push ("is ");
                           Push (";" & ASCII.CR);
                     when A_Box_Default =>
                        Push ("is <>;" & ASCII.CR);
                     when A_Nil_Default =>
                        Push (";" & ASCII.CR);
                  end case;

               when A_Formal_Package_Declaration =>             -- 12.7
                  Send ("with package ");
                  Push ("is new ");
                  Push;
                  Push
                    (";" & ASCII.CR,
                     Is_Comma_List,
                     Count (Asis.Declarations.Generic_Actual_Part
                       (Element, False)));
               when A_Formal_Package_Declaration_With_Box =>   -- 12.7
                  Send ("with package ");
                  Push ("is new ");
                  Push ("(<>);" & ASCII.CR);
            end case;
         when A_Definition =>
            case Asis.Elements.Definition_Kind (Element) is
               when Not_A_Definition =>
                  --  An unexpected element
                  Ada.Text_IO.Put ("<<Node Not_A_Definition>>");
               when A_Type_Definition =>
                  --  3.2.1   -> Type_Kinds
                  case Asis.Elements.Type_Kind (Element) is
                     when Not_A_Type_Definition =>
                        Ada.Text_IO.Put ("<<Node Not_A_Type_Definition>>");
                     when A_Derived_Type_Definition =>
                        Send ("new ");
                        Push;
                     when A_Derived_Record_Extension_Definition =>
                        Send (Trait_String & "new ");
                        if  Asis.Elements.Definition_Kind (
                               Asis.Definitions.Record_Definition (Element)) =
                            A_Null_Record_Definition  then
                           Push ("with ");
                           Push;
                        else
                           Push ("with record" & ASCII.CR);
                           Push ("end record ");
                           Indent;
                        end if;
                     when An_Enumeration_Type_Definition =>
                        Push
                          ("",
                           Is_Comma_List,
                           Count
                            (Asis.Definitions.Enumeration_Literal_Declarations
                              (Element)));
                        Check_If_Return_Separator
                          (Asis.Definitions.Enumeration_Literal_Declarations
                            (Element));
                     when A_Signed_Integer_Type_Definition =>
                        Send ("range ");
                        Push;
                     when A_Modular_Type_Definition =>
                        Send ("mod ");
                        Push;
                     when A_Root_Type_Definition =>
                        Ada.Text_IO.Put ("<<Node A_Root_Type_Definition>>");
                     when A_Floating_Point_Definition =>
                        Send ("digits ");
                        if Is_Here (Asis.Definitions.Real_Range_Constraint
                           (Element))
                        then
                           Push ("range ");
                           Push;
                        else
                           Push;
                        end if;
                     when An_Ordinary_Fixed_Point_Definition =>
                        Send ("delta ");
                        Push ("range ");
                        Push;
                     when A_Decimal_Fixed_Point_Definition =>
                        Send ("delta ");
                        Push ("digits ");
                        if Is_Here (Asis.Definitions.Real_Range_Constraint
                          (Element))
                        then
                           Push ("range ");
                           Push;
                        else
                           Push;
                        end if;
                     when An_Unconstrained_Array_Definition =>
                        Send ("array ");
                        Push
                          ("of ",
                           Is_Comma_Range_List,
                           Count (Asis.Definitions.Index_Subtype_Definitions
                             (Element)));
                        Push;
                     when A_Constrained_Array_Definition =>
                        Send ("array ");
                        Push
                          ("of ",
                           Is_Comma_List,
                           Count
                             (Asis.Definitions.Discrete_Subtype_Definitions
                               (Element)));
                        Push;
                     when A_Record_Type_Definition =>
                        if  Asis.Elements.Definition_Kind (
                               Asis.Definitions.Record_Definition (Element)) =
                            A_Null_Record_Definition  then
                           Send (Trait_String);
                           Push;
                        else
                           Send (Trait_String & "record" & ASCII.CR);
                           Push ("end record ");
                           Indent;
                        end if;
                     when A_Tagged_Record_Type_Definition =>
                        if  Asis.Elements.Definition_Kind
                          (Asis.Definitions.Record_Definition (Element)) =
                          A_Null_Record_Definition
                        then
                           Send (Trait_String ("tagged "));
                           Push;
                        else
                           Send
                             (Trait_String ("tagged ") & "record" & ASCII.CR);
                           Push ("end record ");
                           Indent;
                        end if;
                     when An_Access_Type_Definition =>
                        case Asis.Elements.Access_Type_Kind (Element) is
                           when Not_An_Access_Type_Definition =>
                              Ada.Text_IO.Put
                                 ("<<Node Not_An_Access_Type_Definition>>");
                           when A_Pool_Specific_Access_To_Variable =>
                              Send ("access ");
                              Push;
                           when An_Access_To_Constant =>
                              Send ("access constant ");
                              Push;
                           when An_Access_To_Variable =>
                              Send ("access all ");
                              Push;
                           when An_Access_To_Procedure =>
                              Send ("access procedure ");
                              Push
                                ("",
                                 Is_Semi_Colon_List,
                                 Count
                                   (Asis.Definitions.
                                      Access_To_Subprogram_Parameter_Profile
                                        (Element)));
                           when An_Access_To_Protected_Procedure =>
                              Send ("access protected procedure ");
                              Push
                                ("",
                                 Is_Semi_Colon_List,
                                 Count (Asis.Definitions.
                                    Access_To_Subprogram_Parameter_Profile
                                      (Element)));
                           when An_Access_To_Function =>
                              Send ("access function ");
                              Push
                                ("return ",
                                 Is_Semi_Colon_List,
                                 Count (Asis.Definitions.
                                   Access_To_Subprogram_Parameter_Profile
                                     (Element)));
                              Push;
                           when An_Access_To_Protected_Function =>
                              Send ("access protected function ");
                              Push
                                ("return ",
                                 Is_Semi_Colon_List,
                                 Count (Asis.Definitions.
                                    Access_To_Subprogram_Parameter_Profile
                                      (Element)));
                              Push;
                        end case;
                  end case;
               when A_Subtype_Indication =>            -- 3.2.2
                  declare
                     M : Asis.Element :=
                        Asis.Definitions.Subtype_Constraint (Element);
                  begin
                     if Is_Here (M) then
                        case Asis.Elements.Constraint_Kind (M) is
                           when A_Range_Attribute_Reference |
                                A_Simple_Expression_Range =>
                              Push ("range ");
                              Push;
                           when others =>
                              Push;
                              Push;
                        end case;
                     else
                        Push;
                     end if;
                  end;
               when A_Constraint =>
                  --  3.2.2   -> Constraint_Kinds
                  case Asis.Elements.Constraint_Kind (Element) is
                     when Not_A_Constraint =>
                        Ada.Text_IO.Put ("<<Node Not_A_Constraint>>");
                     when A_Range_Attribute_Reference =>
                        --  Send ("range ");
                        --  No range to Ada.Text_IO.Put ...
                        Push;
                     when A_Simple_Expression_Range =>
                        --  Send ("range ");
                        --  Ada.Text_IO.Put a range here might fail...
                        Push (".. ");
                        Push;
                     when A_Digits_Constraint =>
                        Send ("digits ");
                        if (Asis.Elements.Constraint_Kind
                              (Asis.Definitions.Real_Range_Constraint
                                (Element))
                          /=
                           Not_A_Constraint)
                        then
                           Push ("range ");
                           Push;
                        else
                           Push;
                        end if;
                     when A_Delta_Constraint =>
                        Send ("delta ");
                        if (Asis.Elements.Constraint_Kind
                              (Asis.Definitions.Real_Range_Constraint
                                (Element))
                           /=
                           Not_A_Constraint)
                        then
                           Push ("range ");
                           Push;
                        else
                           Push;
                        end if;
                     when An_Index_Constraint =>
                        Push
                          ("",
                           Is_Comma_List,
                           Count (Asis.Definitions.Discrete_Ranges
                             (Element)));
                     when A_Discriminant_Constraint =>
                        Push
                          ("",
                           Is_Comma_List,
                           Count (Asis.Definitions.Discriminant_Associations
                             (Element, False)));
                  end case;
               when A_Component_Definition =>
                  --  3.6       -> Trait_Kinds
                  Send (Trait_String);
                  Push;
               when A_Discrete_Subtype_Definition |
                  A_Discrete_Range =>
                  --  3.6     -> Discrete_Range_Kinds
                  --  3.6.1   -> Discrete_Range_Kinds
                  case Asis.Elements.Discrete_Range_Kind (Element) is
                     when Not_A_Discrete_Range =>
                        Ada.Text_IO.Put ("<<Node Not_A_Discrete_Range>>");
                     when A_Discrete_Subtype_Indication =>
                        declare
                           C : Asis.Element :=
                              Asis.Definitions.Subtype_Constraint (Element);
                        begin
                           if Is_Here (C) then
                              case Asis.Elements.Constraint_Kind (C) is
                                 when A_Range_Attribute_Reference |
                                      A_Simple_Expression_Range =>
                                    Push ("range ");
                                 when others =>
                                    Push;
                              end case;
                           end if;
                           Push;
                        end;
                     when A_Discrete_Range_Attribute_Reference =>
                        Push;
                     when A_Discrete_Simple_Expression_Range =>
                        Push (".. ");
                        Push;
                  end case;
               when An_Unknown_Discriminant_Part =>    -- 3.7
                  Send ("(<>) ");
               when A_Known_Discriminant_Part =>       -- 3.7
                  Push ("",
                        Is_Semi_Colon_List,
                        Count (Asis.Definitions.Discriminants (Element)));
               when A_Record_Definition =>             -- 3.8
                  Push ("",
                        Not_In_A_List,
                        Count (Asis.Definitions.Record_Components (Element)));
               when A_Null_Record_Definition =>        -- 3.8
                  Send ("null record ");
               when A_Null_Component =>                -- 3.8
                  Send ("null;" & ASCII.CR);
               when A_Variant_Part =>                  -- 3.8
                  Send ("case ");
                  Push ("is" & ASCII.CR);
                  Push ("end case;" & ASCII.CR,
                        Not_In_A_List,
                        Count (Asis.Definitions.Variants (Element, True)));
                  Indent;
               when A_Variant =>                       -- 3.8
                  Send ("when ");
                  Push ("=>" & ASCII.CR,
                        Is_Vertical_Line_List,
                        Count (Asis.Definitions.Variant_Choices (Element)));
                  Push
                    ("",
                     Not_In_A_List,
                     Count (Asis.Definitions.Record_Components
                        (Element, True)));
                  Indent;
               when An_Others_Choice =>
                  --  3.8.1, 4.3.1, 4.3.3, 11.2
                  Send ("others ");
               when A_Private_Type_Definition =>
                  --  7.3     -> Trait_Kinds
                  Send (Trait_String);
               when A_Tagged_Private_Type_Definition =>
                  --  7.3     -> Trait_Kinds
                  Send (Trait_String ("tagged "));
               when A_Private_Extension_Definition =>
                  --  7.3     -> Trait_Kinds
                  Push ("with private ");
               when A_Task_Definition |                  -- 9.1
                 A_Protected_Definition =>               -- 9.4
                  L := Count (Asis.Definitions.Private_Part_Items
                         (Element, True));
                  if L /= 0 then
                     Push
                        ("private" & ASCII.CR,
                         Not_In_A_List,
                         Count (Asis.Definitions.Visible_Part_Items
                            (Element, True)));
                     Indent;
                     Push ("end ",
                           Not_In_A_List,
                           L);
                     Indent;
                  else
                     Push
                        ("end ",
                         Not_In_A_List,
                         Count (Asis.Definitions.Visible_Part_Items
                            (Element, True)));
                     Indent;
                  end if;

               when A_Formal_Type_Definition =>
                  --  12.5    -> Formal_Type_Kinds
                  case Asis.Elements.Formal_Type_Kind (Element) is
                     when Not_A_Formal_Type_Definition =>
                        Ada.Text_IO.Put
                           ("<<Node Not_A_Formal_Type_Definition>>");
                     when A_Formal_Private_Type_Definition =>
                        Send (Trait_String);
                     when A_Formal_Tagged_Private_Type_Definition =>
                        Send (Trait_String ("tagged "));
                     when A_Formal_Discrete_Type_Definition =>
                        Send ("(<>) ");
                     when A_Formal_Signed_Integer_Type_Definition =>
                        Send ("range <> ");
                     when A_Formal_Modular_Type_Definition =>
                        Send ("mod <> ");
                     when A_Formal_Floating_Point_Definition =>
                        Send ("digits <> ");
                     when A_Formal_Ordinary_Fixed_Point_Definition =>
                        Send ("delta <> ");
                     when A_Formal_Decimal_Fixed_Point_Definition =>
                        Send ("delta <> digits <> ");
                     when A_Formal_Derived_Type_Definition =>
                        case Asis.Elements.Trait_Kind (Element) is
                           when An_Abstract_Private_Trait =>
                              Send ("abstract new ");
                              Push ("with private ");
                           when An_Abstract_Trait =>
                              Send ("abstract new ");
                              Push;
                           when A_Private_Trait =>
                              Send ("new ");
                              Push ("with private ");
                           when others =>
                              Send ("new ");
                              Push;
                        end case;
                     when A_Formal_Unconstrained_Array_Definition =>
                        Send ("array ");
                        Push
                          ("of ",
                           Is_Comma_Range_List,
                           Count (Asis.Definitions.Index_Subtype_Definitions
                             (Element)));
                        Push;
                     when A_Formal_Constrained_Array_Definition =>
                        Send ("array ");
                        Push
                          ("of ",
                           Is_Comma_List,
                           Count (Asis.Definitions.
                             Discrete_Subtype_Definitions (Element)));
                        Push;
                     when A_Formal_Access_Type_Definition =>
                        case Asis.Elements.Access_Type_Kind (Element) is
                           when Not_An_Access_Type_Definition =>
                              Ada.Text_IO.Put
                                 ("<<Node Not_An_Access_Type_Definition>>");
                           when A_Pool_Specific_Access_To_Variable =>
                              Send ("access ");
                              Push;

                           when An_Access_To_Constant =>
                              Send ("access constant ");
                              Push;
                           when An_Access_To_Variable =>
                              Send ("access all ");
                              Push;
                           when An_Access_To_Procedure =>
                              Send ("access procedure ");
                              Push
                                ("",
                                 Is_Semi_Colon_List,
                                 Count (Asis.Definitions.
                                    Access_To_Subprogram_Parameter_Profile
                                       (Element)));
                           when An_Access_To_Protected_Procedure =>
                              Send ("access protected procedure ");
                              Push
                                ("",
                                 Is_Semi_Colon_List,
                                 Count (Asis.Definitions.
                                   Access_To_Subprogram_Parameter_Profile
                                     (Element)));
                           when An_Access_To_Function =>
                              Send ("access function ");
                              Push
                                ("return ",
                                 Is_Semi_Colon_List,
                                 Count (Asis.Definitions.
                                    Access_To_Subprogram_Parameter_Profile
                                      (Element)));
                              Push;
                           when An_Access_To_Protected_Function =>
                              Send ("access protected function ");
                              Push
                                ("return ",
                                 Is_Semi_Colon_List,
                                 Count (Asis.Definitions.
                                    Access_To_Subprogram_Parameter_Profile
                                      (Element)));
                              Push;
                        end case;
                  end case;
            end case;
         when An_Expression =>
            case Asis.Elements.Expression_Kind (Element) is
               when Not_An_Expression =>
                  --  An unexpected element
                  Ada.Text_IO.Put ("<<Node Not_An_Expression>>");
               when An_Integer_Literal |                       -- 2.4
                  A_Real_Literal |                             -- 2.4.1
                  A_String_Literal =>                          -- 2.6
                  Send
                    (To_String
                      (Asis.Expressions.Value_Image (Element)) & " ");
               when An_Identifier |
                 A_Character_Literal |
                 An_Enumeration_Literal =>
                  Send
                    (To_String
                      (Asis.Expressions.Name_Image (Element)) & " ");
               when An_Operator_Symbol =>
                  if Is_Infix then
                     case Asis.Elements.Operator_Kind (Element) is
                        when Not_An_Operator =>
                           Ada.Text_IO.Put ("<<Node Not_An_Operator>>");

                        when A_Unary_Plus_Operator |
                          A_Unary_Minus_Operator =>
                           Send (Function_Call_Operator);

                        when An_Abs_Operator |
                          A_Not_Operator =>
                           Send (Function_Call_Operator & " ");
                        when others =>
                           Push (Function_Call_Operator & " ");
                     end case;
                  else
                     Send (To_String (Asis.Expressions.Name_Image (Element)) &
                      " ");
                  end if;

               when An_Explicit_Dereference =>                  -- 4.1
                  Push (".all ");
                  No_Space;
               when A_Function_Call =>                          -- 4.1
                  --  If it is an operator, we print it here, so the element
                  --  Operator won't have to do it.
                  if Asis.Expressions.Is_Prefix_Call (Element) then
                     Push;
                     Push
                       ("",
                        Is_Comma_List,
                        Count (Asis.Expressions.Function_Call_Parameters
                          (Element)));
                  else
                     case Asis.Elements.Operator_Kind
                       (Asis.Expressions.Prefix (Element)) is
                        when Not_An_Operator =>
                           Ada.Text_IO.Put ("<<Node Not_An_Operator>>");
                        when An_And_Operator |
                          An_Or_Operator |
                          An_Xor_Operator |
                          An_Equal_Operator |
                          A_Not_Equal_Operator |
                          A_Less_Than_Operator |
                          A_Less_Than_Or_Equal_Operator |
                          A_Greater_Than_Operator |
                          A_Greater_Than_Or_Equal_Operator |
                          A_Plus_Operator |
                          A_Minus_Operator |
                          An_Exponentiate_Operator |
                          A_Multiply_Operator |
                          A_Divide_Operator |
                          A_Mod_Operator |
                          A_Concatenate_Operator |
                          A_Rem_Operator =>
                           Push;
                           Infix;
                           Push;

                        when A_Unary_Plus_Operator |
                          A_Unary_Minus_Operator |
                          An_Abs_Operator |
                          A_Not_Operator =>
                           Push;
                           Infix;
                           Push;
                     end case;
                  end if;
               when An_Indexed_Component =>                     -- 4.1.1
                  Push;
                  Push ("",
                        Is_Comma_List,
                        Count (Asis.Expressions.Index_Expressions (Element)));
               when A_Slice =>                                  -- 4.1.2
                  Push ("(");
                  Push (") ");
               when A_Selected_Component =>                     -- 4.1.3
                  Push (".");
                  No_Space;
                  Push;
               when An_Attribute_Reference =>
                  --  4.1.4  -> Attribute_Kinds
                  case Asis.Elements.Attribute_Kind (Element) is
                     when Not_An_Attribute =>
                        Ada.Text_IO.Put ("<<Node Not_An_Attribute>>");
                     when A_First_Attribute |
                     A_Last_Attribute |
                     A_Length_Attribute |
                     A_Range_Attribute |
                     An_Implementation_Defined_Attribute |
                     An_Unknown_Attribute =>
                        Push ("'");
                        No_Space;
                        Push;
                        Push
                          ("",
                           Is_Comma_List,
                           Count
                              (Asis.Expressions.
                                 Attribute_Designator_Expressions (Element)));
                     when others =>
                        Push ("'");
                        No_Space;
                        Push;
                  end case;
               when A_Record_Aggregate =>                       -- 4.3
                  if Count (Asis.Expressions.Record_Component_Associations
                    (Element, False)) = 0
                  then
                     Send ("(null record)");
                  else
                     Push
                       ("",
                        Is_Comma_List,
                        Count (Asis.Expressions.Record_Component_Associations
                          (Element, False)));
                  end if;
               when An_Extension_Aggregate =>                   -- 4.3
                  if Count (Asis.Expressions.Record_Component_Associations
                     (Element, False)) = 0
                  then
                     Send ("(");
                     Push ("with null record)");
                  else
                     Send ("(");
                     Push ("with ");
                     Push
                       (")",
                        Is_Comma_No_Parenthesis_List,
                        Count (Asis.Expressions.Record_Component_Associations
                          (Element, False)));
                  end if;
               when A_Positional_Array_Aggregate |
                  A_Named_Array_Aggregate =>
                  --  4.3 -- corrected in ASIS-GNAT
                  --  4.3 -- corrected in ASIS-GNAT
                  Push
                    ("",
                     Is_Comma_List,
                     Count (Asis.Expressions.Array_Component_Associations
                       (Element)));
               when An_And_Then_Short_Circuit =>                -- 4.4
                  Push ("and then ");
                  Push;
               when An_Or_Else_Short_Circuit =>                 -- 4.4
                  Push ("or else ");
                  Push;
               when An_In_Range_Membership_Test =>              -- 4.4
                  Push ("in ");
                  Push;
               when A_Not_In_Range_Membership_Test =>           -- 4.4
                  Push ("not in ");
                  Push;
               when An_In_Type_Membership_Test =>               -- 4.4
                  Push ("in ");
                  Push;
               when A_Not_In_Type_Membership_Test =>            -- 4.4
                  Push ("not in ");
                  Push;
               when A_Null_Literal =>                           -- 4.4
                  Send ("null ");
               when A_Parenthesized_Expression =>               -- 4.4
                  Send ("(");
                  Push (") ");
               when A_Type_Conversion =>                        -- 4.6
                  Push ("(");
                  Push  (") ");
               when A_Qualified_Expression =>                   -- 4.7
                  Push ("'");
                  No_Space;
                  Push;
               when An_Allocation_From_Subtype =>               -- 4.8
                  Send ("new ");
                  Push;
               when An_Allocation_From_Qualified_Expression => -- 4.8
                  Send ("new ");
                  Push;
            end case;
         when An_Association =>
            case Asis.Elements.Association_Kind (Element) is
               when Not_An_Association =>
                  --  An unexpected element
                  Ada.Text_IO.Put ("<<Node Not_An_Association>>");
               when A_Discriminant_Association =>           -- 3.7.1
                  L := Count (Asis.Expressions.Discriminant_Selector_Names
                         (Element));
                  if L /= 0 then
                     Push ("=> ",
                           Is_Vertical_Line_List,
                           L);
                  end if;
                  Push;
               when A_Record_Component_Association =>       -- 4.3.1
                  L := Count (Asis.Expressions.Record_Component_Choices
                         (Element));
                  if L /= 0 then
                     Push ("=> ",
                           Is_Vertical_Line_List,
                           L);
                  end if;
                  Push;
               when An_Array_Component_Association =>       -- 4.3.3
                  L := Count (Asis.Expressions.Array_Component_Choices
                         (Element));
                  if L /= 0 then
                     Push ("=> ",
                           Is_Vertical_Line_List,
                           L);
                  end if;
                  Push;
               when A_Parameter_Association |              -- 6.4
                 A_Pragma_Argument_Association |          -- 2.8
                 A_Generic_Association =>                 -- 12.3
                  if Is_Here (Asis.Expressions.Formal_Parameter
                       (Element))
                  then
                     Push ("=> ");
                  end if;
                  Push;
            end case;
         when A_Statement =>
            case Asis.Elements.Statement_Kind (Element) is
               when Not_A_Statement =>
                  --  An unexpected element
                  Ada.Text_IO.Put ("<<Node Not_A_Statement>>");
               when A_Null_Statement =>                   -- 5.1
                  Send_Label ("null;" & ASCII.CR);
               when An_Assignment_Statement =>            -- 5.2
                  Send_Label ("");
                  Push (":= ");
                  Push (";" &  ASCII.CR);
               when An_If_Statement =>                    -- 5.3
                  Send_Label ("");
                  Push ("end if;" & ASCII.CR,
                        Not_In_A_List,
                        Count (Asis.Statements.Statement_Paths (Element)));
               when A_Case_Statement =>                   -- 5.4
                  Send_Label ("case ");
                  Push ("is" & ASCII.CR);
                  Push ("end case;" & ASCII.CR,
                        Not_In_A_List,
                        Count (Asis.Statements.Statement_Paths (Element)));
                  Indent;
               when A_Loop_Statement =>             -- 5.55
                  if Is_Here (Asis.Statements.Statement_Identifier
                       (Element))
                  then
                     Send_Label ("");
                     Push (":" & ASCII.CR & "loop" & ASCII.CR);
                     No_Space;
                     Push
                       ("end loop " &
                        To_String (Asis.Declarations.Defining_Name_Image
                        (Asis.Statements.Statement_Identifier (Element))) &
                        ";" & ASCII.CR,
                        Not_In_A_List,
                        Count (Asis.Statements.Loop_Statements
                          (Element, True)));
                     Indent;
                  else
                     Send_Label ("loop" & ASCII.CR);
                     Push
                       ("end loop;" & ASCII.CR,
                        Not_In_A_List,
                        Count (Asis.Statements.Loop_Statements
                          (Element, True)));
                     Indent;
                  end if;
               when A_While_Loop_Statement =>         -- 5.5
                  if Is_Here (Asis.Statements.Statement_Identifier
                       (Element))
                  then
                     Send_Label ("");
                     Push (":" & ASCII.CR & "while ");
                     No_Space;
                     Push ("loop" & ASCII.CR);
                     Push
                       ("end loop " &
                        To_String (Asis.Declarations.Defining_Name_Image
                        (Asis.Statements.Statement_Identifier (Element))) &
                        ";" & ASCII.CR,
                        Not_In_A_List,
                        Count (Asis.Statements.Loop_Statements
                          (Element, True)));
                     Indent;
                  else
                     Send_Label ("while ");
                     Push ("loop" & ASCII.CR);
                     Push
                       ("end loop;" & ASCII.CR,
                        Not_In_A_List,
                        Count (Asis.Statements.Loop_Statements
                          (Element, True)));
                     Indent;
                  end if;
               when A_For_Loop_Statement =>         -- 5.5
                  if Is_Here (Asis.Statements.Statement_Identifier
                       (Element))
                  then
                     Send_Label ("");
                     Push (":" & ASCII.CR & "for ");
                     No_Space;
                     Push ("loop" & ASCII.CR);
                     Push
                       ("end loop " &
                        To_String (Asis.Declarations.Defining_Name_Image
                        (Asis.Statements.Statement_Identifier (Element))) &
                        ";" & ASCII.CR,
                        Not_In_A_List,
                        Count (Asis.Statements.Loop_Statements
                          (Element, True)));
                     Indent;
                  else
                     Send_Label ("for ");
                     Push ("loop" & ASCII.CR);
                     Push
                       ("end loop;" & ASCII.CR,
                        Not_In_A_List,
                        Count (Asis.Statements.Loop_Statements
                          (Element, True)));
                     Indent;
                  end if;

               when A_Block_Statement =>                  -- 5.6
                  if Is_Here (Asis.Statements.Statement_Identifier
                       (Element))
                  then
                     Send_Label ("");
                     if Asis.Statements.Is_Declare_Block (Element) then
                        Push (":" & ASCII.CR & "declare" & ASCII.CR);
                        No_Space;
                        Push
                          ("begin" & ASCII.CR,
                           Not_In_A_List,
                           Count (Asis.Statements.Block_Declarative_Items
                             (Element, True)));
                        Indent;
                     else
                        Push (":" & ASCII.CR & "begin" & ASCII.CR);
                        No_Space;
                     end if;
                  else
                     if Asis.Statements.Is_Declare_Block (Element) then
                        Send_Label ("declare" & ASCII.CR);
                        Push
                          ("begin" & ASCII.CR,
                           Not_In_A_List,
                           Count (Asis.Statements.Block_Declarative_Items
                             (Element, True)));
                        Indent;
                     else
                        Send_Label ("begin" & ASCII.CR);
                     end if;
                  end if;
                  if (Count (Asis.Statements.Block_Exception_Handlers
                        (Element, True)) /= 0)
                  then
                     Push
                       ("exception" & ASCII.CR,
                        Not_In_A_List,
                        Count (Asis.Statements.Block_Statements
                           (Element, True)));
                     Indent;
                     if (Is_Here (Asis.Statements.Statement_Identifier
                           (Element)))
                     then
                        Push
                          ("end "
                           & To_String
                               (Asis.Declarations.Defining_Name_Image (
                                 Asis.Statements.Statement_Identifier
                                   (Element)))
                           & ";" & ASCII.CR,
                           Not_In_A_List,
                           Count (Asis.Statements.Block_Exception_Handlers
                             (Element, True)));
                     else
                        Push
                          ("end;" & ASCII.CR,
                           Not_In_A_List,
                           Count (Asis.Statements.Block_Exception_Handlers
                             (Element, True)));
                     end if;
                     Indent;
                  else
                     if (Is_Here (Asis.Statements.Statement_Identifier
                       (Element)))
                     then
                        Push
                          ("end "
                           & To_String
                             (Asis.Declarations.Defining_Name_Image (
                                 Asis.Statements.Statement_Identifier
                                   (Element)))
                           & ";" & ASCII.CR,
                           Not_In_A_List,
                           Count (Asis.Statements.Block_Statements
                              (Element, True)));
                     else
                        Push
                          ("end;" & ASCII.CR,
                           Not_In_A_List,
                           Count (Asis.Statements.Block_Statements
                             (Element, True)));
                     end if;
                     Indent;
                  end if;
               when An_Exit_Statement =>                  -- 5.7
                  if Is_Here (Asis.Statements.Exit_Loop_Name
                       (Element))
                  then
                     Send_Label ("exit ");
                     if Is_Here (Asis.Statements.Exit_Condition
                        (Element))
                     then
                        Push ("when ");
                     end if;
                     Push (";" & ASCII.CR);
                  else
                     if Is_Here (Asis.Statements.Exit_Condition
                          (Element))
                     then
                        Send_Label ("exit when ");
                        Push (";" & ASCII.CR);
                     else
                        Send_Label ("exit;" & ASCII.CR);
                     end if;
                  end if;

               when A_Goto_Statement =>                   -- 5.8
                  Send_Label ("goto ");
                  Push (";" & ASCII.CR);
               when A_Procedure_Call_Statement |         -- 6.4
                  An_Entry_Call_Statement =>            -- 9.5.3
                  Send_Label ("");
                  Push;
                  Push
                    (";" & ASCII.CR,
                     Is_Comma_List,
                     Count (Asis.Statements.Call_Statement_Parameters
                        (Element, False)));
               when A_Return_Statement =>                 -- 6.5
                  if Is_Here (Asis.Statements.Return_Expression
                      (Element))
                  then
                     Send_Label ("return ");
                     Push (";" & ASCII.CR);
                  else
                     Send_Label ("return;" & ASCII.CR);
                  end if;
               when An_Accept_Statement =>                -- 9.5.2
                  Send_Label ("accept ");
                  if Is_Here (Asis.Statements.Accept_Entry_Index
                     (Element))
                  then
                     Push ("(");
                     Push (") ");
                  else
                     Push;
                  end if;
                  L := Count (Asis.Statements.Accept_Body_Statements
                         (Element, True));
                  M := Count (Asis.Statements.Accept_Body_Exception_Handlers
                         (Element, True));
                  if L = 0 then
                  --  if L = 0 then M = 0 too ..
                     Push
                       (";" & ASCII.CR,
                        Is_Semi_Colon_List,
   --                      Is_Comma_List,
                        Count (Asis.Statements.Accept_Parameters (Element)));
                  else
                     Push
                       ("do" & ASCII.CR,
                        Is_Semi_Colon_List,
   --                      Is_Comma_List,
                        Count (Asis.Statements.Accept_Parameters (Element)));
                     if M = 0 then
                        Push
                          ("end " &
                           To_String (Asis.Expressions.Name_Image
                              (Asis.Statements.Accept_Entry_Direct_Name
                                 (Element))) &
                           ";" & ASCII.CR,
                           Not_In_A_List,
                           L);
                        Indent;
                     else
                        Push ("exception" & ASCII.CR,
                              Not_In_A_List,
                              L);
                        Indent;
                        Push
                          ("end " &
   --                         Asis.Declarations.Defining_Name_Image
                           To_String (Asis.Expressions.Name_Image
                              (Asis.Statements.Accept_Entry_Direct_Name
                                 (Element))) &
                           ";" & ASCII.CR,
                           Not_In_A_List,
                           M);
                        Indent;
                     end if;
                  end if;
               when A_Requeue_Statement =>          -- 9.5.4
                  Send_Label ("requeue ");
                  Push (";" & ASCII.CR);
               when A_Requeue_Statement_With_Abort =>     -- 9.5.4
                  Send_Label ("requeue ");
                  Push ("with abort;" & ASCII.CR);
               when A_Delay_Until_Statement =>            -- 9.6
                  Send_Label ("delay until ");
                  Push (";" & ASCII.CR);
               when A_Delay_Relative_Statement =>         -- 9.6
                  Send_Label ("delay ");
                  Push (";" & ASCII.CR);
               when A_Terminate_Alternative_Statement =>  -- 9.7.1
                  Send_Label ("terminate;" & ASCII.CR);
               when A_Selective_Accept_Statement |       -- 9.7.2
                  A_Conditional_Entry_Call_Statement => -- 9.7.3
                  Send_Label ("select" & ASCII.CR);
                  Push ("end select;" & ASCII.CR,
                        Not_In_A_List,
                        Count (Asis.Statements.Statement_Paths (Element)));
                  Indent;
               when A_Timed_Entry_Call_Statement |        -- 9.7.3
                 An_Asynchronous_Select_Statement =>     -- 9.7.4
                  Send_Label ("select" & ASCII.CR);
                  Push;
                  Push ("end select;" & ASCII.CR);
               when An_Abort_Statement =>                 -- 9.8
                  Send_Label ("abort ");
                  Push (";" & ASCII.CR,
                        Is_Comma_No_Parenthesis_List,
                        Count (Asis.Statements.Aborted_Tasks (Element)));
               when A_Raise_Statement =>                  -- 11.3
                  if Is_Here (Asis.Statements.Raised_Exception
                       (Element))
                  then
                     Send_Label ("raise ");
                     Push (";" & ASCII.CR);
                  else
                     Send_Label ("raise;" & ASCII.CR);
                  end if;
               when A_Code_Statement =>                  -- 13.8
                  Push (";" & ASCII.CR);
            end case;
         when A_Path =>
            case Asis.Elements.Path_Kind (Element) is
               when Not_A_Path =>               -- An unexpected element
                  Ada.Text_IO.Put ("<<Node Not_A_Path>>");
               when An_If_Path =>              -- 5.3:
                  Send ("if ");
                  Push (ASCII.CR & "then" & ASCII.CR);
                  Push
                     ("",
                      Not_In_A_List,
                      Count (Asis.Statements.Sequence_Of_Statements
                         (Element, True)));
                  Indent;
               when An_Elsif_Path =>           -- 5.3:
                  Send ("elsif ");
                  Push (ASCII.CR & "then" & ASCII.CR);
                  Push
                    ("",
                     Not_In_A_List,
                     Count (Asis.Statements.Sequence_Of_Statements
                       (Element, True)));
                  Indent;
               when An_Else_Path =>            -- 5.3, 9.7.1, 9.7.3:
                  Send ("else" & ASCII.CR);
                  Push
                    ("",
                     Not_In_A_List,
                     Count (Asis.Statements.Sequence_Of_Statements
                       (Element, True)));
                  Indent;
               when A_Case_Path =>             -- 5.4:
                  Send ("when ");
                  Push
                    ("=>" & ASCII.CR,
                     Is_Vertical_Line_List,
                     Count (Asis.Statements.Case_Statement_Alternative_Choices
                        (Element)));
                  Indent (5);
                  Check_If_Return_Separator
                    (Asis.Statements.Case_Statement_Alternative_Choices
                      (Element));
                  Push
                    ("",
                     Not_In_A_List,
                     Count (Asis.Statements.Sequence_Of_Statements
                       (Element, True)));
                  Indent;
               when A_Select_Path =>           -- 9.7.1:
                  if Is_Here (Asis.Statements.Guard (Element)) then
                     Send ("when ");
                     Push ("=>" & ASCII.CR);
   --                Push;
   --                Indent;
                  end if;
                  Push
                    ("",
                     Not_In_A_List,
                     Count (Asis.Statements.Sequence_Of_Statements
                       (Element, True)));
                  Indent;
               when An_Or_Path =>              -- 9.7.1:
                  Send ("or" & ASCII.CR);
                  if Is_Here (Asis.Statements.Guard (Element)) then
                     Send ("when ");
                     Push ("=>" & ASCII.CR);
                  end if;
                  Push
                    ("",
                     Not_In_A_List,
                     Count (Asis.Statements.Sequence_Of_Statements
                       (Element, True)));
                  Indent;
               when A_Then_Abort_Path =>       -- 9.7.4
                  Send ("then abort" & ASCII.CR);
                  Push
                    ("",
                     Not_In_A_List,
                     Count (Asis.Statements.Sequence_Of_Statements
                       (Element, True)));
                  Indent;
            end case;
         when A_Clause =>
            case Asis.Elements.Clause_Kind (Element) is
               when Not_A_Clause =>                  -- An unexpected element
                  Ada.Text_IO.Put ("<<Node Not_A_Clause>>");
               when A_Use_Package_Clause =>            -- 8.4
                  Send ("use ");
                  Push (";" & ASCII.CR,
                        Is_Comma_No_Parenthesis_List,
                        Count (Asis.Clauses.Clause_Names (Element)));
               when A_Use_Type_Clause =>               -- 8.4
                  Send ("use type ");
                  Push (";" & ASCII.CR,
                        Is_Comma_No_Parenthesis_List,
                        Count (Asis.Clauses.Clause_Names (Element)));
               when A_With_Clause =>                 -- 10.1.2
                  Send ("with ");
                  Push
                    (";" & ASCII.CR,
                     Is_Comma_No_Parenthesis_List,
                     Count (Asis.Clauses.Clause_Names (Element)));
               when A_Representation_Clause =>
                  --  13.1     -> Representation_Clause_Kinds
                  case Asis.Elements.Representation_Clause_Kind (Element) is
                     when Not_A_Representation_Clause =>
                        --  An unexpected element
                        Ada.Text_IO.Put
                           ("<<Node Not_A_Representation_Clause>>");
                     when An_Attribute_Definition_Clause =>          -- 13.3
                        Send ("for ");
                        Push ("use ");
                        Push (";" & ASCII.CR);
                     when An_Enumeration_Representation_Clause =>    -- 13.4
                        Send ("for ");
                        Push ("use ");
                        Push (";" & ASCII.CR);
                     when A_Record_Representation_Clause =>          -- 13.5.1
                        Send ("for ");
                        Push ("use record" & ASCII.CR);
                        Push
                          ("end record;" & ASCII.CR,
                           Not_In_A_List,
                           Count (Asis.Clauses.Component_Clauses
                              (Element, True)));
                        Indent;
                     when An_At_Clause =>                            -- J.7
                        Send ("for ");
                        Push ("use at ");
                        Push (";" & ASCII.CR);
                  end case;
               when A_Component_Clause =>            -- 13.5.1
                  Push ("at ");
                  Push ("range ");
                  Push (";" & ASCII.CR);
            end case;
         when An_Exception_Handler =>
            Send ("when ");
            if Is_Here (Asis.Statements.Choice_Parameter_Specification
              (Element))
            then
               Push;
            end if;
            Push ("=>" & ASCII.CR,
              Is_Vertical_Line_List,
                  Count (Asis.Statements.Exception_Choices (Element)));
            Push ("",
              Not_In_A_List,
                  Count (Asis.Statements.Handler_Statements (Element, True)));
            Indent;
      end case;
      --  pours the Tmp_Stack in the Lexical_Stack
      --  and reverses the order of the pushed elements.
      Commit;
   end Pre_Source;

--  3 procedures that must be in the package.

   procedure Initiate_Source
     (Unit    : in    Asis.Compilation_Unit;
      Name    : in    String;
      Control : in out Asis.Traverse_Control;
      State   : in out Info_Source) is
   begin
      pragma Unreferenced (Unit);
      pragma Unreferenced (Name);
      pragma Unreferenced (Control);
      pragma Unreferenced (State);
--     case Asis.Compilation_Units.Unit_Kind (Unit) is
--        when A_Procedure_Body_Subunit |
--             A_Function_Body_Subunit  |
--             A_Package_Body_Subunit   |
--             A_Task_Body_Subunit      |
--             A_Protected_Body_Subunit
--          =>
--         declare
--            I : Natural := 0;
--         begin
--            for Index in Name'First .. Name'Last - 4
--            loop
--               if Name (Index) = '.'
--               then
--                  I := Index;
--               end if;
--            end loop;
--            if I = 0
--            then
--               Ada.Text_IO.Put_Line ("Subunit has no complex name.");
--               return;
--            else
--
--               Ada.Text_IO.New_Line;
--               Ada.Text_IO.Put_line ("separate (" &
--                         Name (Name'First .. I - 1) &
--                         ")");
--            end if;
--         end;
--      when others =>
--         null;
--     end case;
      null;
      --  !!???? REQUIRES REVISING
   end Initiate_Source;

   procedure Terminate_Source
     (Control : in out Asis.Traverse_Control;
      State   : in out Info_Source) is
   begin
      State.Finishing_Traversal := True;
      --  normaly there remain only one node on stack ....
      while not Node_Stack.Is_Empty (State.Lexical_Stack)
      loop
         Pre_Source (Asis.Nil_Element, Control, State);
      end loop;
   end Terminate_Source;

   procedure Post_Source
     (Element : in     Asis.Element;
      Control : in out Asis.Traverse_Control;
      State   : in out Info_Source) is
   begin
      pragma Unreferenced (Element);
      pragma Unreferenced (Control);
      pragma Unreferenced (State);
      null;
   end Post_Source;

end Source_Trav;