1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 2001-2016, Free Software Foundation, Inc. --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 ------------------------------------------------------------------------------
26 with Ada
.Characters
.Handling
; use Ada
.Characters
.Handling
;
28 with Output
; use Output
;
31 package body Prj
.PP
is
35 Not_Tested
: array (Project_Node_Kind
) of Boolean := (others => True);
37 procedure Indicate_Tested
(Kind
: Project_Node_Kind
);
38 -- Set the corresponding component of array Not_Tested to False. Only
39 -- called by Debug pragmas.
45 procedure Indicate_Tested
(Kind
: Project_Node_Kind
) is
47 Not_Tested
(Kind
) := False;
54 procedure Pretty_Print
55 (Project
: Prj
.Tree
.Project_Node_Id
;
56 In_Tree
: Prj
.Tree
.Project_Node_Tree_Ref
;
57 Increment
: Positive := 3;
58 Eliminate_Empty_Case_Constructions
: Boolean := False;
59 Minimize_Empty_Lines
: Boolean := False;
60 W_Char
: Write_Char_Ap
:= null;
61 W_Eol
: Write_Eol_Ap
:= null;
62 W_Str
: Write_Str_Ap
:= null;
63 Backward_Compatibility
: Boolean;
64 Id
: Prj
.Project_Id
:= Prj
.No_Project
;
65 Max_Line_Length
: Max_Length_Of_Line
:=
66 Max_Length_Of_Line
'Last)
68 procedure Print
(Node
: Project_Node_Id
; Indent
: Natural);
69 -- A recursive procedure that traverses a project file tree and outputs
70 -- its source. Current_Prj is the project that we are printing. This
71 -- is used when printing attributes, since in nested packages they
72 -- need to use a fully qualified name.
74 procedure Output_Attribute_Name
(Name
: Name_Id
; Indent
: Natural);
75 -- Outputs an attribute name, taking into account the value of
76 -- Backward_Compatibility.
81 Capitalize
: Boolean := True);
84 procedure Start_Line
(Indent
: Natural);
85 -- Outputs the indentation at the beginning of the line
87 procedure Output_Project_File
(S
: Name_Id
);
88 -- Output a project file name in one single string literal
90 procedure Output_String
(S
: Name_Id
; Indent
: Natural);
91 -- Outputs a string using the default output procedures
93 procedure Write_Empty_Line
(Always
: Boolean := False);
94 -- Outputs an empty line, only if the previous line was not empty
95 -- already and either Always is True or Minimize_Empty_Lines is False.
97 procedure Write_Line
(S
: String);
98 -- Outputs S followed by a new line
100 procedure Write_String
103 Truncated
: Boolean := False);
104 -- Outputs S using Write_Str, starting a new line if line would become
105 -- too long, when Truncated = False. When Truncated = True, only the
106 -- part of the string that can fit on the line is output.
108 procedure Write_End_Of_Line_Comment
(Node
: Project_Node_Id
);
111 Write_Char
: Write_Char_Ap
:= Output
.Write_Char
'Access;
112 Write_Eol
: Write_Eol_Ap
:= Output
.Write_Eol
'Access;
113 Write_Str
: Write_Str_Ap
:= Output
.Write_Str
'Access;
114 -- These three access to procedure values are used for the output
116 Last_Line_Is_Empty
: Boolean := False;
117 -- Used to avoid two consecutive empty lines
119 Column
: Natural := 0;
120 -- Column number of the last character in the line. Used to avoid
121 -- outputting lines longer than Max_Line_Length.
123 First_With_In_List
: Boolean := True;
124 -- Indicate that the next with clause is first in a list such as
126 -- First_With_In_List will be True for "A", but not for "B".
128 ---------------------------
129 -- Output_Attribute_Name --
130 ---------------------------
132 procedure Output_Attribute_Name
(Name
: Name_Id
; Indent
: Natural) is
134 if Backward_Compatibility
then
136 when Snames
.Name_Spec
=>
137 Output_Name
(Snames
.Name_Specification
, Indent
);
139 when Snames
.Name_Spec_Suffix
=>
140 Output_Name
(Snames
.Name_Specification_Suffix
, Indent
);
142 when Snames
.Name_Body
=>
143 Output_Name
(Snames
.Name_Implementation
, Indent
);
145 when Snames
.Name_Body_Suffix
=>
146 Output_Name
(Snames
.Name_Implementation_Suffix
, Indent
);
149 Output_Name
(Name
, Indent
);
153 Output_Name
(Name
, Indent
);
155 end Output_Attribute_Name
;
161 procedure Output_Name
164 Capitalize
: Boolean := True)
166 Capital
: Boolean := Capitalize
;
169 if Column
= 0 and then Indent
/= 0 then
170 Start_Line
(Indent
+ Increment
);
173 Get_Name_String
(Name
);
175 -- If line would become too long, create new line
177 if Column
+ Name_Len
> Max_Line_Length
then
182 Start_Line
(Indent
+ Increment
);
186 for J
in 1 .. Name_Len
loop
188 Write_Char
(To_Upper
(Name_Buffer
(J
)));
190 Write_Char
(Name_Buffer
(J
));
195 Name_Buffer
(J
) = '_'
196 or else Is_Digit
(Name_Buffer
(J
));
200 Column
:= Column
+ Name_Len
;
203 -------------------------
204 -- Output_Project_File --
205 -------------------------
207 procedure Output_Project_File
(S
: Name_Id
) is
208 File_Name
: constant String := Get_Name_String
(S
);
213 for J
in File_Name
'Range loop
214 if File_Name
(J
) = '"' then
218 Write_Char
(File_Name
(J
));
223 end Output_Project_File
;
229 procedure Output_String
(S
: Name_Id
; Indent
: Natural) is
231 if Column
= 0 and then Indent
/= 0 then
232 Start_Line
(Indent
+ Increment
);
237 -- If line could become too long, create new line. Note that the
238 -- number of characters on the line could be twice the number of
239 -- character in the string (if every character is a '"') plus two
240 -- (the initial and final '"').
242 if Column
+ Name_Len
+ Name_Len
+ 2 > Max_Line_Length
then
247 Start_Line
(Indent
+ Increment
);
252 Column
:= Column
+ 1;
255 for J
in 1 .. Name_Len
loop
256 if Name_Buffer
(J
) = '"' then
259 Column
:= Column
+ 2;
261 Write_Char
(Name_Buffer
(J
));
262 Column
:= Column
+ 1;
265 -- If the string does not fit on one line, cut it in parts and
268 if J
< Name_Len
and then Column
>= Max_Line_Length
then
272 Start_Line
(Indent
+ Increment
);
274 Column
:= Column
+ 1;
279 Column
:= Column
+ 1;
286 procedure Start_Line
(Indent
: Natural) is
288 if not Minimize_Empty_Lines
then
289 Write_Str
((1 .. Indent
=> ' '));
290 Column
:= Column
+ Indent
;
294 ----------------------
295 -- Write_Empty_Line --
296 ----------------------
298 procedure Write_Empty_Line
(Always
: Boolean := False) is
300 if (Always
or else not Minimize_Empty_Lines
)
301 and then not Last_Line_Is_Empty
305 Last_Line_Is_Empty
:= True;
307 end Write_Empty_Line
;
309 -------------------------------
310 -- Write_End_Of_Line_Comment --
311 -------------------------------
313 procedure Write_End_Of_Line_Comment
(Node
: Project_Node_Id
) is
314 Value
: constant Name_Id
:= End_Of_Line_Comment
(Node
, In_Tree
);
317 if Value
/= No_Name
then
318 Write_String
(" --", 0);
319 Write_String
(Get_Name_String
(Value
), 0, Truncated
=> True);
323 end Write_End_Of_Line_Comment
;
329 procedure Write_Line
(S
: String) is
332 Last_Line_Is_Empty
:= False;
341 procedure Write_String
344 Truncated
: Boolean := False)
346 Length
: Natural := S
'Length;
349 if Column
= 0 and then Indent
/= 0 then
350 Start_Line
(Indent
+ Increment
);
353 -- If the string would not fit on the line, start a new line
355 if Column
+ Length
> Max_Line_Length
then
357 Length
:= Max_Line_Length
- Column
;
364 Start_Line
(Indent
+ Increment
);
369 Write_Str
(S
(S
'First .. S
'First + Length
- 1));
370 Column
:= Column
+ Length
;
377 procedure Print
(Node
: Project_Node_Id
; Indent
: Natural) is
379 if Present
(Node
) then
380 case Kind_Of
(Node
, In_Tree
) is
382 pragma Debug
(Indicate_Tested
(N_Project
));
383 if Present
(First_With_Clause_Of
(Node
, In_Tree
)) then
387 First_With_In_List
:= True;
388 Print
(First_With_Clause_Of
(Node
, In_Tree
), Indent
);
389 Write_Empty_Line
(Always
=> True);
392 Print
(First_Comment_Before
(Node
, In_Tree
), Indent
);
395 case Project_Qualifier_Of
(Node
, In_Tree
) is
401 Write_String
("aggregate ", Indent
);
403 when Aggregate_Library
=>
404 Write_String
("aggregate library ", Indent
);
406 Write_String
("library ", Indent
);
408 when Configuration
=>
409 Write_String
("configuration ", Indent
);
411 when Abstract_Project
=>
412 Write_String
("abstract ", Indent
);
415 Write_String
("project ", Indent
);
417 if Id
/= Prj
.No_Project
then
418 Output_Name
(Id
.Display_Name
, Indent
);
420 Output_Name
(Name_Of
(Node
, In_Tree
), Indent
);
423 -- Check if this project extends another project
425 if Extended_Project_Path_Of
(Node
, In_Tree
) /= No_Path
then
426 Write_String
(" extends ", Indent
);
428 if Is_Extending_All
(Node
, In_Tree
) then
429 Write_String
("all ", Indent
);
433 (Name_Id
(Extended_Project_Path_Of
(Node
, In_Tree
)));
436 Write_String
(" is", Indent
);
437 Write_End_Of_Line_Comment
(Node
);
439 (First_Comment_After
(Node
, In_Tree
), Indent
+ Increment
);
440 Write_Empty_Line
(Always
=> True);
442 -- Output all of the declarations in the project
444 Print
(Project_Declaration_Of
(Node
, In_Tree
), Indent
);
446 (First_Comment_Before_End
(Node
, In_Tree
),
449 Write_String
("end ", Indent
);
451 if Id
/= Prj
.No_Project
then
452 Output_Name
(Id
.Display_Name
, Indent
);
454 Output_Name
(Name_Of
(Node
, In_Tree
), Indent
);
458 Print
(First_Comment_After_End
(Node
, In_Tree
), Indent
);
460 when N_With_Clause
=>
461 pragma Debug
(Indicate_Tested
(N_With_Clause
));
463 -- The with clause will sometimes contain an invalid name
464 -- when we are importing a virtual project from an extending
465 -- all project. Do not output anything in this case.
467 if Name_Of
(Node
, In_Tree
) /= No_Name
468 and then String_Value_Of
(Node
, In_Tree
) /= No_Name
470 if First_With_In_List
then
471 Print
(First_Comment_Before
(Node
, In_Tree
), Indent
);
474 if Non_Limited_Project_Node_Of
(Node
, In_Tree
) =
477 Write_String
("limited ", Indent
);
480 Write_String
("with ", Indent
);
483 -- Output the project name without concatenation, even if
484 -- the line is too long.
486 Output_Project_File
(String_Value_Of
(Node
, In_Tree
));
488 if Is_Not_Last_In_List
(Node
, In_Tree
) then
489 Write_String
(", ", Indent
);
490 First_With_In_List
:= False;
493 Write_String
(";", Indent
);
494 Write_End_Of_Line_Comment
(Node
);
495 Print
(First_Comment_After
(Node
, In_Tree
), Indent
);
496 First_With_In_List
:= True;
500 Print
(Next_With_Clause_Of
(Node
, In_Tree
), Indent
);
502 when N_Project_Declaration
=>
503 pragma Debug
(Indicate_Tested
(N_Project_Declaration
));
506 Present
(First_Declarative_Item_Of
(Node
, In_Tree
))
509 (First_Declarative_Item_Of
(Node
, In_Tree
),
511 Write_Empty_Line
(Always
=> True);
514 when N_Declarative_Item
=>
515 pragma Debug
(Indicate_Tested
(N_Declarative_Item
));
516 Print
(Current_Item_Node
(Node
, In_Tree
), Indent
);
517 Print
(Next_Declarative_Item
(Node
, In_Tree
), Indent
);
519 when N_Package_Declaration
=>
520 pragma Debug
(Indicate_Tested
(N_Package_Declaration
));
521 Write_Empty_Line
(Always
=> True);
522 Print
(First_Comment_Before
(Node
, In_Tree
), Indent
);
524 Write_String
("package ", Indent
);
525 Output_Name
(Name_Of
(Node
, In_Tree
), Indent
);
527 if Project_Of_Renamed_Package_Of
(Node
, In_Tree
) /=
530 if First_Declarative_Item_Of
(Node
, In_Tree
) = Empty_Node
532 Write_String
(" renames ", Indent
);
534 Write_String
(" extends ", Indent
);
539 (Project_Of_Renamed_Package_Of
(Node
, In_Tree
),
542 Write_String
(".", Indent
);
543 Output_Name
(Name_Of
(Node
, In_Tree
), Indent
);
546 if Project_Of_Renamed_Package_Of
(Node
, In_Tree
) /=
549 First_Declarative_Item_Of
(Node
, In_Tree
) = Empty_Node
551 Write_String
(";", Indent
);
552 Write_End_Of_Line_Comment
(Node
);
553 Print
(First_Comment_After_End
(Node
, In_Tree
), Indent
);
556 Write_String
(" is", Indent
);
557 Write_End_Of_Line_Comment
(Node
);
558 Print
(First_Comment_After
(Node
, In_Tree
),
561 if First_Declarative_Item_Of
(Node
, In_Tree
) /= Empty_Node
564 (First_Declarative_Item_Of
(Node
, In_Tree
),
568 Print
(First_Comment_Before_End
(Node
, In_Tree
),
571 Write_String
("end ", Indent
);
572 Output_Name
(Name_Of
(Node
, In_Tree
), Indent
);
574 Print
(First_Comment_After_End
(Node
, In_Tree
), Indent
);
578 when N_String_Type_Declaration
=>
579 pragma Debug
(Indicate_Tested
(N_String_Type_Declaration
));
580 Print
(First_Comment_Before
(Node
, In_Tree
), Indent
);
582 Write_String
("type ", Indent
);
583 Output_Name
(Name_Of
(Node
, In_Tree
), Indent
);
585 Start_Line
(Indent
+ Increment
);
586 Write_String
("(", Indent
);
589 String_Node
: Project_Node_Id
:=
590 First_Literal_String
(Node
, In_Tree
);
593 while Present
(String_Node
) loop
595 (String_Value_Of
(String_Node
, In_Tree
), Indent
);
597 Next_Literal_String
(String_Node
, In_Tree
);
599 if Present
(String_Node
) then
600 Write_String
(", ", Indent
);
605 Write_String
(");", Indent
);
606 Write_End_Of_Line_Comment
(Node
);
607 Print
(First_Comment_After
(Node
, In_Tree
), Indent
);
609 when N_Literal_String
=>
610 pragma Debug
(Indicate_Tested
(N_Literal_String
));
611 Output_String
(String_Value_Of
(Node
, In_Tree
), Indent
);
613 if Source_Index_Of
(Node
, In_Tree
) /= 0 then
614 Write_String
(" at", Indent
);
616 (Source_Index_Of
(Node
, In_Tree
)'Img, Indent
);
619 when N_Attribute_Declaration
=>
620 pragma Debug
(Indicate_Tested
(N_Attribute_Declaration
));
621 Print
(First_Comment_Before
(Node
, In_Tree
), Indent
);
623 Write_String
("for ", Indent
);
624 Output_Attribute_Name
(Name_Of
(Node
, In_Tree
), Indent
);
626 if Associative_Array_Index_Of
(Node
, In_Tree
) /= No_Name
then
627 Write_String
(" (", Indent
);
629 (Associative_Array_Index_Of
(Node
, In_Tree
), Indent
);
631 if Source_Index_Of
(Node
, In_Tree
) /= 0 then
632 Write_String
(" at", Indent
);
634 (Source_Index_Of
(Node
, In_Tree
)'Img, Indent
);
637 Write_String
(")", Indent
);
640 Write_String
(" use ", Indent
);
642 if Present
(Expression_Of
(Node
, In_Tree
)) then
643 Print
(Expression_Of
(Node
, In_Tree
), Indent
);
646 -- Full associative array declaration
648 if Present
(Associative_Project_Of
(Node
, In_Tree
)) then
651 (Associative_Project_Of
(Node
, In_Tree
),
655 if Present
(Associative_Package_Of
(Node
, In_Tree
))
657 Write_String
(".", Indent
);
660 (Associative_Package_Of
(Node
, In_Tree
),
665 elsif Present
(Associative_Package_Of
(Node
, In_Tree
))
669 (Associative_Package_Of
(Node
, In_Tree
),
674 Write_String
("'", Indent
);
675 Output_Attribute_Name
(Name_Of
(Node
, In_Tree
), Indent
);
678 Write_String
(";", Indent
);
679 Write_End_Of_Line_Comment
(Node
);
680 Print
(First_Comment_After
(Node
, In_Tree
), Indent
);
682 when N_Typed_Variable_Declaration
=>
684 (Indicate_Tested
(N_Typed_Variable_Declaration
));
685 Print
(First_Comment_Before
(Node
, In_Tree
), Indent
);
687 Output_Name
(Name_Of
(Node
, In_Tree
), Indent
);
688 Write_String
(" : ", Indent
);
690 (Name_Of
(String_Type_Of
(Node
, In_Tree
), In_Tree
),
692 Write_String
(" := ", Indent
);
693 Print
(Expression_Of
(Node
, In_Tree
), Indent
);
694 Write_String
(";", Indent
);
695 Write_End_Of_Line_Comment
(Node
);
696 Print
(First_Comment_After
(Node
, In_Tree
), Indent
);
698 when N_Variable_Declaration
=>
699 pragma Debug
(Indicate_Tested
(N_Variable_Declaration
));
700 Print
(First_Comment_Before
(Node
, In_Tree
), Indent
);
702 Output_Name
(Name_Of
(Node
, In_Tree
), Indent
);
703 Write_String
(" := ", Indent
);
704 Print
(Expression_Of
(Node
, In_Tree
), Indent
);
705 Write_String
(";", Indent
);
706 Write_End_Of_Line_Comment
(Node
);
707 Print
(First_Comment_After
(Node
, In_Tree
), Indent
);
710 pragma Debug
(Indicate_Tested
(N_Expression
));
712 Term
: Project_Node_Id
:= First_Term
(Node
, In_Tree
);
715 while Present
(Term
) loop
716 Print
(Term
, Indent
);
717 Term
:= Next_Term
(Term
, In_Tree
);
719 if Present
(Term
) then
720 Write_String
(" & ", Indent
);
726 pragma Debug
(Indicate_Tested
(N_Term
));
727 Print
(Current_Term
(Node
, In_Tree
), Indent
);
729 when N_Literal_String_List
=>
730 pragma Debug
(Indicate_Tested
(N_Literal_String_List
));
731 Write_String
("(", Indent
);
734 Expression
: Project_Node_Id
:=
735 First_Expression_In_List
(Node
, In_Tree
);
738 while Present
(Expression
) loop
739 Print
(Expression
, Indent
);
741 Next_Expression_In_List
(Expression
, In_Tree
);
743 if Present
(Expression
) then
744 Write_String
(", ", Indent
);
749 Write_String
(")", Indent
);
751 when N_Variable_Reference
=>
752 pragma Debug
(Indicate_Tested
(N_Variable_Reference
));
753 if Present
(Project_Node_Of
(Node
, In_Tree
)) then
755 (Name_Of
(Project_Node_Of
(Node
, In_Tree
), In_Tree
),
757 Write_String
(".", Indent
);
760 if Present
(Package_Node_Of
(Node
, In_Tree
)) then
762 (Name_Of
(Package_Node_Of
(Node
, In_Tree
), In_Tree
),
764 Write_String
(".", Indent
);
767 Output_Name
(Name_Of
(Node
, In_Tree
), Indent
);
769 when N_External_Value
=>
770 pragma Debug
(Indicate_Tested
(N_External_Value
));
771 Write_String
("external (", Indent
);
772 Print
(External_Reference_Of
(Node
, In_Tree
), Indent
);
774 if Present
(External_Default_Of
(Node
, In_Tree
)) then
775 Write_String
(", ", Indent
);
776 Print
(External_Default_Of
(Node
, In_Tree
), Indent
);
779 Write_String
(")", Indent
);
781 when N_Attribute_Reference
=>
782 pragma Debug
(Indicate_Tested
(N_Attribute_Reference
));
784 if Present
(Project_Node_Of
(Node
, In_Tree
))
785 and then Project_Node_Of
(Node
, In_Tree
) /= Project
788 (Name_Of
(Project_Node_Of
(Node
, In_Tree
), In_Tree
),
791 if Present
(Package_Node_Of
(Node
, In_Tree
)) then
792 Write_String
(".", Indent
);
794 (Name_Of
(Package_Node_Of
(Node
, In_Tree
), In_Tree
),
798 elsif Present
(Package_Node_Of
(Node
, In_Tree
)) then
800 (Name_Of
(Package_Node_Of
(Node
, In_Tree
), In_Tree
),
804 Write_String
("project", Indent
);
807 Write_String
("'", Indent
);
808 Output_Attribute_Name
(Name_Of
(Node
, In_Tree
), Indent
);
811 Index
: constant Name_Id
:=
812 Associative_Array_Index_Of
(Node
, In_Tree
);
814 if Index
/= No_Name
then
815 Write_String
(" (", Indent
);
816 Output_String
(Index
, Indent
);
817 Write_String
(")", Indent
);
821 when N_Case_Construction
=>
822 pragma Debug
(Indicate_Tested
(N_Case_Construction
));
825 Case_Item
: Project_Node_Id
;
826 Is_Non_Empty
: Boolean := False;
829 Case_Item
:= First_Case_Item_Of
(Node
, In_Tree
);
830 while Present
(Case_Item
) loop
832 (First_Declarative_Item_Of
(Case_Item
, In_Tree
))
833 or else not Eliminate_Empty_Case_Constructions
835 Is_Non_Empty
:= True;
839 Case_Item
:= Next_Case_Item
(Case_Item
, In_Tree
);
844 Print
(First_Comment_Before
(Node
, In_Tree
), Indent
);
846 Write_String
("case ", Indent
);
848 (Case_Variable_Reference_Of
(Node
, In_Tree
), Indent
);
849 Write_String
(" is", Indent
);
850 Write_End_Of_Line_Comment
(Node
);
852 (First_Comment_After
(Node
, In_Tree
),
856 Case_Item
: Project_Node_Id
:=
857 First_Case_Item_Of
(Node
, In_Tree
);
859 while Present
(Case_Item
) loop
861 (Kind_Of
(Case_Item
, In_Tree
) = N_Case_Item
);
862 Print
(Case_Item
, Indent
+ Increment
);
864 Next_Case_Item
(Case_Item
, In_Tree
);
868 Print
(First_Comment_Before_End
(Node
, In_Tree
),
871 Write_Line
("end case;");
873 (First_Comment_After_End
(Node
, In_Tree
), Indent
);
878 pragma Debug
(Indicate_Tested
(N_Case_Item
));
880 if Present
(First_Declarative_Item_Of
(Node
, In_Tree
))
881 or else not Eliminate_Empty_Case_Constructions
884 Print
(First_Comment_Before
(Node
, In_Tree
), Indent
);
886 Write_String
("when ", Indent
);
888 if No
(First_Choice_Of
(Node
, In_Tree
)) then
889 Write_String
("others", Indent
);
893 Label
: Project_Node_Id
:=
894 First_Choice_Of
(Node
, In_Tree
);
897 while Present
(Label
) loop
898 Print
(Label
, Indent
);
899 Label
:= Next_Literal_String
(Label
, In_Tree
);
901 if Present
(Label
) then
902 Write_String
(" | ", Indent
);
908 Write_String
(" =>", Indent
);
909 Write_End_Of_Line_Comment
(Node
);
911 (First_Comment_After
(Node
, In_Tree
),
915 First
: constant Project_Node_Id
:=
916 First_Declarative_Item_Of
(Node
, In_Tree
);
921 Print
(First
, Indent
+ Increment
);
926 when N_Comment_Zones
=>
928 -- Nothing to do, because it will not be processed directly
933 pragma Debug
(Indicate_Tested
(N_Comment
));
935 if Follows_Empty_Line
(Node
, In_Tree
) then
940 Write_String
("--", Indent
);
942 (Get_Name_String
(String_Value_Of
(Node
, In_Tree
)),
947 if Is_Followed_By_Empty_Line
(Node
, In_Tree
) then
951 Print
(Next_Comment
(Node
, In_Tree
), Indent
);
956 -- Start of processing for Pretty_Print
959 if W_Char
= null then
960 Write_Char
:= Output
.Write_Char
'Access;
962 Write_Char
:= W_Char
;
966 Write_Eol
:= Output
.Write_Eol
'Access;
972 Write_Str
:= Output
.Write_Str
'Access;
980 -----------------------
981 -- Output_Statistics --
982 -----------------------
984 procedure Output_Statistics
is
986 Output
.Write_Line
("Project_Node_Kinds not tested:");
988 for Kind
in Project_Node_Kind
loop
989 if Kind
/= N_Comment_Zones
and then Not_Tested
(Kind
) then
990 Output
.Write_Str
(" ");
991 Output
.Write_Line
(Project_Node_Kind
'Image (Kind
));
996 end Output_Statistics
;
1003 (Project
: Prj
.Tree
.Project_Node_Id
;
1004 In_Tree
: Prj
.Tree
.Project_Node_Tree_Ref
)
1007 Pretty_Print
(Project
, In_Tree
, Backward_Compatibility
=> False);