1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2005, 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 2, 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 COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
25 ------------------------------------------------------------------------------
27 with Atree
; use Atree
;
28 with Casing
; use Casing
;
29 with Csets
; use Csets
;
30 with Debug
; use Debug
;
31 with Einfo
; use Einfo
;
33 with Namet
; use Namet
;
34 with Nlists
; use Nlists
;
36 with Output
; use Output
;
37 with Rtsfind
; use Rtsfind
;
38 with Sinfo
; use Sinfo
;
39 with Sinput
; use Sinput
;
40 with Sinput
.D
; use Sinput
.D
;
41 with Snames
; use Snames
;
42 with Stand
; use Stand
;
43 with Stringt
; use Stringt
;
44 with Uintp
; use Uintp
;
45 with Uname
; use Uname
;
46 with Urealp
; use Urealp
;
48 package body Sprint
is
50 Debug_Node
: Node_Id
:= Empty
;
51 -- If we are in Debug_Generated_Code mode, then this location is set
52 -- to the current node requiring Sloc fixup, until Set_Debug_Sloc is
53 -- called to set the proper value. The call clears it back to Empty.
55 Debug_Sloc
: Source_Ptr
;
56 -- Sloc of first byte of line currently being written if we are
57 -- generating a source debug file.
59 Dump_Original_Only
: Boolean;
60 -- Set True if the -gnatdo (dump original tree) flag is set
62 Dump_Generated_Only
: Boolean;
63 -- Set True if the -gnatG (dump generated tree) debug flag is set
64 -- or for Print_Generated_Code (-gnatG) or Dump_Generated_Code (-gnatD).
66 Dump_Freeze_Null
: Boolean;
67 -- Set True if freeze nodes and non-source null statements output
70 -- Number of columns for current line output indentation
72 Indent_Annull_Flag
: Boolean := False;
73 -- Set True if subsequent Write_Indent call to be ignored, gets reset
74 -- by this call, so it is only active to suppress a single indent call.
76 Line_Limit
: constant := 72;
77 -- Limit value for chopping long lines
79 Freeze_Indent
: Int
:= 0;
80 -- Keep track of freeze indent level (controls blank lines before
81 -- procedures within expression freeze actions)
83 -------------------------------
84 -- Operator Precedence Table --
85 -------------------------------
87 -- This table is used to decide whether a subexpression needs to be
88 -- parenthesized. The rule is that if an operand of an operator (which
89 -- for this purpose includes AND THEN and OR ELSE) is itself an operator
90 -- with a lower precedence than the operator (or equal precedence if
91 -- appearing as the right operand), then parentheses are required.
93 Op_Prec
: constant array (N_Subexpr
) of Short_Short_Integer :=
126 procedure Sprint_Left_Opnd
(N
: Node_Id
);
127 -- Print left operand of operator, parenthesizing if necessary
129 procedure Sprint_Right_Opnd
(N
: Node_Id
);
130 -- Print right operand of operator, parenthesizing if necessary
132 -----------------------
133 -- Local Subprograms --
134 -----------------------
136 procedure Col_Check
(N
: Nat
);
137 -- Check that at least N characters remain on current line, and if not,
138 -- then start an extra line with two characters extra indentation for
139 -- continuing text on the next line.
141 procedure Indent_Annull
;
142 -- Causes following call to Write_Indent to be ignored. This is used when
143 -- a higher level node wants to stop a lower level node from starting a
144 -- new line, when it would otherwise be inclined to do so (e.g. the case
145 -- of an accept statement called from an accept alternative with a guard)
147 procedure Indent_Begin
;
148 -- Increase indentation level
150 procedure Indent_End
;
151 -- Decrease indentation level
153 procedure Print_Debug_Line
(S
: String);
154 -- Used to print output lines in Debug_Generated_Code mode (this is used
155 -- as the argument for a call to Set_Special_Output in package Output).
157 procedure Process_TFAI_RR_Flags
(Nod
: Node_Id
);
158 -- Given a divide, multiplication or division node, check the flags
159 -- Treat_Fixed_As_Integer and Rounded_Flags, and if set, output the
160 -- appropriate special syntax characters (# and @).
162 procedure Set_Debug_Sloc
;
163 -- If Debug_Node is non-empty, this routine sets the appropriate value
164 -- in its Sloc field, from the current location in the debug source file
165 -- that is currently being written. Note that Debug_Node is always empty
166 -- if a debug source file is not being written.
168 procedure Sprint_And_List
(List
: List_Id
);
169 -- Print the given list with items separated by vertical "and"
171 procedure Sprint_Bar_List
(List
: List_Id
);
172 -- Print the given list with items separated by vertical bars
174 procedure Sprint_Node_Actual
(Node
: Node_Id
);
175 -- This routine prints its node argument. It is a lower level routine than
176 -- Sprint_Node, in that it does not bother about rewritten trees.
178 procedure Sprint_Node_Sloc
(Node
: Node_Id
);
179 -- Like Sprint_Node, but in addition, in Debug_Generated_Code mode,
180 -- sets the Sloc of the current debug node to be a copy of the Sloc
181 -- of the sprinted node Node. Note that this is done after printing
182 -- Node, so that the Sloc is the proper updated value for the debug file.
184 procedure Write_Char_Sloc
(C
: Character);
185 -- Like Write_Char, except that if C is non-blank, Set_Debug_Sloc is
186 -- called to ensure that the current node has a proper Sloc set.
188 procedure Write_Condition_And_Reason
(Node
: Node_Id
);
189 -- Write Condition and Reason codes of Raise_xxx_Error node
191 procedure Write_Discr_Specs
(N
: Node_Id
);
192 -- Ouput discriminant specification for node, which is any of the type
193 -- declarations that can have discriminants.
195 procedure Write_Ekind
(E
: Entity_Id
);
196 -- Write the String corresponding to the Ekind without "E_"
198 procedure Write_Id
(N
: Node_Id
);
199 -- N is a node with a Chars field. This procedure writes the name that
200 -- will be used in the generated code associated with the name. For a
201 -- node with no associated entity, this is simply the Chars field. For
202 -- the case where there is an entity associated with the node, we print
203 -- the name associated with the entity (since it may have been encoded).
204 -- One other special case is that an entity has an active external name
205 -- (i.e. an external name present with no address clause), then this
206 -- external name is output. This procedure also deals with outputting
207 -- declarations of referenced itypes, if not output earlier.
209 function Write_Identifiers
(Node
: Node_Id
) return Boolean;
210 -- Handle node where the grammar has a list of defining identifiers, but
211 -- the tree has a separate declaration for each identifier. Handles the
212 -- printing of the defining identifier, and returns True if the type and
213 -- initialization information is to be printed, False if it is to be
214 -- skipped (the latter case happens when printing defining identifiers
215 -- other than the first in the original tree output case).
217 procedure Write_Implicit_Def
(E
: Entity_Id
);
218 pragma Warnings
(Off
, Write_Implicit_Def
);
219 -- Write the definition of the implicit type E according to its Ekind
220 -- For now a debugging procedure, but might be used in the future.
222 procedure Write_Indent
;
223 -- Start a new line and write indentation spacing
225 function Write_Indent_Identifiers
(Node
: Node_Id
) return Boolean;
226 -- Like Write_Identifiers except that each new printed declaration
227 -- is at the start of a new line.
229 function Write_Indent_Identifiers_Sloc
(Node
: Node_Id
) return Boolean;
230 -- Like Write_Indent_Identifiers except that in Debug_Generated_Code
231 -- mode, the Sloc of the current debug node is set to point ot the
232 -- first output identifier.
234 procedure Write_Indent_Str
(S
: String);
235 -- Start a new line and write indent spacing followed by given string
237 procedure Write_Indent_Str_Sloc
(S
: String);
238 -- Like Write_Indent_Str, but in addition, in Debug_Generated_Code mode,
239 -- the Sloc of the current node is set to the first non-blank character
242 procedure Write_Itype
(Typ
: Entity_Id
);
243 -- If Typ is an Itype that has not been written yet, write it. If Typ is
244 -- any other kind of entity or tree node, the call is ignored.
246 procedure Write_Name_With_Col_Check
(N
: Name_Id
);
247 -- Write name (using Write_Name) with initial column check, and possible
248 -- initial Write_Indent (to get new line) if current line is too full.
250 procedure Write_Name_With_Col_Check_Sloc
(N
: Name_Id
);
251 -- Like Write_Name_With_Col_Check but in addition, in Debug_Generated_Code
252 -- mode, sets Sloc of current debug node to first character of name.
254 procedure Write_Operator
(N
: Node_Id
; S
: String);
255 -- Like Write_Str_Sloc, used for operators, encloses the string in
256 -- characters {} if the Do_Overflow flag is set on the node N.
258 procedure Write_Param_Specs
(N
: Node_Id
);
259 -- Output parameter specifications for node (which is either a function
260 -- or procedure specification with a Parameter_Specifications field)
262 procedure Write_Rewrite_Str
(S
: String);
263 -- Writes out a string (typically containing <<< or >>>}) for a node
264 -- created by rewriting the tree. Suppressed if we are outputting the
265 -- generated code only, since in this case we don't specially mark nodes
266 -- created by rewriting).
268 procedure Write_Str_Sloc
(S
: String);
269 -- Like Write_Str, but sets debug Sloc of current debug node to first
270 -- non-blank character if a current debug node is active.
272 procedure Write_Str_With_Col_Check
(S
: String);
273 -- Write string (using Write_Str) with initial column check, and possible
274 -- initial Write_Indent (to get new line) if current line is too full.
276 procedure Write_Str_With_Col_Check_Sloc
(S
: String);
277 -- Like Write_Str_WIth_Col_Check, but sets debug Sloc of current debug
278 -- node to first non-blank character if a current debug node is active.
280 procedure Write_Uint_With_Col_Check
(U
: Uint
; Format
: UI_Format
);
281 -- Write Uint (using UI_Write) with initial column check, and possible
282 -- initial Write_Indent (to get new line) if current line is too full.
283 -- The format parameter determines the output format (see UI_Write).
285 procedure Write_Uint_With_Col_Check_Sloc
(U
: Uint
; Format
: UI_Format
);
286 -- Write Uint (using UI_Write) with initial column check, and possible
287 -- initial Write_Indent (to get new line) if current line is too full.
288 -- The format parameter determines the output format (see UI_Write).
289 -- In addition, in Debug_Generated_Code mode, sets the current node
290 -- Sloc to the first character of the output value.
292 procedure Write_Ureal_With_Col_Check_Sloc
(U
: Ureal
);
293 -- Write Ureal (using same output format as UR_Write) with column checks
294 -- and a possible initial Write_Indent (to get new line) if current line
295 -- is too full. In addition, in Debug_Generated_Code mode, sets the
296 -- current node Sloc to the first character of the output value.
302 procedure Col_Check
(N
: Nat
) is
304 if N
+ Column
> Line_Limit
then
305 Write_Indent_Str
(" ");
313 procedure Indent_Annull
is
315 Indent_Annull_Flag
:= True;
322 procedure Indent_Begin
is
324 Indent
:= Indent
+ 3;
331 procedure Indent_End
is
333 Indent
:= Indent
- 3;
340 procedure pg
(Node
: Node_Id
) is
342 Dump_Generated_Only
:= True;
343 Dump_Original_Only
:= False;
352 procedure po
(Node
: Node_Id
) is
354 Dump_Generated_Only
:= False;
355 Dump_Original_Only
:= True;
360 ----------------------
361 -- Print_Debug_Line --
362 ----------------------
364 procedure Print_Debug_Line
(S
: String) is
366 Write_Debug_Line
(S
, Debug_Sloc
);
367 end Print_Debug_Line
;
369 ---------------------------
370 -- Process_TFAI_RR_Flags --
371 ---------------------------
373 procedure Process_TFAI_RR_Flags
(Nod
: Node_Id
) is
375 if Treat_Fixed_As_Integer
(Nod
) then
379 if Rounded_Result
(Nod
) then
382 end Process_TFAI_RR_Flags
;
388 procedure ps
(Node
: Node_Id
) is
390 Dump_Generated_Only
:= False;
391 Dump_Original_Only
:= False;
400 procedure Set_Debug_Sloc
is
402 if Present
(Debug_Node
) then
403 Set_Sloc
(Debug_Node
, Debug_Sloc
+ Source_Ptr
(Column
- 1));
412 procedure Source_Dump
is
415 -- Put underline under string we just printed
417 procedure Underline
is
418 Col
: constant Int
:= Column
;
423 while Col
> Column
loop
430 -- Start of processing for Tree_Dump
433 Dump_Generated_Only
:= Debug_Flag_G
or
434 Print_Generated_Code
or
435 Debug_Generated_Code
;
436 Dump_Original_Only
:= Debug_Flag_O
;
437 Dump_Freeze_Null
:= Debug_Flag_S
or Debug_Flag_G
;
439 -- Note that we turn off the tree dump flags immediately, before
440 -- starting the dump. This avoids generating two copies of the dump
441 -- if an abort occurs after printing the dump, and more importantly,
442 -- avoids an infinite loop if an abort occurs during the dump.
445 Debug_Flag_Z
:= False;
448 Write_Str
("Source recreated from tree of Standard (spec)");
450 Sprint_Node
(Standard_Package_Node
);
455 if Debug_Flag_S
or Dump_Generated_Only
or Dump_Original_Only
then
456 Debug_Flag_G
:= False;
457 Debug_Flag_O
:= False;
458 Debug_Flag_S
:= False;
460 -- Dump requested units
462 for U
in Main_Unit
.. Last_Unit
loop
464 -- Dump all units if -gnatdf set, otherwise we dump only
465 -- the source files that are in the extended main source.
468 or else In_Extended_Main_Source_Unit
(Cunit_Entity
(U
))
470 -- If we are generating debug files, setup to write them
472 if Debug_Generated_Code
then
473 Set_Special_Output
(Print_Debug_Line
'Access);
474 Create_Debug_Source
(Source_Index
(U
), Debug_Sloc
);
475 Sprint_Node
(Cunit
(U
));
478 Set_Special_Output
(null);
480 -- Normal output to standard output file
483 Write_Str
("Source recreated from tree for ");
484 Write_Unit_Name
(Unit_Name
(U
));
486 Sprint_Node
(Cunit
(U
));
495 ---------------------
496 -- Sprint_And_List --
497 ---------------------
499 procedure Sprint_And_List
(List
: List_Id
) is
502 if Is_Non_Empty_List
(List
) then
503 Node
:= First
(List
);
507 exit when Node
= Empty
;
513 ---------------------
514 -- Sprint_Bar_List --
515 ---------------------
517 procedure Sprint_Bar_List
(List
: List_Id
) is
520 if Is_Non_Empty_List
(List
) then
521 Node
:= First
(List
);
525 exit when Node
= Empty
;
531 -----------------------
532 -- Sprint_Comma_List --
533 -----------------------
535 procedure Sprint_Comma_List
(List
: List_Id
) is
539 if Is_Non_Empty_List
(List
) then
540 Node
:= First
(List
);
544 exit when Node
= Empty
;
546 if not Is_Rewrite_Insertion
(Node
)
547 or else not Dump_Original_Only
553 end Sprint_Comma_List
;
555 --------------------------
556 -- Sprint_Indented_List --
557 --------------------------
559 procedure Sprint_Indented_List
(List
: List_Id
) is
562 Sprint_Node_List
(List
);
564 end Sprint_Indented_List
;
566 ---------------------
567 -- Sprint_Left_Opnd --
568 ---------------------
570 procedure Sprint_Left_Opnd
(N
: Node_Id
) is
571 Opnd
: constant Node_Id
:= Left_Opnd
(N
);
574 if Paren_Count
(Opnd
) /= 0
575 or else Op_Prec
(Nkind
(Opnd
)) >= Op_Prec
(Nkind
(N
))
584 end Sprint_Left_Opnd
;
590 procedure Sprint_Node
(Node
: Node_Id
) is
592 if Is_Rewrite_Insertion
(Node
) then
593 if not Dump_Original_Only
then
595 -- For special cases of nodes that always output <<< >>>
596 -- do not duplicate the output at this point.
598 if Nkind
(Node
) = N_Freeze_Entity
599 or else Nkind
(Node
) = N_Implicit_Label_Declaration
601 Sprint_Node_Actual
(Node
);
603 -- Normal case where <<< >>> may be required
606 Write_Rewrite_Str
("<<<");
607 Sprint_Node_Actual
(Node
);
608 Write_Rewrite_Str
(">>>");
612 elsif Is_Rewrite_Substitution
(Node
) then
614 -- Case of dump generated only
616 if Dump_Generated_Only
then
617 Sprint_Node_Actual
(Node
);
619 -- Case of dump original only
621 elsif Dump_Original_Only
then
622 Sprint_Node_Actual
(Original_Node
(Node
));
624 -- Case of both being dumped
627 Sprint_Node_Actual
(Original_Node
(Node
));
628 Write_Rewrite_Str
("<<<");
629 Sprint_Node_Actual
(Node
);
630 Write_Rewrite_Str
(">>>");
634 Sprint_Node_Actual
(Node
);
638 ------------------------
639 -- Sprint_Node_Actual --
640 ------------------------
642 procedure Sprint_Node_Actual
(Node
: Node_Id
) is
643 Save_Debug_Node
: constant Node_Id
:= Debug_Node
;
650 for J
in 1 .. Paren_Count
(Node
) loop
651 Write_Str_With_Col_Check
("(");
654 -- Setup node for Sloc fixup if writing a debug source file. Note
655 -- that we take care of any previous node not yet properly set.
657 if Debug_Generated_Code
then
661 if Nkind
(Node
) in N_Subexpr
662 and then Do_Range_Check
(Node
)
664 Write_Str_With_Col_Check
("{");
667 -- Select print circuit based on node kind
671 when N_Abort_Statement
=>
672 Write_Indent_Str_Sloc
("abort ");
673 Sprint_Comma_List
(Names
(Node
));
676 when N_Abortable_Part
=>
678 Write_Str_Sloc
("abort ");
679 Sprint_Indented_List
(Statements
(Node
));
681 when N_Abstract_Subprogram_Declaration
=>
683 Sprint_Node
(Specification
(Node
));
684 Write_Str_With_Col_Check
(" is ");
685 Write_Str_Sloc
("abstract;");
687 when N_Accept_Alternative
=>
688 Sprint_Node_List
(Pragmas_Before
(Node
));
690 if Present
(Condition
(Node
)) then
691 Write_Indent_Str
("when ");
692 Sprint_Node
(Condition
(Node
));
697 Sprint_Node_Sloc
(Accept_Statement
(Node
));
698 Sprint_Node_List
(Statements
(Node
));
700 when N_Accept_Statement
=>
701 Write_Indent_Str_Sloc
("accept ");
702 Write_Id
(Entry_Direct_Name
(Node
));
704 if Present
(Entry_Index
(Node
)) then
705 Write_Str_With_Col_Check
(" (");
706 Sprint_Node
(Entry_Index
(Node
));
710 Write_Param_Specs
(Node
);
712 if Present
(Handled_Statement_Sequence
(Node
)) then
713 Write_Str_With_Col_Check
(" do");
714 Sprint_Node
(Handled_Statement_Sequence
(Node
));
715 Write_Indent_Str
("end ");
716 Write_Id
(Entry_Direct_Name
(Node
));
721 when N_Access_Definition
=>
725 if Present
(Access_To_Subprogram_Definition
(Node
)) then
726 Sprint_Node
(Access_To_Subprogram_Definition
(Node
));
730 if Null_Exclusion_Present
(Node
) then
731 Write_Str
("not null ");
734 Write_Str_With_Col_Check_Sloc
("access ");
736 if All_Present
(Node
) then
738 elsif Constant_Present
(Node
) then
739 Write_Str
("constant ");
742 Sprint_Node
(Subtype_Mark
(Node
));
745 when N_Access_Function_Definition
=>
749 if Null_Exclusion_Present
(Node
) then
750 Write_Str
("not null ");
753 Write_Str_With_Col_Check_Sloc
("access ");
755 if Protected_Present
(Node
) then
756 Write_Str_With_Col_Check
("protected ");
759 Write_Str_With_Col_Check
("function");
760 Write_Param_Specs
(Node
);
761 Write_Str_With_Col_Check
(" return ");
762 Sprint_Node
(Result_Definition
(Node
));
764 when N_Access_Procedure_Definition
=>
768 if Null_Exclusion_Present
(Node
) then
769 Write_Str
("not null ");
772 Write_Str_With_Col_Check_Sloc
("access ");
774 if Protected_Present
(Node
) then
775 Write_Str_With_Col_Check
("protected ");
778 Write_Str_With_Col_Check
("procedure");
779 Write_Param_Specs
(Node
);
781 when N_Access_To_Object_Definition
=>
782 Write_Str_With_Col_Check_Sloc
("access ");
784 if All_Present
(Node
) then
785 Write_Str_With_Col_Check
("all ");
786 elsif Constant_Present
(Node
) then
787 Write_Str_With_Col_Check
("constant ");
792 if Null_Exclusion_Present
(Node
) then
793 Write_Str
("not null ");
796 Sprint_Node
(Subtype_Indication
(Node
));
799 if Null_Record_Present
(Node
) then
800 Write_Str_With_Col_Check_Sloc
("(null record)");
803 Write_Str_With_Col_Check_Sloc
("(");
805 if Present
(Expressions
(Node
)) then
806 Sprint_Comma_List
(Expressions
(Node
));
808 if Present
(Component_Associations
(Node
)) then
813 if Present
(Component_Associations
(Node
)) then
820 Nd
:= First
(Component_Associations
(Node
));
828 if not Is_Rewrite_Insertion
(Nd
)
829 or else not Dump_Original_Only
843 Write_Str_With_Col_Check_Sloc
("new ");
847 if Null_Exclusion_Present
(Node
) then
848 Write_Str
("not null ");
851 Sprint_Node
(Expression
(Node
));
853 if Present
(Storage_Pool
(Node
)) then
854 Write_Str_With_Col_Check
("[storage_pool = ");
855 Sprint_Node
(Storage_Pool
(Node
));
860 Sprint_Left_Opnd
(Node
);
861 Write_Str_Sloc
(" and then ");
862 Sprint_Right_Opnd
(Node
);
865 Write_Indent_Str_Sloc
("for ");
866 Write_Id
(Identifier
(Node
));
867 Write_Str_With_Col_Check
(" use at ");
868 Sprint_Node
(Expression
(Node
));
871 when N_Assignment_Statement
=>
873 Sprint_Node
(Name
(Node
));
874 Write_Str_Sloc
(" := ");
875 Sprint_Node
(Expression
(Node
));
878 when N_Asynchronous_Select
=>
879 Write_Indent_Str_Sloc
("select");
881 Sprint_Node
(Triggering_Alternative
(Node
));
884 -- Note: let the printing of Abortable_Part handle outputting
885 -- the ABORT keyword, so that the Slco can be set correctly.
887 Write_Indent_Str
("then ");
888 Sprint_Node
(Abortable_Part
(Node
));
889 Write_Indent_Str
("end select;");
891 when N_Attribute_Definition_Clause
=>
892 Write_Indent_Str_Sloc
("for ");
893 Sprint_Node
(Name
(Node
));
895 Write_Name_With_Col_Check
(Chars
(Node
));
896 Write_Str_With_Col_Check
(" use ");
897 Sprint_Node
(Expression
(Node
));
900 when N_Attribute_Reference
=>
901 if Is_Procedure_Attribute_Name
(Attribute_Name
(Node
)) then
905 Sprint_Node
(Prefix
(Node
));
906 Write_Char_Sloc
(''');
907 Write_Name_With_Col_Check
(Attribute_Name
(Node
));
908 Sprint_Paren_Comma_List
(Expressions
(Node
));
910 if Is_Procedure_Attribute_Name
(Attribute_Name
(Node
)) then
914 when N_Block_Statement
=>
917 if Present
(Identifier
(Node
))
918 and then (not Has_Created_Identifier
(Node
)
919 or else not Dump_Original_Only
)
921 Write_Rewrite_Str
("<<<");
922 Write_Id
(Identifier
(Node
));
924 Write_Rewrite_Str
(">>>");
927 if Present
(Declarations
(Node
)) then
928 Write_Str_With_Col_Check_Sloc
("declare");
929 Sprint_Indented_List
(Declarations
(Node
));
933 Write_Str_With_Col_Check_Sloc
("begin");
934 Sprint_Node
(Handled_Statement_Sequence
(Node
));
935 Write_Indent_Str
("end");
937 if Present
(Identifier
(Node
))
938 and then (not Has_Created_Identifier
(Node
)
939 or else not Dump_Original_Only
)
941 Write_Rewrite_Str
("<<<");
943 Write_Id
(Identifier
(Node
));
944 Write_Rewrite_Str
(">>>");
949 when N_Case_Statement
=>
950 Write_Indent_Str_Sloc
("case ");
951 Sprint_Node
(Expression
(Node
));
953 Sprint_Indented_List
(Alternatives
(Node
));
954 Write_Indent_Str
("end case;");
956 when N_Case_Statement_Alternative
=>
957 Write_Indent_Str_Sloc
("when ");
958 Sprint_Bar_List
(Discrete_Choices
(Node
));
960 Sprint_Indented_List
(Statements
(Node
));
962 when N_Character_Literal
=>
964 Write_Indent_Str
(" ");
967 Write_Char_Sloc
(''');
968 Write_Char_Code
(UI_To_CC
(Char_Literal_Value
(Node
)));
971 when N_Code_Statement
=>
974 Sprint_Node
(Expression
(Node
));
977 when N_Compilation_Unit
=>
978 Sprint_Node_List
(Context_Items
(Node
));
979 Sprint_Opt_Node_List
(Declarations
(Aux_Decls_Node
(Node
)));
981 if Private_Present
(Node
) then
982 Write_Indent_Str
("private ");
986 Sprint_Node_Sloc
(Unit
(Node
));
988 if Present
(Actions
(Aux_Decls_Node
(Node
)))
990 Present
(Pragmas_After
(Aux_Decls_Node
(Node
)))
995 Sprint_Opt_Node_List
(Actions
(Aux_Decls_Node
(Node
)));
996 Sprint_Opt_Node_List
(Pragmas_After
(Aux_Decls_Node
(Node
)));
998 when N_Compilation_Unit_Aux
=>
999 null; -- nothing to do, never used, see above
1001 when N_Component_Association
=>
1003 Sprint_Bar_List
(Choices
(Node
));
1006 -- Ada 2005 (AI-287): Print the mbox if present
1008 if Box_Present
(Node
) then
1009 Write_Str_With_Col_Check
("<>");
1011 Sprint_Node
(Expression
(Node
));
1014 when N_Component_Clause
=>
1016 Sprint_Node
(Component_Name
(Node
));
1017 Write_Str_Sloc
(" at ");
1018 Sprint_Node
(Position
(Node
));
1020 Write_Str_With_Col_Check
("range ");
1021 Sprint_Node
(First_Bit
(Node
));
1023 Sprint_Node
(Last_Bit
(Node
));
1026 when N_Component_Definition
=>
1029 -- Ada 2005 (AI-230): Access definition components
1031 if Present
(Access_Definition
(Node
)) then
1032 Sprint_Node
(Access_Definition
(Node
));
1034 elsif Present
(Subtype_Indication
(Node
)) then
1035 if Aliased_Present
(Node
) then
1036 Write_Str_With_Col_Check
("aliased ");
1039 -- Ada 2005 (AI-231)
1041 if Null_Exclusion_Present
(Node
) then
1042 Write_Str
(" not null ");
1045 Sprint_Node
(Subtype_Indication
(Node
));
1048 Write_Str
(" ??? ");
1051 when N_Component_Declaration
=>
1052 if Write_Indent_Identifiers_Sloc
(Node
) then
1054 Sprint_Node
(Component_Definition
(Node
));
1056 if Present
(Expression
(Node
)) then
1058 Sprint_Node
(Expression
(Node
));
1064 when N_Component_List
=>
1065 if Null_Present
(Node
) then
1067 Write_Indent_Str_Sloc
("null");
1073 Sprint_Indented_List
(Component_Items
(Node
));
1074 Sprint_Node
(Variant_Part
(Node
));
1077 when N_Conditional_Entry_Call
=>
1078 Write_Indent_Str_Sloc
("select");
1080 Sprint_Node
(Entry_Call_Alternative
(Node
));
1082 Write_Indent_Str
("else");
1083 Sprint_Indented_List
(Else_Statements
(Node
));
1084 Write_Indent_Str
("end select;");
1086 when N_Conditional_Expression
=>
1088 Condition
: constant Node_Id
:= First
(Expressions
(Node
));
1089 Then_Expr
: constant Node_Id
:= Next
(Condition
);
1090 Else_Expr
: constant Node_Id
:= Next
(Then_Expr
);
1092 Write_Str_With_Col_Check_Sloc
("(if ");
1093 Sprint_Node
(Condition
);
1094 Write_Str_With_Col_Check
(" then ");
1095 Sprint_Node
(Then_Expr
);
1096 Write_Str_With_Col_Check
(" else ");
1097 Sprint_Node
(Else_Expr
);
1101 when N_Constrained_Array_Definition
=>
1102 Write_Str_With_Col_Check_Sloc
("array ");
1103 Sprint_Paren_Comma_List
(Discrete_Subtype_Definitions
(Node
));
1106 Sprint_Node
(Component_Definition
(Node
));
1108 when N_Decimal_Fixed_Point_Definition
=>
1109 Write_Str_With_Col_Check_Sloc
(" delta ");
1110 Sprint_Node
(Delta_Expression
(Node
));
1111 Write_Str_With_Col_Check
("digits ");
1112 Sprint_Node
(Digits_Expression
(Node
));
1113 Sprint_Opt_Node
(Real_Range_Specification
(Node
));
1115 when N_Defining_Character_Literal
=>
1116 Write_Name_With_Col_Check_Sloc
(Chars
(Node
));
1118 when N_Defining_Identifier
=>
1122 when N_Defining_Operator_Symbol
=>
1123 Write_Name_With_Col_Check_Sloc
(Chars
(Node
));
1125 when N_Defining_Program_Unit_Name
=>
1127 Sprint_Node
(Name
(Node
));
1129 Write_Id
(Defining_Identifier
(Node
));
1131 when N_Delay_Alternative
=>
1132 Sprint_Node_List
(Pragmas_Before
(Node
));
1134 if Present
(Condition
(Node
)) then
1136 Write_Str_With_Col_Check
("when ");
1137 Sprint_Node
(Condition
(Node
));
1142 Sprint_Node_Sloc
(Delay_Statement
(Node
));
1143 Sprint_Node_List
(Statements
(Node
));
1145 when N_Delay_Relative_Statement
=>
1146 Write_Indent_Str_Sloc
("delay ");
1147 Sprint_Node
(Expression
(Node
));
1150 when N_Delay_Until_Statement
=>
1151 Write_Indent_Str_Sloc
("delay until ");
1152 Sprint_Node
(Expression
(Node
));
1155 when N_Delta_Constraint
=>
1156 Write_Str_With_Col_Check_Sloc
("delta ");
1157 Sprint_Node
(Delta_Expression
(Node
));
1158 Sprint_Opt_Node
(Range_Constraint
(Node
));
1160 when N_Derived_Type_Definition
=>
1161 if Abstract_Present
(Node
) then
1162 Write_Str_With_Col_Check
("abstract ");
1165 Write_Str_With_Col_Check_Sloc
("new ");
1167 -- Ada 2005 (AI-231)
1169 if Null_Exclusion_Present
(Node
) then
1170 Write_Str_With_Col_Check
("not null ");
1173 Sprint_Node
(Subtype_Indication
(Node
));
1175 if Present
(Interface_List
(Node
)) then
1176 Sprint_And_List
(Interface_List
(Node
));
1177 Write_Str_With_Col_Check
(" with ");
1180 if Present
(Record_Extension_Part
(Node
)) then
1181 if No
(Interface_List
(Node
)) then
1182 Write_Str_With_Col_Check
(" with ");
1185 Sprint_Node
(Record_Extension_Part
(Node
));
1188 when N_Designator
=>
1189 Sprint_Node
(Name
(Node
));
1190 Write_Char_Sloc
('.');
1191 Write_Id
(Identifier
(Node
));
1193 when N_Digits_Constraint
=>
1194 Write_Str_With_Col_Check_Sloc
("digits ");
1195 Sprint_Node
(Digits_Expression
(Node
));
1196 Sprint_Opt_Node
(Range_Constraint
(Node
));
1198 when N_Discriminant_Association
=>
1201 if Present
(Selector_Names
(Node
)) then
1202 Sprint_Bar_List
(Selector_Names
(Node
));
1207 Sprint_Node
(Expression
(Node
));
1209 when N_Discriminant_Specification
=>
1212 if Write_Identifiers
(Node
) then
1215 if Null_Exclusion_Present
(Node
) then
1216 Write_Str
("not null ");
1219 Sprint_Node
(Discriminant_Type
(Node
));
1221 if Present
(Expression
(Node
)) then
1223 Sprint_Node
(Expression
(Node
));
1229 when N_Elsif_Part
=>
1230 Write_Indent_Str_Sloc
("elsif ");
1231 Sprint_Node
(Condition
(Node
));
1232 Write_Str_With_Col_Check
(" then");
1233 Sprint_Indented_List
(Then_Statements
(Node
));
1238 when N_Entry_Body
=>
1239 Write_Indent_Str_Sloc
("entry ");
1240 Write_Id
(Defining_Identifier
(Node
));
1241 Sprint_Node
(Entry_Body_Formal_Part
(Node
));
1242 Write_Str_With_Col_Check
(" is");
1243 Sprint_Indented_List
(Declarations
(Node
));
1244 Write_Indent_Str
("begin");
1245 Sprint_Node
(Handled_Statement_Sequence
(Node
));
1246 Write_Indent_Str
("end ");
1247 Write_Id
(Defining_Identifier
(Node
));
1250 when N_Entry_Body_Formal_Part
=>
1251 if Present
(Entry_Index_Specification
(Node
)) then
1252 Write_Str_With_Col_Check_Sloc
(" (");
1253 Sprint_Node
(Entry_Index_Specification
(Node
));
1257 Write_Param_Specs
(Node
);
1258 Write_Str_With_Col_Check_Sloc
(" when ");
1259 Sprint_Node
(Condition
(Node
));
1261 when N_Entry_Call_Alternative
=>
1262 Sprint_Node_List
(Pragmas_Before
(Node
));
1263 Sprint_Node_Sloc
(Entry_Call_Statement
(Node
));
1264 Sprint_Node_List
(Statements
(Node
));
1266 when N_Entry_Call_Statement
=>
1268 Sprint_Node_Sloc
(Name
(Node
));
1269 Sprint_Opt_Paren_Comma_List
(Parameter_Associations
(Node
));
1272 when N_Entry_Declaration
=>
1273 Write_Indent_Str_Sloc
("entry ");
1274 Write_Id
(Defining_Identifier
(Node
));
1276 if Present
(Discrete_Subtype_Definition
(Node
)) then
1277 Write_Str_With_Col_Check
(" (");
1278 Sprint_Node
(Discrete_Subtype_Definition
(Node
));
1282 Write_Param_Specs
(Node
);
1285 when N_Entry_Index_Specification
=>
1286 Write_Str_With_Col_Check_Sloc
("for ");
1287 Write_Id
(Defining_Identifier
(Node
));
1288 Write_Str_With_Col_Check
(" in ");
1289 Sprint_Node
(Discrete_Subtype_Definition
(Node
));
1291 when N_Enumeration_Representation_Clause
=>
1292 Write_Indent_Str_Sloc
("for ");
1293 Write_Id
(Identifier
(Node
));
1294 Write_Str_With_Col_Check
(" use ");
1295 Sprint_Node
(Array_Aggregate
(Node
));
1298 when N_Enumeration_Type_Definition
=>
1301 -- Skip attempt to print Literals field if it's not there and
1302 -- we are in package Standard (case of Character, which is
1303 -- handled specially (without an explicit literals list).
1305 if Sloc
(Node
) > Standard_Location
1306 or else Present
(Literals
(Node
))
1308 Sprint_Paren_Comma_List
(Literals
(Node
));
1312 Write_Str_With_Col_Check_Sloc
("<error>");
1314 when N_Exception_Declaration
=>
1315 if Write_Indent_Identifiers
(Node
) then
1316 Write_Str_With_Col_Check
(" : ");
1317 Write_Str_Sloc
("exception;");
1320 when N_Exception_Handler
=>
1321 Write_Indent_Str_Sloc
("when ");
1323 if Present
(Choice_Parameter
(Node
)) then
1324 Sprint_Node
(Choice_Parameter
(Node
));
1328 Sprint_Bar_List
(Exception_Choices
(Node
));
1330 Sprint_Indented_List
(Statements
(Node
));
1332 when N_Exception_Renaming_Declaration
=>
1335 Sprint_Node
(Defining_Identifier
(Node
));
1336 Write_Str_With_Col_Check
(" : exception renames ");
1337 Sprint_Node
(Name
(Node
));
1340 when N_Exit_Statement
=>
1341 Write_Indent_Str_Sloc
("exit");
1342 Sprint_Opt_Node
(Name
(Node
));
1344 if Present
(Condition
(Node
)) then
1345 Write_Str_With_Col_Check
(" when ");
1346 Sprint_Node
(Condition
(Node
));
1351 when N_Expanded_Name
=>
1352 Sprint_Node
(Prefix
(Node
));
1353 Write_Char_Sloc
('.');
1354 Sprint_Node
(Selector_Name
(Node
));
1356 when N_Explicit_Dereference
=>
1357 Sprint_Node
(Prefix
(Node
));
1358 Write_Char_Sloc
('.');
1359 Write_Str_Sloc
("all");
1361 when N_Extension_Aggregate
=>
1362 Write_Str_With_Col_Check_Sloc
("(");
1363 Sprint_Node
(Ancestor_Part
(Node
));
1364 Write_Str_With_Col_Check
(" with ");
1366 if Null_Record_Present
(Node
) then
1367 Write_Str_With_Col_Check
("null record");
1369 if Present
(Expressions
(Node
)) then
1370 Sprint_Comma_List
(Expressions
(Node
));
1372 if Present
(Component_Associations
(Node
)) then
1377 if Present
(Component_Associations
(Node
)) then
1378 Sprint_Comma_List
(Component_Associations
(Node
));
1384 when N_Floating_Point_Definition
=>
1385 Write_Str_With_Col_Check_Sloc
("digits ");
1386 Sprint_Node
(Digits_Expression
(Node
));
1387 Sprint_Opt_Node
(Real_Range_Specification
(Node
));
1389 when N_Formal_Decimal_Fixed_Point_Definition
=>
1390 Write_Str_With_Col_Check_Sloc
("delta <> digits <>");
1392 when N_Formal_Derived_Type_Definition
=>
1393 Write_Str_With_Col_Check_Sloc
("new ");
1394 Sprint_Node
(Subtype_Mark
(Node
));
1396 if Private_Present
(Node
) then
1397 Write_Str_With_Col_Check
(" with private");
1400 when N_Formal_Abstract_Subprogram_Declaration
=>
1401 Write_Indent_Str_Sloc
("with ");
1402 Sprint_Node
(Specification
(Node
));
1404 Write_Str_With_Col_Check
(" is abstract");
1406 if Box_Present
(Node
) then
1407 Write_Str_With_Col_Check
(" <>");
1408 elsif Present
(Default_Name
(Node
)) then
1409 Write_Str_With_Col_Check
(" ");
1410 Sprint_Node
(Default_Name
(Node
));
1415 when N_Formal_Concrete_Subprogram_Declaration
=>
1416 Write_Indent_Str_Sloc
("with ");
1417 Sprint_Node
(Specification
(Node
));
1419 if Box_Present
(Node
) then
1420 Write_Str_With_Col_Check
(" is <>");
1421 elsif Present
(Default_Name
(Node
)) then
1422 Write_Str_With_Col_Check
(" is ");
1423 Sprint_Node
(Default_Name
(Node
));
1428 when N_Formal_Discrete_Type_Definition
=>
1429 Write_Str_With_Col_Check_Sloc
("<>");
1431 when N_Formal_Floating_Point_Definition
=>
1432 Write_Str_With_Col_Check_Sloc
("digits <>");
1434 when N_Formal_Modular_Type_Definition
=>
1435 Write_Str_With_Col_Check_Sloc
("mod <>");
1437 when N_Formal_Object_Declaration
=>
1440 if Write_Indent_Identifiers
(Node
) then
1443 if In_Present
(Node
) then
1444 Write_Str_With_Col_Check
("in ");
1447 if Out_Present
(Node
) then
1448 Write_Str_With_Col_Check
("out ");
1451 Sprint_Node
(Subtype_Mark
(Node
));
1453 if Present
(Expression
(Node
)) then
1455 Sprint_Node
(Expression
(Node
));
1461 when N_Formal_Ordinary_Fixed_Point_Definition
=>
1462 Write_Str_With_Col_Check_Sloc
("delta <>");
1464 when N_Formal_Package_Declaration
=>
1465 Write_Indent_Str_Sloc
("with package ");
1466 Write_Id
(Defining_Identifier
(Node
));
1467 Write_Str_With_Col_Check
(" is new ");
1468 Sprint_Node
(Name
(Node
));
1469 Write_Str_With_Col_Check
(" (<>);");
1471 when N_Formal_Private_Type_Definition
=>
1472 if Abstract_Present
(Node
) then
1473 Write_Str_With_Col_Check
("abstract ");
1476 if Tagged_Present
(Node
) then
1477 Write_Str_With_Col_Check
("tagged ");
1480 if Limited_Present
(Node
) then
1481 Write_Str_With_Col_Check
("limited ");
1484 Write_Str_With_Col_Check_Sloc
("private");
1486 when N_Formal_Signed_Integer_Type_Definition
=>
1487 Write_Str_With_Col_Check_Sloc
("range <>");
1489 when N_Formal_Type_Declaration
=>
1490 Write_Indent_Str_Sloc
("type ");
1491 Write_Id
(Defining_Identifier
(Node
));
1493 if Present
(Discriminant_Specifications
(Node
)) then
1494 Write_Discr_Specs
(Node
);
1495 elsif Unknown_Discriminants_Present
(Node
) then
1496 Write_Str_With_Col_Check
("(<>)");
1499 Write_Str_With_Col_Check
(" is ");
1500 Sprint_Node
(Formal_Type_Definition
(Node
));
1503 when N_Free_Statement
=>
1504 Write_Indent_Str_Sloc
("free ");
1505 Sprint_Node
(Expression
(Node
));
1508 when N_Freeze_Entity
=>
1509 if Dump_Original_Only
then
1512 elsif Present
(Actions
(Node
)) or else Dump_Freeze_Null
then
1514 Write_Rewrite_Str
("<<<");
1515 Write_Str_With_Col_Check_Sloc
("freeze ");
1516 Write_Id
(Entity
(Node
));
1519 if No
(Actions
(Node
)) then
1523 Freeze_Indent
:= Freeze_Indent
+ 1;
1524 Sprint_Indented_List
(Actions
(Node
));
1525 Freeze_Indent
:= Freeze_Indent
- 1;
1526 Write_Indent_Str
("]");
1529 Write_Rewrite_Str
(">>>");
1532 when N_Full_Type_Declaration
=>
1533 Write_Indent_Str_Sloc
("type ");
1534 Write_Id
(Defining_Identifier
(Node
));
1535 Write_Discr_Specs
(Node
);
1536 Write_Str_With_Col_Check
(" is ");
1537 Sprint_Node
(Type_Definition
(Node
));
1540 when N_Function_Call
=>
1542 Sprint_Node
(Name
(Node
));
1543 Sprint_Opt_Paren_Comma_List
(Parameter_Associations
(Node
));
1545 when N_Function_Instantiation
=>
1546 Write_Indent_Str_Sloc
("function ");
1547 Sprint_Node
(Defining_Unit_Name
(Node
));
1548 Write_Str_With_Col_Check
(" is new ");
1549 Sprint_Node
(Name
(Node
));
1550 Sprint_Opt_Paren_Comma_List
(Generic_Associations
(Node
));
1553 when N_Function_Specification
=>
1554 Write_Str_With_Col_Check_Sloc
("function ");
1555 Sprint_Node
(Defining_Unit_Name
(Node
));
1556 Write_Param_Specs
(Node
);
1557 Write_Str_With_Col_Check
(" return ");
1559 -- Ada 2005 (AI-231)
1561 if Nkind
(Result_Definition
(Node
)) /= N_Access_Definition
1562 and then Null_Exclusion_Present
(Node
)
1564 Write_Str
(" not null ");
1567 Sprint_Node
(Result_Definition
(Node
));
1569 when N_Generic_Association
=>
1572 if Present
(Selector_Name
(Node
)) then
1573 Sprint_Node
(Selector_Name
(Node
));
1577 Sprint_Node
(Explicit_Generic_Actual_Parameter
(Node
));
1579 when N_Generic_Function_Renaming_Declaration
=>
1580 Write_Indent_Str_Sloc
("generic function ");
1581 Sprint_Node
(Defining_Unit_Name
(Node
));
1582 Write_Str_With_Col_Check
(" renames ");
1583 Sprint_Node
(Name
(Node
));
1586 when N_Generic_Package_Declaration
=>
1588 Write_Indent_Str_Sloc
("generic ");
1589 Sprint_Indented_List
(Generic_Formal_Declarations
(Node
));
1591 Sprint_Node
(Specification
(Node
));
1594 when N_Generic_Package_Renaming_Declaration
=>
1595 Write_Indent_Str_Sloc
("generic package ");
1596 Sprint_Node
(Defining_Unit_Name
(Node
));
1597 Write_Str_With_Col_Check
(" renames ");
1598 Sprint_Node
(Name
(Node
));
1601 when N_Generic_Procedure_Renaming_Declaration
=>
1602 Write_Indent_Str_Sloc
("generic procedure ");
1603 Sprint_Node
(Defining_Unit_Name
(Node
));
1604 Write_Str_With_Col_Check
(" renames ");
1605 Sprint_Node
(Name
(Node
));
1608 when N_Generic_Subprogram_Declaration
=>
1610 Write_Indent_Str_Sloc
("generic ");
1611 Sprint_Indented_List
(Generic_Formal_Declarations
(Node
));
1613 Sprint_Node
(Specification
(Node
));
1616 when N_Goto_Statement
=>
1617 Write_Indent_Str_Sloc
("goto ");
1618 Sprint_Node
(Name
(Node
));
1621 if Nkind
(Next
(Node
)) = N_Label
then
1625 when N_Handled_Sequence_Of_Statements
=>
1627 Sprint_Indented_List
(Statements
(Node
));
1629 if Present
(Exception_Handlers
(Node
)) then
1630 Write_Indent_Str
("exception");
1632 Sprint_Node_List
(Exception_Handlers
(Node
));
1636 if Present
(At_End_Proc
(Node
)) then
1637 Write_Indent_Str
("at end");
1640 Sprint_Node
(At_End_Proc
(Node
));
1645 when N_Identifier
=>
1649 when N_If_Statement
=>
1650 Write_Indent_Str_Sloc
("if ");
1651 Sprint_Node
(Condition
(Node
));
1652 Write_Str_With_Col_Check
(" then");
1653 Sprint_Indented_List
(Then_Statements
(Node
));
1654 Sprint_Opt_Node_List
(Elsif_Parts
(Node
));
1656 if Present
(Else_Statements
(Node
)) then
1657 Write_Indent_Str
("else");
1658 Sprint_Indented_List
(Else_Statements
(Node
));
1661 Write_Indent_Str
("end if;");
1663 when N_Implicit_Label_Declaration
=>
1664 if not Dump_Original_Only
then
1666 Write_Rewrite_Str
("<<<");
1668 Write_Id
(Defining_Identifier
(Node
));
1670 Write_Str_With_Col_Check
("label");
1671 Write_Rewrite_Str
(">>>");
1675 Sprint_Left_Opnd
(Node
);
1676 Write_Str_Sloc
(" in ");
1677 Sprint_Right_Opnd
(Node
);
1679 when N_Incomplete_Type_Declaration
=>
1680 Write_Indent_Str_Sloc
("type ");
1681 Write_Id
(Defining_Identifier
(Node
));
1683 if Present
(Discriminant_Specifications
(Node
)) then
1684 Write_Discr_Specs
(Node
);
1685 elsif Unknown_Discriminants_Present
(Node
) then
1686 Write_Str_With_Col_Check
("(<>)");
1691 when N_Index_Or_Discriminant_Constraint
=>
1693 Sprint_Paren_Comma_List
(Constraints
(Node
));
1695 when N_Indexed_Component
=>
1696 Sprint_Node_Sloc
(Prefix
(Node
));
1697 Sprint_Opt_Paren_Comma_List
(Expressions
(Node
));
1699 when N_Integer_Literal
=>
1700 if Print_In_Hex
(Node
) then
1701 Write_Uint_With_Col_Check_Sloc
(Intval
(Node
), Hex
);
1703 Write_Uint_With_Col_Check_Sloc
(Intval
(Node
), Auto
);
1706 when N_Iteration_Scheme
=>
1707 if Present
(Condition
(Node
)) then
1708 Write_Str_With_Col_Check_Sloc
("while ");
1709 Sprint_Node
(Condition
(Node
));
1711 Write_Str_With_Col_Check_Sloc
("for ");
1712 Sprint_Node
(Loop_Parameter_Specification
(Node
));
1717 when N_Itype_Reference
=>
1718 Write_Indent_Str_Sloc
("reference ");
1719 Write_Id
(Itype
(Node
));
1722 Write_Indent_Str_Sloc
("<<");
1723 Write_Id
(Identifier
(Node
));
1726 when N_Loop_Parameter_Specification
=>
1728 Write_Id
(Defining_Identifier
(Node
));
1729 Write_Str_With_Col_Check
(" in ");
1731 if Reverse_Present
(Node
) then
1732 Write_Str_With_Col_Check
("reverse ");
1735 Sprint_Node
(Discrete_Subtype_Definition
(Node
));
1737 when N_Loop_Statement
=>
1740 if Present
(Identifier
(Node
))
1741 and then (not Has_Created_Identifier
(Node
)
1742 or else not Dump_Original_Only
)
1744 Write_Rewrite_Str
("<<<");
1745 Write_Id
(Identifier
(Node
));
1747 Write_Rewrite_Str
(">>>");
1748 Sprint_Node
(Iteration_Scheme
(Node
));
1749 Write_Str_With_Col_Check_Sloc
("loop");
1750 Sprint_Indented_List
(Statements
(Node
));
1751 Write_Indent_Str
("end loop ");
1752 Write_Rewrite_Str
("<<<");
1753 Write_Id
(Identifier
(Node
));
1754 Write_Rewrite_Str
(">>>");
1758 Sprint_Node
(Iteration_Scheme
(Node
));
1759 Write_Str_With_Col_Check_Sloc
("loop");
1760 Sprint_Indented_List
(Statements
(Node
));
1761 Write_Indent_Str
("end loop;");
1764 when N_Mod_Clause
=>
1765 Sprint_Node_List
(Pragmas_Before
(Node
));
1766 Write_Str_With_Col_Check_Sloc
("at mod ");
1767 Sprint_Node
(Expression
(Node
));
1769 when N_Modular_Type_Definition
=>
1770 Write_Str_With_Col_Check_Sloc
("mod ");
1771 Sprint_Node
(Expression
(Node
));
1774 Sprint_Left_Opnd
(Node
);
1775 Write_Str_Sloc
(" not in ");
1776 Sprint_Right_Opnd
(Node
);
1779 Write_Str_With_Col_Check_Sloc
("null");
1781 when N_Null_Statement
=>
1782 if Comes_From_Source
(Node
)
1783 or else Dump_Freeze_Null
1784 or else not Is_List_Member
(Node
)
1785 or else (No
(Prev
(Node
)) and then No
(Next
(Node
)))
1787 Write_Indent_Str_Sloc
("null;");
1790 when N_Number_Declaration
=>
1793 if Write_Indent_Identifiers
(Node
) then
1794 Write_Str_With_Col_Check
(" : constant ");
1796 Sprint_Node
(Expression
(Node
));
1800 when N_Object_Declaration
=>
1803 if Write_Indent_Identifiers
(Node
) then
1806 if Aliased_Present
(Node
) then
1807 Write_Str_With_Col_Check
("aliased ");
1810 if Constant_Present
(Node
) then
1811 Write_Str_With_Col_Check
("constant ");
1814 -- Ada 2005 (AI-231)
1816 if Null_Exclusion_Present
(Node
) then
1817 Write_Str_With_Col_Check
("not null ");
1820 Sprint_Node
(Object_Definition
(Node
));
1822 if Present
(Expression
(Node
)) then
1824 Sprint_Node
(Expression
(Node
));
1830 when N_Object_Renaming_Declaration
=>
1833 Sprint_Node
(Defining_Identifier
(Node
));
1836 -- Ada 2005 (AI-230): Access renamings
1838 if Present
(Access_Definition
(Node
)) then
1839 Sprint_Node
(Access_Definition
(Node
));
1841 elsif Present
(Subtype_Mark
(Node
)) then
1842 Sprint_Node
(Subtype_Mark
(Node
));
1845 Write_Str
(" ??? ");
1848 Write_Str_With_Col_Check
(" renames ");
1849 Sprint_Node
(Name
(Node
));
1853 Write_Operator
(Node
, "abs ");
1854 Sprint_Right_Opnd
(Node
);
1857 Sprint_Left_Opnd
(Node
);
1858 Write_Operator
(Node
, " + ");
1859 Sprint_Right_Opnd
(Node
);
1862 Sprint_Left_Opnd
(Node
);
1863 Write_Operator
(Node
, " and ");
1864 Sprint_Right_Opnd
(Node
);
1867 Sprint_Left_Opnd
(Node
);
1868 Write_Operator
(Node
, " & ");
1869 Sprint_Right_Opnd
(Node
);
1872 Sprint_Left_Opnd
(Node
);
1874 Process_TFAI_RR_Flags
(Node
);
1875 Write_Operator
(Node
, "/ ");
1876 Sprint_Right_Opnd
(Node
);
1879 Sprint_Left_Opnd
(Node
);
1880 Write_Operator
(Node
, " = ");
1881 Sprint_Right_Opnd
(Node
);
1884 Sprint_Left_Opnd
(Node
);
1885 Write_Operator
(Node
, " ** ");
1886 Sprint_Right_Opnd
(Node
);
1889 Sprint_Left_Opnd
(Node
);
1890 Write_Operator
(Node
, " >= ");
1891 Sprint_Right_Opnd
(Node
);
1894 Sprint_Left_Opnd
(Node
);
1895 Write_Operator
(Node
, " > ");
1896 Sprint_Right_Opnd
(Node
);
1899 Sprint_Left_Opnd
(Node
);
1900 Write_Operator
(Node
, " <= ");
1901 Sprint_Right_Opnd
(Node
);
1904 Sprint_Left_Opnd
(Node
);
1905 Write_Operator
(Node
, " < ");
1906 Sprint_Right_Opnd
(Node
);
1909 Write_Operator
(Node
, "-");
1910 Sprint_Right_Opnd
(Node
);
1913 Sprint_Left_Opnd
(Node
);
1915 if Treat_Fixed_As_Integer
(Node
) then
1919 Write_Operator
(Node
, " mod ");
1920 Sprint_Right_Opnd
(Node
);
1922 when N_Op_Multiply
=>
1923 Sprint_Left_Opnd
(Node
);
1925 Process_TFAI_RR_Flags
(Node
);
1926 Write_Operator
(Node
, "* ");
1927 Sprint_Right_Opnd
(Node
);
1930 Sprint_Left_Opnd
(Node
);
1931 Write_Operator
(Node
, " /= ");
1932 Sprint_Right_Opnd
(Node
);
1935 Write_Operator
(Node
, "not ");
1936 Sprint_Right_Opnd
(Node
);
1939 Sprint_Left_Opnd
(Node
);
1940 Write_Operator
(Node
, " or ");
1941 Sprint_Right_Opnd
(Node
);
1944 Write_Operator
(Node
, "+");
1945 Sprint_Right_Opnd
(Node
);
1948 Sprint_Left_Opnd
(Node
);
1950 if Treat_Fixed_As_Integer
(Node
) then
1954 Write_Operator
(Node
, " rem ");
1955 Sprint_Right_Opnd
(Node
);
1961 Write_Str_With_Col_Check
("(");
1962 Sprint_Node
(Left_Opnd
(Node
));
1964 Sprint_Node
(Right_Opnd
(Node
));
1967 when N_Op_Subtract
=>
1968 Sprint_Left_Opnd
(Node
);
1969 Write_Operator
(Node
, " - ");
1970 Sprint_Right_Opnd
(Node
);
1973 Sprint_Left_Opnd
(Node
);
1974 Write_Operator
(Node
, " xor ");
1975 Sprint_Right_Opnd
(Node
);
1977 when N_Operator_Symbol
=>
1978 Write_Name_With_Col_Check_Sloc
(Chars
(Node
));
1980 when N_Ordinary_Fixed_Point_Definition
=>
1981 Write_Str_With_Col_Check_Sloc
("delta ");
1982 Sprint_Node
(Delta_Expression
(Node
));
1983 Sprint_Opt_Node
(Real_Range_Specification
(Node
));
1986 Sprint_Left_Opnd
(Node
);
1987 Write_Str_Sloc
(" or else ");
1988 Sprint_Right_Opnd
(Node
);
1990 when N_Others_Choice
=>
1991 if All_Others
(Node
) then
1992 Write_Str_With_Col_Check
("all ");
1995 Write_Str_With_Col_Check_Sloc
("others");
1997 when N_Package_Body
=>
1999 Write_Indent_Str_Sloc
("package body ");
2000 Sprint_Node
(Defining_Unit_Name
(Node
));
2002 Sprint_Indented_List
(Declarations
(Node
));
2004 if Present
(Handled_Statement_Sequence
(Node
)) then
2005 Write_Indent_Str
("begin");
2006 Sprint_Node
(Handled_Statement_Sequence
(Node
));
2009 Write_Indent_Str
("end ");
2010 Sprint_Node
(Defining_Unit_Name
(Node
));
2013 when N_Package_Body_Stub
=>
2014 Write_Indent_Str_Sloc
("package body ");
2015 Sprint_Node
(Defining_Identifier
(Node
));
2016 Write_Str_With_Col_Check
(" is separate;");
2018 when N_Package_Declaration
=>
2021 Sprint_Node_Sloc
(Specification
(Node
));
2024 when N_Package_Instantiation
=>
2026 Write_Indent_Str_Sloc
("package ");
2027 Sprint_Node
(Defining_Unit_Name
(Node
));
2028 Write_Str
(" is new ");
2029 Sprint_Node
(Name
(Node
));
2030 Sprint_Opt_Paren_Comma_List
(Generic_Associations
(Node
));
2033 when N_Package_Renaming_Declaration
=>
2034 Write_Indent_Str_Sloc
("package ");
2035 Sprint_Node
(Defining_Unit_Name
(Node
));
2036 Write_Str_With_Col_Check
(" renames ");
2037 Sprint_Node
(Name
(Node
));
2040 when N_Package_Specification
=>
2041 Write_Str_With_Col_Check_Sloc
("package ");
2042 Sprint_Node
(Defining_Unit_Name
(Node
));
2044 Sprint_Indented_List
(Visible_Declarations
(Node
));
2046 if Present
(Private_Declarations
(Node
)) then
2047 Write_Indent_Str
("private");
2048 Sprint_Indented_List
(Private_Declarations
(Node
));
2051 Write_Indent_Str
("end ");
2052 Sprint_Node
(Defining_Unit_Name
(Node
));
2054 when N_Parameter_Association
=>
2055 Sprint_Node_Sloc
(Selector_Name
(Node
));
2057 Sprint_Node
(Explicit_Actual_Parameter
(Node
));
2059 when N_Parameter_Specification
=>
2062 if Write_Identifiers
(Node
) then
2065 if In_Present
(Node
) then
2066 Write_Str_With_Col_Check
("in ");
2069 if Out_Present
(Node
) then
2070 Write_Str_With_Col_Check
("out ");
2073 -- Ada 2005 (AI-231)
2075 if Null_Exclusion_Present
(Node
) then
2076 Write_Str
("not null ");
2079 Sprint_Node
(Parameter_Type
(Node
));
2081 if Present
(Expression
(Node
)) then
2083 Sprint_Node
(Expression
(Node
));
2090 Write_Indent_Str_Sloc
("pragma ");
2091 Write_Name_With_Col_Check
(Chars
(Node
));
2093 if Present
(Pragma_Argument_Associations
(Node
)) then
2094 Sprint_Opt_Paren_Comma_List
2095 (Pragma_Argument_Associations
(Node
));
2100 when N_Pragma_Argument_Association
=>
2103 if Chars
(Node
) /= No_Name
then
2104 Write_Name_With_Col_Check
(Chars
(Node
));
2108 Sprint_Node
(Expression
(Node
));
2110 when N_Private_Type_Declaration
=>
2111 Write_Indent_Str_Sloc
("type ");
2112 Write_Id
(Defining_Identifier
(Node
));
2114 if Present
(Discriminant_Specifications
(Node
)) then
2115 Write_Discr_Specs
(Node
);
2116 elsif Unknown_Discriminants_Present
(Node
) then
2117 Write_Str_With_Col_Check
("(<>)");
2122 if Tagged_Present
(Node
) then
2123 Write_Str_With_Col_Check
("tagged ");
2126 if Limited_Present
(Node
) then
2127 Write_Str_With_Col_Check
("limited ");
2130 Write_Str_With_Col_Check
("private;");
2132 when N_Private_Extension_Declaration
=>
2133 Write_Indent_Str_Sloc
("type ");
2134 Write_Id
(Defining_Identifier
(Node
));
2136 if Present
(Discriminant_Specifications
(Node
)) then
2137 Write_Discr_Specs
(Node
);
2138 elsif Unknown_Discriminants_Present
(Node
) then
2139 Write_Str_With_Col_Check
("(<>)");
2142 Write_Str_With_Col_Check
(" is new ");
2143 Sprint_Node
(Subtype_Indication
(Node
));
2144 Write_Str_With_Col_Check
(" with private;");
2146 when N_Procedure_Call_Statement
=>
2149 Sprint_Node
(Name
(Node
));
2150 Sprint_Opt_Paren_Comma_List
(Parameter_Associations
(Node
));
2153 when N_Procedure_Instantiation
=>
2154 Write_Indent_Str_Sloc
("procedure ");
2155 Sprint_Node
(Defining_Unit_Name
(Node
));
2156 Write_Str_With_Col_Check
(" is new ");
2157 Sprint_Node
(Name
(Node
));
2158 Sprint_Opt_Paren_Comma_List
(Generic_Associations
(Node
));
2161 when N_Procedure_Specification
=>
2162 Write_Str_With_Col_Check_Sloc
("procedure ");
2163 Sprint_Node
(Defining_Unit_Name
(Node
));
2164 Write_Param_Specs
(Node
);
2166 when N_Protected_Body
=>
2167 Write_Indent_Str_Sloc
("protected body ");
2168 Write_Id
(Defining_Identifier
(Node
));
2170 Sprint_Indented_List
(Declarations
(Node
));
2171 Write_Indent_Str
("end ");
2172 Write_Id
(Defining_Identifier
(Node
));
2175 when N_Protected_Body_Stub
=>
2176 Write_Indent_Str_Sloc
("protected body ");
2177 Write_Id
(Defining_Identifier
(Node
));
2178 Write_Str_With_Col_Check
(" is separate;");
2180 when N_Protected_Definition
=>
2182 Sprint_Indented_List
(Visible_Declarations
(Node
));
2184 if Present
(Private_Declarations
(Node
)) then
2185 Write_Indent_Str
("private");
2186 Sprint_Indented_List
(Private_Declarations
(Node
));
2189 Write_Indent_Str
("end ");
2191 when N_Protected_Type_Declaration
=>
2192 Write_Indent_Str_Sloc
("protected type ");
2193 Write_Id
(Defining_Identifier
(Node
));
2194 Write_Discr_Specs
(Node
);
2196 if Present
(Interface_List
(Node
)) then
2197 Write_Str
(" is new ");
2198 Sprint_And_List
(Interface_List
(Node
));
2199 Write_Str
(" with ");
2204 Sprint_Node
(Protected_Definition
(Node
));
2205 Write_Id
(Defining_Identifier
(Node
));
2208 when N_Qualified_Expression
=>
2209 Sprint_Node
(Subtype_Mark
(Node
));
2210 Write_Char_Sloc
(''');
2212 -- Print expression, make sure we have at least one level of
2213 -- parentheses around the expression. For cases of qualified
2214 -- expressions in the source, this is always the case, but
2215 -- for generated qualifications, there may be no explicit
2216 -- parentheses present.
2218 if Paren_Count
(Expression
(Node
)) /= 0 then
2219 Sprint_Node
(Expression
(Node
));
2222 Sprint_Node
(Expression
(Node
));
2226 when N_Raise_Constraint_Error
=>
2228 -- This node can be used either as a subexpression or as a
2229 -- statement form. The following test is a reasonably reliable
2230 -- way to distinguish the two cases.
2232 if Is_List_Member
(Node
)
2233 and then Nkind
(Parent
(Node
)) not in N_Subexpr
2238 Write_Str_With_Col_Check_Sloc
("[constraint_error");
2239 Write_Condition_And_Reason
(Node
);
2241 when N_Raise_Program_Error
=>
2243 -- This node can be used either as a subexpression or as a
2244 -- statement form. The following test is a reasonably reliable
2245 -- way to distinguish the two cases.
2247 if Is_List_Member
(Node
)
2248 and then Nkind
(Parent
(Node
)) not in N_Subexpr
2253 Write_Str_With_Col_Check_Sloc
("[program_error");
2254 Write_Condition_And_Reason
(Node
);
2256 when N_Raise_Storage_Error
=>
2258 -- This node can be used either as a subexpression or as a
2259 -- statement form. The following test is a reasonably reliable
2260 -- way to distinguish the two cases.
2262 if Is_List_Member
(Node
)
2263 and then Nkind
(Parent
(Node
)) not in N_Subexpr
2268 Write_Str_With_Col_Check_Sloc
("[storage_error");
2269 Write_Condition_And_Reason
(Node
);
2271 when N_Raise_Statement
=>
2272 Write_Indent_Str_Sloc
("raise ");
2273 Sprint_Node
(Name
(Node
));
2277 Sprint_Node
(Low_Bound
(Node
));
2278 Write_Str_Sloc
(" .. ");
2279 Sprint_Node
(High_Bound
(Node
));
2281 when N_Range_Constraint
=>
2282 Write_Str_With_Col_Check_Sloc
("range ");
2283 Sprint_Node
(Range_Expression
(Node
));
2285 when N_Real_Literal
=>
2286 Write_Ureal_With_Col_Check_Sloc
(Realval
(Node
));
2288 when N_Real_Range_Specification
=>
2289 Write_Str_With_Col_Check_Sloc
("range ");
2290 Sprint_Node
(Low_Bound
(Node
));
2292 Sprint_Node
(High_Bound
(Node
));
2294 when N_Record_Definition
=>
2295 if Abstract_Present
(Node
) then
2296 Write_Str_With_Col_Check
("abstract ");
2299 if Tagged_Present
(Node
) then
2300 Write_Str_With_Col_Check
("tagged ");
2303 if Limited_Present
(Node
) then
2304 Write_Str_With_Col_Check
("limited ");
2307 if Null_Present
(Node
) then
2308 Write_Str_With_Col_Check_Sloc
("null record");
2311 Write_Str_With_Col_Check_Sloc
("record");
2312 Sprint_Node
(Component_List
(Node
));
2313 Write_Indent_Str
("end record");
2316 when N_Record_Representation_Clause
=>
2317 Write_Indent_Str_Sloc
("for ");
2318 Sprint_Node
(Identifier
(Node
));
2319 Write_Str_With_Col_Check
(" use record ");
2321 if Present
(Mod_Clause
(Node
)) then
2322 Sprint_Node
(Mod_Clause
(Node
));
2325 Sprint_Indented_List
(Component_Clauses
(Node
));
2326 Write_Indent_Str
("end record;");
2329 Sprint_Node
(Prefix
(Node
));
2330 Write_Str_With_Col_Check_Sloc
("'reference");
2332 when N_Requeue_Statement
=>
2333 Write_Indent_Str_Sloc
("requeue ");
2334 Sprint_Node
(Name
(Node
));
2336 if Abort_Present
(Node
) then
2337 Write_Str_With_Col_Check
(" with abort");
2342 when N_Return_Statement
=>
2343 if Present
(Expression
(Node
)) then
2344 Write_Indent_Str_Sloc
("return ");
2345 Sprint_Node
(Expression
(Node
));
2348 Write_Indent_Str_Sloc
("return;");
2351 when N_Selective_Accept
=>
2352 Write_Indent_Str_Sloc
("select");
2357 Alt_Node
:= First
(Select_Alternatives
(Node
));
2360 Sprint_Node
(Alt_Node
);
2363 exit when No
(Alt_Node
);
2364 Write_Indent_Str
("or");
2368 if Present
(Else_Statements
(Node
)) then
2369 Write_Indent_Str
("else");
2370 Sprint_Indented_List
(Else_Statements
(Node
));
2373 Write_Indent_Str
("end select;");
2375 when N_Signed_Integer_Type_Definition
=>
2376 Write_Str_With_Col_Check_Sloc
("range ");
2377 Sprint_Node
(Low_Bound
(Node
));
2379 Sprint_Node
(High_Bound
(Node
));
2381 when N_Single_Protected_Declaration
=>
2382 Write_Indent_Str_Sloc
("protected ");
2383 Write_Id
(Defining_Identifier
(Node
));
2385 Sprint_Node
(Protected_Definition
(Node
));
2386 Write_Id
(Defining_Identifier
(Node
));
2389 when N_Single_Task_Declaration
=>
2390 Write_Indent_Str_Sloc
("task ");
2391 Write_Id
(Defining_Identifier
(Node
));
2393 if Present
(Task_Definition
(Node
)) then
2395 Sprint_Node
(Task_Definition
(Node
));
2396 Write_Id
(Defining_Identifier
(Node
));
2401 when N_Selected_Component
=>
2402 Sprint_Node
(Prefix
(Node
));
2403 Write_Char_Sloc
('.');
2404 Sprint_Node
(Selector_Name
(Node
));
2408 Sprint_Node
(Prefix
(Node
));
2409 Write_Str_With_Col_Check
(" (");
2410 Sprint_Node
(Discrete_Range
(Node
));
2413 when N_String_Literal
=>
2414 if String_Length
(Strval
(Node
)) + Column
> 75 then
2415 Write_Indent_Str
(" ");
2419 Write_String_Table_Entry
(Strval
(Node
));
2421 when N_Subprogram_Body
=>
2422 if Freeze_Indent
= 0 then
2427 Sprint_Node_Sloc
(Specification
(Node
));
2430 Sprint_Indented_List
(Declarations
(Node
));
2431 Write_Indent_Str
("begin");
2432 Sprint_Node
(Handled_Statement_Sequence
(Node
));
2434 Write_Indent_Str
("end ");
2435 Sprint_Node
(Defining_Unit_Name
(Specification
(Node
)));
2438 if Is_List_Member
(Node
)
2439 and then Present
(Next
(Node
))
2440 and then Nkind
(Next
(Node
)) /= N_Subprogram_Body
2445 when N_Subprogram_Body_Stub
=>
2447 Sprint_Node_Sloc
(Specification
(Node
));
2448 Write_Str_With_Col_Check
(" is separate;");
2450 when N_Subprogram_Declaration
=>
2452 Sprint_Node_Sloc
(Specification
(Node
));
2454 if Nkind
(Specification
(Node
)) = N_Procedure_Specification
2455 and then Null_Present
(Specification
(Node
))
2457 Write_Str_With_Col_Check
(" is null");
2462 when N_Subprogram_Info
=>
2463 Sprint_Node
(Identifier
(Node
));
2464 Write_Str_With_Col_Check_Sloc
("'subprogram_info");
2466 when N_Subprogram_Renaming_Declaration
=>
2468 Sprint_Node
(Specification
(Node
));
2469 Write_Str_With_Col_Check_Sloc
(" renames ");
2470 Sprint_Node
(Name
(Node
));
2473 when N_Subtype_Declaration
=>
2474 Write_Indent_Str_Sloc
("subtype ");
2475 Write_Id
(Defining_Identifier
(Node
));
2478 -- Ada 2005 (AI-231)
2480 if Null_Exclusion_Present
(Node
) then
2481 Write_Str
("not null ");
2484 Sprint_Node
(Subtype_Indication
(Node
));
2487 when N_Subtype_Indication
=>
2488 Sprint_Node_Sloc
(Subtype_Mark
(Node
));
2490 Sprint_Node
(Constraint
(Node
));
2493 Write_Indent_Str_Sloc
("separate (");
2494 Sprint_Node
(Name
(Node
));
2497 Sprint_Node
(Proper_Body
(Node
));
2500 Write_Indent_Str_Sloc
("task body ");
2501 Write_Id
(Defining_Identifier
(Node
));
2503 Sprint_Indented_List
(Declarations
(Node
));
2504 Write_Indent_Str
("begin");
2505 Sprint_Node
(Handled_Statement_Sequence
(Node
));
2506 Write_Indent_Str
("end ");
2507 Write_Id
(Defining_Identifier
(Node
));
2510 when N_Task_Body_Stub
=>
2511 Write_Indent_Str_Sloc
("task body ");
2512 Write_Id
(Defining_Identifier
(Node
));
2513 Write_Str_With_Col_Check
(" is separate;");
2515 when N_Task_Definition
=>
2517 Sprint_Indented_List
(Visible_Declarations
(Node
));
2519 if Present
(Private_Declarations
(Node
)) then
2520 Write_Indent_Str
("private");
2521 Sprint_Indented_List
(Private_Declarations
(Node
));
2524 Write_Indent_Str
("end ");
2526 when N_Task_Type_Declaration
=>
2527 Write_Indent_Str_Sloc
("task type ");
2528 Write_Id
(Defining_Identifier
(Node
));
2529 Write_Discr_Specs
(Node
);
2531 if Present
(Interface_List
(Node
)) then
2532 Write_Str
(" is new ");
2533 Sprint_And_List
(Interface_List
(Node
));
2536 if Present
(Task_Definition
(Node
)) then
2537 if No
(Interface_List
(Node
)) then
2540 Write_Str
(" with ");
2543 Sprint_Node
(Task_Definition
(Node
));
2544 Write_Id
(Defining_Identifier
(Node
));
2549 when N_Terminate_Alternative
=>
2550 Sprint_Node_List
(Pragmas_Before
(Node
));
2554 if Present
(Condition
(Node
)) then
2555 Write_Str_With_Col_Check
("when ");
2556 Sprint_Node
(Condition
(Node
));
2560 Write_Str_With_Col_Check_Sloc
("terminate;");
2561 Sprint_Node_List
(Pragmas_After
(Node
));
2563 when N_Timed_Entry_Call
=>
2564 Write_Indent_Str_Sloc
("select");
2566 Sprint_Node
(Entry_Call_Alternative
(Node
));
2568 Write_Indent_Str
("or");
2570 Sprint_Node
(Delay_Alternative
(Node
));
2572 Write_Indent_Str
("end select;");
2574 when N_Triggering_Alternative
=>
2575 Sprint_Node_List
(Pragmas_Before
(Node
));
2576 Sprint_Node_Sloc
(Triggering_Statement
(Node
));
2577 Sprint_Node_List
(Statements
(Node
));
2579 when N_Type_Conversion
=>
2581 Sprint_Node
(Subtype_Mark
(Node
));
2584 if Conversion_OK
(Node
) then
2588 if Float_Truncate
(Node
) then
2592 if Rounded_Result
(Node
) then
2597 Sprint_Node
(Expression
(Node
));
2600 when N_Unchecked_Expression
=>
2603 Sprint_Node_Sloc
(Expression
(Node
));
2606 when N_Unchecked_Type_Conversion
=>
2607 Sprint_Node
(Subtype_Mark
(Node
));
2609 Write_Str_With_Col_Check
("(");
2610 Sprint_Node_Sloc
(Expression
(Node
));
2613 when N_Unconstrained_Array_Definition
=>
2614 Write_Str_With_Col_Check_Sloc
("array (");
2619 Node1
:= First
(Subtype_Marks
(Node
));
2621 Sprint_Node
(Node1
);
2622 Write_Str_With_Col_Check
(" range <>");
2624 exit when Node1
= Empty
;
2629 Write_Str
(") of ");
2630 Sprint_Node
(Component_Definition
(Node
));
2632 when N_Unused_At_Start | N_Unused_At_End
=>
2633 Write_Indent_Str
("***** Error, unused node encountered *****");
2636 when N_Use_Package_Clause
=>
2637 Write_Indent_Str_Sloc
("use ");
2638 Sprint_Comma_List
(Names
(Node
));
2641 when N_Use_Type_Clause
=>
2642 Write_Indent_Str_Sloc
("use type ");
2643 Sprint_Comma_List
(Subtype_Marks
(Node
));
2646 when N_Validate_Unchecked_Conversion
=>
2647 Write_Indent_Str_Sloc
("validate unchecked_conversion (");
2648 Sprint_Node
(Source_Type
(Node
));
2650 Sprint_Node
(Target_Type
(Node
));
2654 Write_Indent_Str_Sloc
("when ");
2655 Sprint_Bar_List
(Discrete_Choices
(Node
));
2657 Sprint_Node
(Component_List
(Node
));
2659 when N_Variant_Part
=>
2661 Write_Indent_Str_Sloc
("case ");
2662 Sprint_Node
(Name
(Node
));
2664 Sprint_Indented_List
(Variants
(Node
));
2665 Write_Indent_Str
("end case");
2668 when N_With_Clause
=>
2670 -- Special test, if we are dumping the original tree only,
2671 -- then we want to eliminate the bogus with clauses that
2672 -- correspond to the non-existent children of Text_IO.
2674 if Dump_Original_Only
2675 and then Is_Text_IO_Kludge_Unit
(Name
(Node
))
2679 -- Normal case, output the with clause
2682 if First_Name
(Node
) or else not Dump_Original_Only
then
2684 -- Ada 2005 (AI-50217): Print limited with_clauses
2686 if Private_Present
(Node
) and Limited_Present
(Node
) then
2687 Write_Indent_Str
("limited private with ");
2689 elsif Private_Present
(Node
) then
2690 Write_Indent_Str
("private with ");
2692 elsif Limited_Present
(Node
) then
2693 Write_Indent_Str
("limited with ");
2696 Write_Indent_Str
("with ");
2703 Sprint_Node_Sloc
(Name
(Node
));
2705 if Last_Name
(Node
) or else not Dump_Original_Only
then
2710 when N_With_Type_Clause
=>
2711 Write_Indent_Str
("with type ");
2712 Sprint_Node_Sloc
(Name
(Node
));
2714 if Tagged_Present
(Node
) then
2715 Write_Str
(" is tagged;");
2717 Write_Str
(" is access;");
2722 if Nkind
(Node
) in N_Subexpr
2723 and then Do_Range_Check
(Node
)
2728 for J
in 1 .. Paren_Count
(Node
) loop
2732 pragma Assert
(No
(Debug_Node
));
2733 Debug_Node
:= Save_Debug_Node
;
2734 end Sprint_Node_Actual
;
2736 ----------------------
2737 -- Sprint_Node_List --
2738 ----------------------
2740 procedure Sprint_Node_List
(List
: List_Id
) is
2744 if Is_Non_Empty_List
(List
) then
2745 Node
:= First
(List
);
2750 exit when Node
= Empty
;
2753 end Sprint_Node_List
;
2755 ----------------------
2756 -- Sprint_Node_Sloc --
2757 ----------------------
2759 procedure Sprint_Node_Sloc
(Node
: Node_Id
) is
2763 if Present
(Debug_Node
) then
2764 Set_Sloc
(Debug_Node
, Sloc
(Node
));
2765 Debug_Node
:= Empty
;
2767 end Sprint_Node_Sloc
;
2769 ---------------------
2770 -- Sprint_Opt_Node --
2771 ---------------------
2773 procedure Sprint_Opt_Node
(Node
: Node_Id
) is
2775 if Present
(Node
) then
2779 end Sprint_Opt_Node
;
2781 --------------------------
2782 -- Sprint_Opt_Node_List --
2783 --------------------------
2785 procedure Sprint_Opt_Node_List
(List
: List_Id
) is
2787 if Present
(List
) then
2788 Sprint_Node_List
(List
);
2790 end Sprint_Opt_Node_List
;
2792 ---------------------------------
2793 -- Sprint_Opt_Paren_Comma_List --
2794 ---------------------------------
2796 procedure Sprint_Opt_Paren_Comma_List
(List
: List_Id
) is
2798 if Is_Non_Empty_List
(List
) then
2800 Sprint_Paren_Comma_List
(List
);
2802 end Sprint_Opt_Paren_Comma_List
;
2804 -----------------------------
2805 -- Sprint_Paren_Comma_List --
2806 -----------------------------
2808 procedure Sprint_Paren_Comma_List
(List
: List_Id
) is
2810 Node_Exists
: Boolean := False;
2814 if Is_Non_Empty_List
(List
) then
2816 if Dump_Original_Only
then
2818 while Present
(N
) loop
2819 if not Is_Rewrite_Insertion
(N
) then
2820 Node_Exists
:= True;
2827 if not Node_Exists
then
2832 Write_Str_With_Col_Check
("(");
2833 Sprint_Comma_List
(List
);
2836 end Sprint_Paren_Comma_List
;
2838 ----------------------
2839 -- Sprint_Right_Opnd --
2840 ----------------------
2842 procedure Sprint_Right_Opnd
(N
: Node_Id
) is
2843 Opnd
: constant Node_Id
:= Right_Opnd
(N
);
2846 if Paren_Count
(Opnd
) /= 0
2847 or else Op_Prec
(Nkind
(Opnd
)) > Op_Prec
(Nkind
(N
))
2856 end Sprint_Right_Opnd
;
2858 ---------------------
2859 -- Write_Char_Sloc --
2860 ---------------------
2862 procedure Write_Char_Sloc
(C
: Character) is
2864 if Debug_Generated_Code
and then C
/= ' ' then
2869 end Write_Char_Sloc
;
2871 --------------------------------
2872 -- Write_Condition_And_Reason --
2873 --------------------------------
2875 procedure Write_Condition_And_Reason
(Node
: Node_Id
) is
2876 Image
: constant String := RT_Exception_Code
'Image
2877 (RT_Exception_Code
'Val
2878 (UI_To_Int
(Reason
(Node
))));
2881 if Present
(Condition
(Node
)) then
2882 Write_Str_With_Col_Check
(" when ");
2883 Sprint_Node
(Condition
(Node
));
2888 for J
in 4 .. Image
'Last loop
2889 if Image
(J
) = '_' then
2892 Write_Char
(Fold_Lower
(Image
(J
)));
2897 end Write_Condition_And_Reason
;
2899 -----------------------
2900 -- Write_Discr_Specs --
2901 -----------------------
2903 procedure Write_Discr_Specs
(N
: Node_Id
) is
2908 Specs
:= Discriminant_Specifications
(N
);
2910 if Present
(Specs
) then
2911 Write_Str_With_Col_Check
(" (");
2912 Spec
:= First
(Specs
);
2917 exit when Spec
= Empty
;
2919 -- Add semicolon, unless we are printing original tree and the
2920 -- next specification is part of a list (but not the first
2921 -- element of that list)
2923 if not Dump_Original_Only
or else not Prev_Ids
(Spec
) then
2930 end Write_Discr_Specs
;
2936 procedure Write_Ekind
(E
: Entity_Id
) is
2937 S
: constant String := Entity_Kind
'Image (Ekind
(E
));
2940 Name_Len
:= S
'Length;
2941 Name_Buffer
(1 .. Name_Len
) := S
;
2942 Set_Casing
(Mixed_Case
);
2943 Write_Str_With_Col_Check
(Name_Buffer
(1 .. Name_Len
));
2950 procedure Write_Id
(N
: Node_Id
) is
2952 -- Deal with outputting Itype
2954 -- Note: if we are printing the full tree with -gnatds, then we may
2955 -- end up picking up the Associated_Node link from a generic template
2956 -- here which overlaps the Entity field, but as documented, Write_Itype
2957 -- is defended against junk calls.
2959 if Nkind
(N
) in N_Entity
then
2961 elsif Nkind
(N
) in N_Has_Entity
then
2962 Write_Itype
(Entity
(N
));
2965 -- Case of a defining identifier
2967 if Nkind
(N
) = N_Defining_Identifier
then
2969 -- If defining identifier has an interface name (and no
2970 -- address clause), then we output the interface name.
2972 if (Is_Imported
(N
) or else Is_Exported
(N
))
2973 and then Present
(Interface_Name
(N
))
2974 and then No
(Address_Clause
(N
))
2976 String_To_Name_Buffer
(Strval
(Interface_Name
(N
)));
2977 Write_Str_With_Col_Check
(Name_Buffer
(1 .. Name_Len
));
2979 -- If no interface name (or inactive because there was
2980 -- an address clause), then just output the Chars name.
2983 Write_Name_With_Col_Check
(Chars
(N
));
2986 -- Case of selector of an expanded name where the expanded name
2987 -- has an associated entity, output this entity.
2989 elsif Nkind
(Parent
(N
)) = N_Expanded_Name
2990 and then Selector_Name
(Parent
(N
)) = N
2991 and then Present
(Entity
(Parent
(N
)))
2993 Write_Id
(Entity
(Parent
(N
)));
2995 -- For any other node with an associated entity, output it
2997 elsif Nkind
(N
) in N_Has_Entity
2998 and then Present
(Entity_Or_Associated_Node
(N
))
2999 and then Nkind
(Entity_Or_Associated_Node
(N
)) in N_Entity
3001 Write_Id
(Entity
(N
));
3003 -- All other cases, we just print the Chars field
3006 Write_Name_With_Col_Check
(Chars
(N
));
3010 -----------------------
3011 -- Write_Identifiers --
3012 -----------------------
3014 function Write_Identifiers
(Node
: Node_Id
) return Boolean is
3016 Sprint_Node
(Defining_Identifier
(Node
));
3018 -- The remainder of the declaration must be printed unless we are
3019 -- printing the original tree and this is not the last identifier
3022 not Dump_Original_Only
or else not More_Ids
(Node
);
3024 end Write_Identifiers
;
3026 ------------------------
3027 -- Write_Implicit_Def --
3028 ------------------------
3030 procedure Write_Implicit_Def
(E
: Entity_Id
) is
3035 when E_Array_Subtype
=>
3036 Write_Str_With_Col_Check
("subtype ");
3038 Write_Str_With_Col_Check
(" is ");
3039 Write_Id
(Base_Type
(E
));
3040 Write_Str_With_Col_Check
(" (");
3042 Ind
:= First_Index
(E
);
3043 while Present
(Ind
) loop
3047 if Present
(Ind
) then
3054 when E_Signed_Integer_Subtype | E_Enumeration_Subtype
=>
3055 Write_Str_With_Col_Check
("subtype ");
3058 Write_Id
(Etype
(E
));
3059 Write_Str_With_Col_Check
(" range ");
3060 Sprint_Node
(Scalar_Range
(E
));
3064 Write_Str_With_Col_Check
("type ");
3066 Write_Str_With_Col_Check
(" is <");
3071 end Write_Implicit_Def
;
3077 procedure Write_Indent
is
3079 if Indent_Annull_Flag
then
3080 Indent_Annull_Flag
:= False;
3084 for J
in 1 .. Indent
loop
3090 ------------------------------
3091 -- Write_Indent_Identifiers --
3092 ------------------------------
3094 function Write_Indent_Identifiers
(Node
: Node_Id
) return Boolean is
3096 -- We need to start a new line for every node, except in the case
3097 -- where we are printing the original tree and this is not the first
3098 -- defining identifier in the list.
3100 if not Dump_Original_Only
or else not Prev_Ids
(Node
) then
3103 -- If printing original tree and this is not the first defining
3104 -- identifier in the list, then the previous call to this procedure
3105 -- printed only the name, and we add a comma to separate the names.
3111 Sprint_Node
(Defining_Identifier
(Node
));
3113 -- The remainder of the declaration must be printed unless we are
3114 -- printing the original tree and this is not the last identifier
3117 not Dump_Original_Only
or else not More_Ids
(Node
);
3119 end Write_Indent_Identifiers
;
3121 -----------------------------------
3122 -- Write_Indent_Identifiers_Sloc --
3123 -----------------------------------
3125 function Write_Indent_Identifiers_Sloc
(Node
: Node_Id
) return Boolean is
3127 -- We need to start a new line for every node, except in the case
3128 -- where we are printing the original tree and this is not the first
3129 -- defining identifier in the list.
3131 if not Dump_Original_Only
or else not Prev_Ids
(Node
) then
3134 -- If printing original tree and this is not the first defining
3135 -- identifier in the list, then the previous call to this procedure
3136 -- printed only the name, and we add a comma to separate the names.
3143 Sprint_Node
(Defining_Identifier
(Node
));
3145 -- The remainder of the declaration must be printed unless we are
3146 -- printing the original tree and this is not the last identifier
3149 not Dump_Original_Only
or else not More_Ids
(Node
);
3151 end Write_Indent_Identifiers_Sloc
;
3153 ----------------------
3154 -- Write_Indent_Str --
3155 ----------------------
3157 procedure Write_Indent_Str
(S
: String) is
3161 end Write_Indent_Str
;
3163 ---------------------------
3164 -- Write_Indent_Str_Sloc --
3165 ---------------------------
3167 procedure Write_Indent_Str_Sloc
(S
: String) is
3171 end Write_Indent_Str_Sloc
;
3177 procedure Write_Itype
(Typ
: Entity_Id
) is
3179 procedure Write_Header
(T
: Boolean := True);
3180 -- Write type if T is True, subtype if T is false
3186 procedure Write_Header
(T
: Boolean := True) is
3189 Write_Str
("[type ");
3191 Write_Str
("[subtype ");
3194 Write_Name_With_Col_Check
(Chars
(Typ
));
3198 -- Start of processing for Write_Itype
3201 if Nkind
(Typ
) in N_Entity
3202 and then Is_Itype
(Typ
)
3203 and then not Itype_Printed
(Typ
)
3205 -- Itype to be printed
3208 B
: constant Node_Id
:= Etype
(Typ
);
3210 P
: constant Node_Id
:= Parent
(Typ
);
3212 S
: constant Saved_Output_Buffer
:= Save_Output_Buffer
;
3213 -- Save current output buffer
3216 -- Write indentation at start of line
3218 for J
in 1 .. Indent
loop
3222 -- If we have a constructed declaration, print it
3224 if Present
(P
) and then Nkind
(P
) in N_Declaration
then
3226 -- We must set Itype_Printed true before the recursive call to
3227 -- print the node, otherwise we get an infinite recursion!
3229 Set_Itype_Printed
(Typ
, True);
3231 -- Write the declaration enclosed in [], avoiding new line
3232 -- at start of declaration, and semicolon at end.
3235 Indent_Annull_Flag
:= True;
3237 Write_Erase_Char
(';');
3239 -- If no constructed declaration, then we have to concoct the
3240 -- source corresponding to the type entity that we have at hand.
3245 -- Access types and subtypes
3248 Write_Header
(Ekind
(Typ
) = E_Access_Type
);
3249 Write_Str
("access ");
3251 if Is_Access_Constant
(Typ
) then
3252 Write_Str
("constant ");
3253 elsif Can_Never_Be_Null
(Typ
) then
3254 Write_Str
("not null ");
3257 Write_Id
(Directly_Designated_Type
(Typ
));
3259 -- Array types and string types
3261 when E_Array_Type | E_String_Type
=>
3263 Write_Str
("array (");
3265 X
:= First_Index
(Typ
);
3269 if not Is_Constrained
(Typ
) then
3270 Write_Str
(" range <>");
3278 Write_Str
(") of ");
3279 Sprint_Node
(Component_Type
(Typ
));
3281 -- Array subtypes and string subtypes
3283 when E_Array_Subtype | E_String_Subtype
=>
3284 Write_Header
(False);
3285 Write_Id
(Etype
(Typ
));
3288 X
:= First_Index
(Typ
);
3298 -- Signed integer types, and modular integer subtypes
3300 when E_Signed_Integer_Type |
3301 E_Signed_Integer_Subtype |
3302 E_Modular_Integer_Subtype
=>
3304 Write_Header
(Ekind
(Typ
) = E_Signed_Integer_Type
);
3306 if Ekind
(Typ
) = E_Signed_Integer_Type
then
3312 -- Print bounds if not different from base type
3315 L
: constant Node_Id
:= Type_Low_Bound
(Typ
);
3316 H
: constant Node_Id
:= Type_High_Bound
(Typ
);
3317 LE
: constant Node_Id
:= Type_Low_Bound
(B
);
3318 HE
: constant Node_Id
:= Type_High_Bound
(B
);
3321 if Nkind
(L
) = N_Integer_Literal
3322 and then Nkind
(H
) = N_Integer_Literal
3323 and then Nkind
(LE
) = N_Integer_Literal
3324 and then Nkind
(HE
) = N_Integer_Literal
3325 and then UI_Eq
(Intval
(L
), Intval
(LE
))
3326 and then UI_Eq
(Intval
(H
), Intval
(HE
))
3331 Write_Str
(" range ");
3332 Sprint_Node
(Type_Low_Bound
(Typ
));
3334 Sprint_Node
(Type_High_Bound
(Typ
));
3338 -- Modular integer types
3340 when E_Modular_Integer_Type
=>
3342 Write_Str
(" mod ");
3343 Write_Uint_With_Col_Check
(Modulus
(Typ
), Auto
);
3345 -- Floating point types and subtypes
3347 when E_Floating_Point_Type |
3348 E_Floating_Point_Subtype
=>
3350 Write_Header
(Ekind
(Typ
) = E_Floating_Point_Type
);
3352 if Ekind
(Typ
) = E_Floating_Point_Type
then
3356 Write_Id
(Etype
(Typ
));
3358 if Digits_Value
(Typ
) /= Digits_Value
(Etype
(Typ
)) then
3359 Write_Str
(" digits ");
3360 Write_Uint_With_Col_Check
3361 (Digits_Value
(Typ
), Decimal
);
3364 -- Print bounds if not different from base type
3367 L
: constant Node_Id
:= Type_Low_Bound
(Typ
);
3368 H
: constant Node_Id
:= Type_High_Bound
(Typ
);
3369 LE
: constant Node_Id
:= Type_Low_Bound
(B
);
3370 HE
: constant Node_Id
:= Type_High_Bound
(B
);
3373 if Nkind
(L
) = N_Real_Literal
3374 and then Nkind
(H
) = N_Real_Literal
3375 and then Nkind
(LE
) = N_Real_Literal
3376 and then Nkind
(HE
) = N_Real_Literal
3377 and then UR_Eq
(Realval
(L
), Realval
(LE
))
3378 and then UR_Eq
(Realval
(H
), Realval
(HE
))
3383 Write_Str
(" range ");
3384 Sprint_Node
(Type_Low_Bound
(Typ
));
3386 Sprint_Node
(Type_High_Bound
(Typ
));
3392 when E_Record_Subtype
=>
3393 Write_Header
(False);
3394 Write_Str
("record");
3400 C
:= First_Entity
(Typ
);
3401 while Present
(C
) loop
3405 Write_Id
(Etype
(C
));
3411 Write_Indent_Str
(" end record");
3413 -- For all other Itypes, print ??? (fill in later)
3416 Write_Header
(True);
3422 -- Add terminating bracket and restore output buffer
3426 Restore_Output_Buffer
(S
);
3429 Set_Itype_Printed
(Typ
);
3433 -------------------------------
3434 -- Write_Name_With_Col_Check --
3435 -------------------------------
3437 procedure Write_Name_With_Col_Check
(N
: Name_Id
) is
3441 Get_Name_String
(N
);
3443 -- Deal with -gnatI which replaces digits in an internal
3444 -- name by three dots (e.g. R7b becomes R...b).
3446 if Debug_Flag_II
and then Name_Buffer
(1) in 'A' .. 'Z' then
3448 while J
< Name_Len
loop
3449 exit when Name_Buffer
(J
) not in 'A' .. 'Z';
3453 if Name_Buffer
(J
) in '0' .. '9' then
3454 Write_Str_With_Col_Check
(Name_Buffer
(1 .. J
- 1));
3457 while J
<= Name_Len
loop
3458 if Name_Buffer
(J
) not in '0' .. '9' then
3459 Write_Str
(Name_Buffer
(J
.. Name_Len
));
3471 -- Fall through for normal case
3473 Write_Str_With_Col_Check
(Name_Buffer
(1 .. Name_Len
));
3474 end Write_Name_With_Col_Check
;
3476 ------------------------------------
3477 -- Write_Name_With_Col_Check_Sloc --
3478 ------------------------------------
3480 procedure Write_Name_With_Col_Check_Sloc
(N
: Name_Id
) is
3482 Get_Name_String
(N
);
3483 Write_Str_With_Col_Check_Sloc
(Name_Buffer
(1 .. Name_Len
));
3484 end Write_Name_With_Col_Check_Sloc
;
3486 --------------------
3487 -- Write_Operator --
3488 --------------------
3490 procedure Write_Operator
(N
: Node_Id
; S
: String) is
3491 F
: Natural := S
'First;
3492 T
: Natural := S
'Last;
3495 -- If no overflow check, just write string out, and we are done
3497 if not Do_Overflow_Check
(N
) then
3500 -- If overflow check, we want to surround the operator with curly
3501 -- brackets, but not include spaces within the brackets.
3514 Write_Str_Sloc
(S
(F
.. T
));
3517 if S
(S
'Last) = ' ' then
3523 -----------------------
3524 -- Write_Param_Specs --
3525 -----------------------
3527 procedure Write_Param_Specs
(N
: Node_Id
) is
3533 Specs
:= Parameter_Specifications
(N
);
3535 if Is_Non_Empty_List
(Specs
) then
3536 Write_Str_With_Col_Check
(" (");
3537 Spec
:= First
(Specs
);
3541 Formal
:= Defining_Identifier
(Spec
);
3543 exit when Spec
= Empty
;
3545 -- Add semicolon, unless we are printing original tree and the
3546 -- next specification is part of a list (but not the first
3547 -- element of that list)
3549 if not Dump_Original_Only
or else not Prev_Ids
(Spec
) then
3554 -- Write out any extra formals
3556 while Present
(Extra_Formal
(Formal
)) loop
3557 Formal
:= Extra_Formal
(Formal
);
3559 Write_Name_With_Col_Check
(Chars
(Formal
));
3561 Write_Name_With_Col_Check
(Chars
(Etype
(Formal
)));
3566 end Write_Param_Specs
;
3568 --------------------------
3569 -- Write_Rewrite_Str --
3570 --------------------------
3572 procedure Write_Rewrite_Str
(S
: String) is
3574 if not Dump_Generated_Only
then
3575 if S
'Length = 3 and then S
= ">>>" then
3578 Write_Str_With_Col_Check
(S
);
3581 end Write_Rewrite_Str
;
3583 --------------------
3584 -- Write_Str_Sloc --
3585 --------------------
3587 procedure Write_Str_Sloc
(S
: String) is
3589 for J
in S
'Range loop
3590 Write_Char_Sloc
(S
(J
));
3594 ------------------------------
3595 -- Write_Str_With_Col_Check --
3596 ------------------------------
3598 procedure Write_Str_With_Col_Check
(S
: String) is
3600 if Int
(S
'Last) + Column
> Line_Limit
then
3601 Write_Indent_Str
(" ");
3604 Write_Str
(S
(2 .. S
'Length));
3612 end Write_Str_With_Col_Check
;
3614 -----------------------------------
3615 -- Write_Str_With_Col_Check_Sloc --
3616 -----------------------------------
3618 procedure Write_Str_With_Col_Check_Sloc
(S
: String) is
3620 if Int
(S
'Last) + Column
> Line_Limit
then
3621 Write_Indent_Str
(" ");
3624 Write_Str_Sloc
(S
(2 .. S
'Length));
3632 end Write_Str_With_Col_Check_Sloc
;
3634 -------------------------------
3635 -- Write_Uint_With_Col_Check --
3636 -------------------------------
3638 procedure Write_Uint_With_Col_Check
(U
: Uint
; Format
: UI_Format
) is
3640 Col_Check
(UI_Decimal_Digits_Hi
(U
));
3641 UI_Write
(U
, Format
);
3642 end Write_Uint_With_Col_Check
;
3644 ------------------------------------
3645 -- Write_Uint_With_Col_Check_Sloc --
3646 ------------------------------------
3648 procedure Write_Uint_With_Col_Check_Sloc
(U
: Uint
; Format
: UI_Format
) is
3650 Col_Check
(UI_Decimal_Digits_Hi
(U
));
3652 UI_Write
(U
, Format
);
3653 end Write_Uint_With_Col_Check_Sloc
;
3655 -------------------------------------
3656 -- Write_Ureal_With_Col_Check_Sloc --
3657 -------------------------------------
3659 procedure Write_Ureal_With_Col_Check_Sloc
(U
: Ureal
) is
3660 D
: constant Uint
:= Denominator
(U
);
3661 N
: constant Uint
:= Numerator
(U
);
3665 (UI_Decimal_Digits_Hi
(D
) + UI_Decimal_Digits_Hi
(N
) + 4);
3668 end Write_Ureal_With_Col_Check_Sloc
;