OSDN Git Service

2009-04-15 Robert Dewar <dewar@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / prj-tree.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                              P R J . T R E E                             --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --          Copyright (C) 2001-2008, Free Software Foundation, Inc.         --
10 --                                                                          --
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.          --
20 --                                                                          --
21 -- GNAT was originally developed  by the GNAT team at  New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
23 --                                                                          --
24 ------------------------------------------------------------------------------
25
26 --  This package defines the structure of the Project File tree
27
28 with GNAT.Dynamic_HTables;
29 with GNAT.Dynamic_Tables;
30
31 with Table;
32
33 with Prj.Attr; use Prj.Attr;
34
35 package Prj.Tree is
36
37    type Project_Node_Tree_Data;
38    type Project_Node_Tree_Ref is access all Project_Node_Tree_Data;
39    --  Type to designate a project node tree, so that several project node
40    --  trees can coexist in memory.
41
42    Project_Nodes_Initial   : constant := 1_000;
43    Project_Nodes_Increment : constant := 100;
44    --  Allocation parameters for initializing and extending number
45    --  of nodes in table Tree_Private_Part.Project_Nodes
46
47    Project_Node_Low_Bound  : constant := 0;
48    Project_Node_High_Bound : constant := 099_999_999;
49    --  Range of values for project node id's (in practice infinite)
50
51    type Project_Node_Id is range
52      Project_Node_Low_Bound .. Project_Node_High_Bound;
53    --  The index of table Tree_Private_Part.Project_Nodes
54
55    Empty_Node : constant Project_Node_Id := Project_Node_Low_Bound;
56    --  Designates no node in table Project_Nodes
57
58    First_Node_Id : constant Project_Node_Id := Project_Node_Low_Bound + 1;
59
60    subtype Variable_Node_Id is Project_Node_Id;
61    --  Used to designate a node whose expected kind is one of
62    --  N_Typed_Variable_Declaration, N_Variable_Declaration or
63    --  N_Variable_Reference.
64
65    subtype Package_Declaration_Id is Project_Node_Id;
66    --  Used to designate a node whose expected kind is N_Project_Declaration
67
68    type Project_Node_Kind is
69      (N_Project,
70       N_With_Clause,
71       N_Project_Declaration,
72       N_Declarative_Item,
73       N_Package_Declaration,
74       N_String_Type_Declaration,
75       N_Literal_String,
76       N_Attribute_Declaration,
77       N_Typed_Variable_Declaration,
78       N_Variable_Declaration,
79       N_Expression,
80       N_Term,
81       N_Literal_String_List,
82       N_Variable_Reference,
83       N_External_Value,
84       N_Attribute_Reference,
85       N_Case_Construction,
86       N_Case_Item,
87       N_Comment_Zones,
88       N_Comment);
89    --  Each node in the tree is of a Project_Node_Kind. For the signification
90    --  of the fields in each node of Project_Node_Kind, look at package
91    --  Tree_Private_Part.
92
93    function Present (Node : Project_Node_Id) return Boolean;
94    pragma Inline (Present);
95    --  Return True iff Node /= Empty_Node
96
97    function No (Node : Project_Node_Id) return Boolean;
98    pragma Inline (No);
99    --  Return True iff Node = Empty_Node
100
101    procedure Initialize (Tree : Project_Node_Tree_Ref);
102    --  Initialize the Project File tree: empty the Project_Nodes table
103    --  and reset the Projects_Htable.
104
105    function Default_Project_Node
106      (In_Tree       : Project_Node_Tree_Ref;
107       Of_Kind       : Project_Node_Kind;
108       And_Expr_Kind : Variable_Kind := Undefined) return Project_Node_Id;
109    --  Returns a Project_Node_Record with the specified Kind and Expr_Kind. All
110    --  the other components have default nil values.
111
112    function Hash (N : Project_Node_Id) return Header_Num;
113    --  Used for hash tables where the key is a Project_Node_Id
114
115    function Imported_Or_Extended_Project_Of
116      (Project   : Project_Node_Id;
117       In_Tree   : Project_Node_Tree_Ref;
118       With_Name : Name_Id) return Project_Node_Id;
119    --  Return the node of a project imported or extended by project Project and
120    --  whose name is With_Name. Return Empty_Node if there is no such project.
121
122    --------------
123    -- Comments --
124    --------------
125
126    type Comment_State is private;
127    --  A type to store the values of several global variables related to
128    --  comments.
129
130    procedure Save (S : out Comment_State);
131    --  Save in variable S the comment state. Called before scanning a new
132    --  project file.
133
134    procedure Restore (S : Comment_State);
135    --  Restore the comment state to a previously saved value. Called after
136    --  scanning a project file.
137
138    procedure Reset_State;
139    --  Set the comment state to its initial value. Called before scanning a
140    --  new project file.
141
142    function There_Are_Unkept_Comments return Boolean;
143    --  Indicates that some of the comments in a project file could not be
144    --  stored in the parse tree.
145
146    procedure Set_Previous_Line_Node (To : Project_Node_Id);
147    --  Indicate the node on the previous line. If there are comments
148    --  immediately following this line, then they should be associated with
149    --  this node.
150
151    procedure Set_Previous_End_Node (To : Project_Node_Id);
152    --  Indicate that on the previous line the "end" belongs to node To.
153    --  If there are comments immediately following this "end" line, they
154    --  should be associated with this node.
155
156    procedure Set_End_Of_Line (To : Project_Node_Id);
157    --  Indicate the node on the current line. If there is an end of line
158    --  comment, then it should be associated with this node.
159
160    procedure Set_Next_End_Node (To : Project_Node_Id);
161    --  Put node To on the top of the end node stack. When an END line is found
162    --  with this node on the top of the end node stack, the comments, if any,
163    --  immediately preceding this "end" line will be associated with this node.
164
165    procedure Remove_Next_End_Node;
166    --  Remove the top of the end node stack
167
168    ------------------------
169    -- Comment Processing --
170    ------------------------
171
172    type Comment_Data is record
173       Value                     : Name_Id := No_Name;
174       Follows_Empty_Line        : Boolean := False;
175       Is_Followed_By_Empty_Line : Boolean := False;
176    end record;
177    --  Component type for Comments Table below
178
179    package Comments is new Table.Table
180      (Table_Component_Type => Comment_Data,
181       Table_Index_Type     => Natural,
182       Table_Low_Bound      => 1,
183       Table_Initial        => 10,
184       Table_Increment      => 100,
185       Table_Name           => "Prj.Tree.Comments");
186    --  A table to store the comments that may be stored is the tree
187
188    procedure Scan (In_Tree : Project_Node_Tree_Ref);
189    --  Scan the tokens and accumulate comments
190
191    type Comment_Location is
192      (Before, After, Before_End, After_End, End_Of_Line);
193    --  Used in call to Add_Comments below
194
195    procedure Add_Comments
196      (To      : Project_Node_Id;
197       In_Tree : Project_Node_Tree_Ref;
198       Where   : Comment_Location);
199    --  Add comments to this node
200
201    ----------------------
202    -- Access Functions --
203    ----------------------
204
205    --  The following query functions are part of the abstract interface
206    --  of the Project File tree. They provide access to fields of a project.
207
208    --  The access functions should be called only with valid arguments.
209    --  For each function the condition of validity is specified. If an access
210    --  function is called with invalid arguments, then exception
211    --  Assertion_Error is raised if assertions are enabled, otherwise the
212    --  behaviour is not defined and may result in a crash.
213
214    function Name_Of
215      (Node    : Project_Node_Id;
216       In_Tree : Project_Node_Tree_Ref) return Name_Id;
217    pragma Inline (Name_Of);
218    --  Valid for all non empty nodes. May return No_Name for nodes that have
219    --  no names.
220
221    function Kind_Of
222      (Node    : Project_Node_Id;
223       In_Tree : Project_Node_Tree_Ref) return Project_Node_Kind;
224    pragma Inline (Kind_Of);
225    --  Valid for all non empty nodes
226
227    function Location_Of
228      (Node    : Project_Node_Id;
229       In_Tree : Project_Node_Tree_Ref) return Source_Ptr;
230    pragma Inline (Location_Of);
231    --  Valid for all non empty nodes
232
233    function First_Comment_After
234      (Node    : Project_Node_Id;
235       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
236    --  Valid only for N_Comment_Zones nodes
237
238    function First_Comment_After_End
239      (Node    : Project_Node_Id;
240       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
241    --  Valid only for N_Comment_Zones nodes
242
243    function First_Comment_Before
244      (Node    : Project_Node_Id;
245       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
246    --  Valid only for N_Comment_Zones nodes
247
248    function First_Comment_Before_End
249      (Node    : Project_Node_Id;
250       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
251    --  Valid only for N_Comment_Zones nodes
252
253    function Next_Comment
254      (Node    : Project_Node_Id;
255       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
256    --  Valid only for N_Comment nodes
257
258    function End_Of_Line_Comment
259      (Node    : Project_Node_Id;
260       In_Tree : Project_Node_Tree_Ref) return Name_Id;
261    --  Valid only for non empty nodes
262
263    function Follows_Empty_Line
264      (Node    : Project_Node_Id;
265       In_Tree : Project_Node_Tree_Ref) return Boolean;
266    --  Valid only for N_Comment nodes
267
268    function Is_Followed_By_Empty_Line
269      (Node    : Project_Node_Id;
270       In_Tree : Project_Node_Tree_Ref) return Boolean;
271    --  Valid only for N_Comment nodes
272
273    function Parent_Project_Of
274      (Node    : Project_Node_Id;
275       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
276    pragma Inline (Parent_Project_Of);
277    --  Valid only for N_Project nodes
278
279    function Project_File_Includes_Unkept_Comments
280      (Node    : Project_Node_Id;
281       In_Tree : Project_Node_Tree_Ref) return Boolean;
282    --  Valid only for N_Project nodes
283
284    function Directory_Of
285      (Node    : Project_Node_Id;
286       In_Tree : Project_Node_Tree_Ref) return Path_Name_Type;
287    pragma Inline (Directory_Of);
288    --  Only valid for N_Project nodes
289
290    function Expression_Kind_Of
291      (Node    : Project_Node_Id;
292       In_Tree : Project_Node_Tree_Ref) return Variable_Kind;
293    pragma Inline (Expression_Kind_Of);
294    --  Only valid for N_Literal_String, N_Attribute_Declaration,
295    --  N_Variable_Declaration, N_Typed_Variable_Declaration, N_Expression,
296    --  N_Term, N_Variable_Reference or N_Attribute_Reference nodes.
297
298    function Is_Extending_All
299      (Node    : Project_Node_Id;
300       In_Tree : Project_Node_Tree_Ref) return Boolean;
301    pragma Inline (Is_Extending_All);
302    --  Only valid for N_Project and N_With_Clause
303
304    function Is_Not_Last_In_List
305      (Node    : Project_Node_Id;
306       In_Tree : Project_Node_Tree_Ref) return Boolean;
307    pragma Inline (Is_Not_Last_In_List);
308    --  Only valid for N_With_Clause
309
310    function First_Variable_Of
311      (Node    : Project_Node_Id;
312       In_Tree : Project_Node_Tree_Ref) return Variable_Node_Id;
313    pragma Inline (First_Variable_Of);
314    --  Only valid for N_Project or N_Package_Declaration nodes
315
316    function First_Package_Of
317      (Node    : Project_Node_Id;
318       In_Tree : Project_Node_Tree_Ref) return Package_Declaration_Id;
319    pragma Inline (First_Package_Of);
320    --  Only valid for N_Project nodes
321
322    function Package_Id_Of
323      (Node    : Project_Node_Id;
324       In_Tree : Project_Node_Tree_Ref) return Package_Node_Id;
325    pragma Inline (Package_Id_Of);
326    --  Only valid for N_Package_Declaration nodes
327
328    function Path_Name_Of
329      (Node    : Project_Node_Id;
330       In_Tree : Project_Node_Tree_Ref) return Path_Name_Type;
331    pragma Inline (Path_Name_Of);
332    --  Only valid for N_Project and N_With_Clause nodes
333
334    function String_Value_Of
335      (Node    : Project_Node_Id;
336       In_Tree : Project_Node_Tree_Ref) return Name_Id;
337    pragma Inline (String_Value_Of);
338    --  Only valid for N_With_Clause, N_Literal_String nodes or N_Comment.
339    --  For a N_With_Clause created automatically for a virtual extending
340    --  project, No_Name is returned.
341
342    function Source_Index_Of
343      (Node    : Project_Node_Id;
344       In_Tree : Project_Node_Tree_Ref) return Int;
345    pragma Inline (Source_Index_Of);
346    --  Only valid for N_Literal_String and N_Attribute_Declaration nodes
347
348    function First_With_Clause_Of
349      (Node    : Project_Node_Id;
350       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
351    pragma Inline (First_With_Clause_Of);
352    --  Only valid for N_Project nodes
353
354    function Project_Declaration_Of
355      (Node    : Project_Node_Id;
356       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
357    pragma Inline (Project_Declaration_Of);
358    --  Only valid for N_Project nodes
359
360    function Project_Qualifier_Of
361      (Node    : Project_Node_Id;
362       In_Tree : Project_Node_Tree_Ref) return Project_Qualifier;
363    pragma Inline (Project_Qualifier_Of);
364    --  Only valid for N_Project nodes
365
366    function Extending_Project_Of
367      (Node    : Project_Node_Id;
368       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
369    pragma Inline (Extending_Project_Of);
370    --  Only valid for N_Project_Declaration nodes
371
372    function First_String_Type_Of
373      (Node    : Project_Node_Id;
374       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
375    pragma Inline (First_String_Type_Of);
376    --  Only valid for N_Project nodes
377
378    function Extended_Project_Path_Of
379      (Node    : Project_Node_Id;
380       In_Tree : Project_Node_Tree_Ref) return Path_Name_Type;
381    pragma Inline (Extended_Project_Path_Of);
382    --  Only valid for N_With_Clause nodes
383
384    function Project_Node_Of
385      (Node    : Project_Node_Id;
386       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
387    pragma Inline (Project_Node_Of);
388    --  Only valid for N_With_Clause, N_Variable_Reference and
389    --  N_Attribute_Reference nodes.
390
391    function Non_Limited_Project_Node_Of
392      (Node    : Project_Node_Id;
393       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
394    pragma Inline (Non_Limited_Project_Node_Of);
395    --  Only valid for N_With_Clause nodes. Returns Empty_Node for limited
396    --  imported project files, otherwise returns the same result as
397    --  Project_Node_Of.
398
399    function Next_With_Clause_Of
400      (Node    : Project_Node_Id;
401       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
402    pragma Inline (Next_With_Clause_Of);
403    --  Only valid for N_With_Clause nodes
404
405    function First_Declarative_Item_Of
406      (Node    : Project_Node_Id;
407       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
408    pragma Inline (First_Declarative_Item_Of);
409    --  Only valid for N_With_Clause nodes
410
411    function Extended_Project_Of
412      (Node    : Project_Node_Id;
413       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
414    pragma Inline (Extended_Project_Of);
415    --  Only valid for N_Project_Declaration nodes
416
417    function Current_Item_Node
418      (Node    : Project_Node_Id;
419       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
420    pragma Inline (Current_Item_Node);
421    --  Only valid for N_Declarative_Item nodes
422
423    function Next_Declarative_Item
424      (Node    : Project_Node_Id;
425       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
426    pragma Inline (Next_Declarative_Item);
427    --  Only valid for N_Declarative_Item node
428
429    function Project_Of_Renamed_Package_Of
430      (Node    : Project_Node_Id;
431       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
432    pragma Inline (Project_Of_Renamed_Package_Of);
433    --  Only valid for N_Package_Declaration nodes.
434    --  May return Empty_Node.
435
436    function Next_Package_In_Project
437      (Node    : Project_Node_Id;
438       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
439    pragma Inline (Next_Package_In_Project);
440    --  Only valid for N_Package_Declaration nodes
441
442    function First_Literal_String
443      (Node    : Project_Node_Id;
444       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
445    pragma Inline (First_Literal_String);
446    --  Only valid for N_String_Type_Declaration nodes
447
448    function Next_String_Type
449      (Node    : Project_Node_Id;
450       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
451    pragma Inline (Next_String_Type);
452    --  Only valid for N_String_Type_Declaration nodes
453
454    function Next_Literal_String
455      (Node    : Project_Node_Id;
456       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
457    pragma Inline (Next_Literal_String);
458    --  Only valid for N_Literal_String nodes
459
460    function Expression_Of
461      (Node    : Project_Node_Id;
462       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
463    pragma Inline (Expression_Of);
464    --  Only valid for N_Attribute_Declaration, N_Typed_Variable_Declaration
465    --  or N_Variable_Declaration nodes
466
467    function Associative_Project_Of
468      (Node    : Project_Node_Id;
469       In_Tree : Project_Node_Tree_Ref)
470       return  Project_Node_Id;
471    pragma Inline (Associative_Project_Of);
472    --  Only valid for N_Attribute_Declaration nodes
473
474    function Associative_Package_Of
475      (Node    : Project_Node_Id;
476       In_Tree : Project_Node_Tree_Ref)
477       return  Project_Node_Id;
478    pragma Inline (Associative_Package_Of);
479    --  Only valid for N_Attribute_Declaration nodes
480
481    function Value_Is_Valid
482      (For_Typed_Variable : Project_Node_Id;
483       In_Tree            : Project_Node_Tree_Ref;
484       Value              : Name_Id) return Boolean;
485    pragma Inline (Value_Is_Valid);
486    --  Only valid for N_Typed_Variable_Declaration. Returns True if Value is
487    --  in the list of allowed strings for For_Typed_Variable. False otherwise.
488
489    function Associative_Array_Index_Of
490      (Node    : Project_Node_Id;
491       In_Tree : Project_Node_Tree_Ref) return Name_Id;
492    pragma Inline (Associative_Array_Index_Of);
493    --  Only valid for N_Attribute_Declaration and N_Attribute_Reference.
494    --  Returns No_String for non associative array attributes.
495
496    function Next_Variable
497      (Node    : Project_Node_Id;
498       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
499    pragma Inline (Next_Variable);
500    --  Only valid for N_Typed_Variable_Declaration or N_Variable_Declaration
501    --  nodes.
502
503    function First_Term
504      (Node    : Project_Node_Id;
505       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
506    pragma Inline (First_Term);
507    --  Only valid for N_Expression nodes
508
509    function Next_Expression_In_List
510      (Node    : Project_Node_Id;
511       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
512    pragma Inline (Next_Expression_In_List);
513    --  Only valid for N_Expression nodes
514
515    function Current_Term
516      (Node    : Project_Node_Id;
517       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
518    pragma Inline (Current_Term);
519    --  Only valid for N_Term nodes
520
521    function Next_Term
522      (Node    : Project_Node_Id;
523       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
524    pragma Inline (Next_Term);
525    --  Only valid for N_Term nodes
526
527    function First_Expression_In_List
528      (Node    : Project_Node_Id;
529       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
530    pragma Inline (First_Expression_In_List);
531    --  Only valid for N_Literal_String_List nodes
532
533    function Package_Node_Of
534      (Node    : Project_Node_Id;
535       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
536    pragma Inline (Package_Node_Of);
537    --  Only valid for N_Variable_Reference or N_Attribute_Reference nodes.
538    --  May return Empty_Node.
539
540    function String_Type_Of
541      (Node    : Project_Node_Id;
542       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
543    pragma Inline (String_Type_Of);
544    --  Only valid for N_Variable_Reference or N_Typed_Variable_Declaration
545    --  nodes.
546
547    function External_Reference_Of
548      (Node    : Project_Node_Id;
549       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
550    pragma Inline (External_Reference_Of);
551    --  Only valid for N_External_Value nodes
552
553    function External_Default_Of
554      (Node    : Project_Node_Id;
555       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
556    pragma Inline (External_Default_Of);
557    --  Only valid for N_External_Value nodes
558
559    function Case_Variable_Reference_Of
560      (Node    : Project_Node_Id;
561       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
562    pragma Inline (Case_Variable_Reference_Of);
563    --  Only valid for N_Case_Construction nodes
564
565    function First_Case_Item_Of
566      (Node    : Project_Node_Id;
567       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
568    pragma Inline (First_Case_Item_Of);
569    --  Only valid for N_Case_Construction nodes
570
571    function First_Choice_Of
572      (Node    : Project_Node_Id;
573       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
574    pragma Inline (First_Choice_Of);
575    --  Return the first choice in a N_Case_Item, or Empty_Node if
576    --  this is when others.
577
578    function Next_Case_Item
579      (Node    : Project_Node_Id;
580       In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
581    pragma Inline (Next_Case_Item);
582    --  Only valid for N_Case_Item nodes
583
584    function Case_Insensitive
585      (Node    : Project_Node_Id;
586       In_Tree : Project_Node_Tree_Ref) return Boolean;
587    --  Only valid for N_Attribute_Declaration and N_Attribute_Reference nodes
588
589    --------------------
590    -- Set Procedures --
591    --------------------
592
593    --  The following procedures are part of the abstract interface of
594    --  the Project File tree.
595
596    --  Each Set_* procedure is valid only for the same Project_Node_Kind
597    --  nodes as the corresponding query function above.
598
599    procedure Set_Name_Of
600      (Node    : Project_Node_Id;
601       In_Tree : Project_Node_Tree_Ref;
602       To      : Name_Id);
603    pragma Inline (Set_Name_Of);
604
605    procedure Set_Kind_Of
606      (Node    : Project_Node_Id;
607       In_Tree : Project_Node_Tree_Ref;
608       To      : Project_Node_Kind);
609    pragma Inline (Set_Kind_Of);
610
611    procedure Set_Location_Of
612      (Node    : Project_Node_Id;
613       In_Tree : Project_Node_Tree_Ref;
614       To      : Source_Ptr);
615    pragma Inline (Set_Location_Of);
616
617    procedure Set_First_Comment_After
618      (Node    : Project_Node_Id;
619       In_Tree : Project_Node_Tree_Ref;
620       To      : Project_Node_Id);
621    pragma Inline (Set_First_Comment_After);
622
623    procedure Set_First_Comment_After_End
624      (Node    : Project_Node_Id;
625       In_Tree : Project_Node_Tree_Ref;
626       To      : Project_Node_Id);
627    pragma Inline (Set_First_Comment_After_End);
628
629    procedure Set_First_Comment_Before
630      (Node    : Project_Node_Id;
631       In_Tree : Project_Node_Tree_Ref;
632       To      : Project_Node_Id);
633    pragma Inline (Set_First_Comment_Before);
634
635    procedure Set_First_Comment_Before_End
636      (Node    : Project_Node_Id;
637       In_Tree : Project_Node_Tree_Ref;
638       To      : Project_Node_Id);
639    pragma Inline (Set_First_Comment_Before_End);
640
641    procedure Set_Next_Comment
642      (Node    : Project_Node_Id;
643       In_Tree : Project_Node_Tree_Ref;
644       To      : Project_Node_Id);
645    pragma Inline (Set_Next_Comment);
646
647    procedure Set_Parent_Project_Of
648      (Node    : Project_Node_Id;
649       In_Tree : Project_Node_Tree_Ref;
650       To      : Project_Node_Id);
651
652    procedure Set_Project_File_Includes_Unkept_Comments
653      (Node    : Project_Node_Id;
654       In_Tree : Project_Node_Tree_Ref;
655       To      : Boolean);
656
657    procedure Set_Directory_Of
658      (Node    : Project_Node_Id;
659       In_Tree : Project_Node_Tree_Ref;
660       To      : Path_Name_Type);
661    pragma Inline (Set_Directory_Of);
662
663    procedure Set_Expression_Kind_Of
664      (Node    : Project_Node_Id;
665       In_Tree : Project_Node_Tree_Ref;
666       To      : Variable_Kind);
667    pragma Inline (Set_Expression_Kind_Of);
668
669    procedure Set_Is_Extending_All
670      (Node    : Project_Node_Id;
671       In_Tree : Project_Node_Tree_Ref);
672    pragma Inline (Set_Is_Extending_All);
673
674    procedure Set_Is_Not_Last_In_List
675      (Node    : Project_Node_Id;
676       In_Tree : Project_Node_Tree_Ref);
677    pragma Inline (Set_Is_Not_Last_In_List);
678
679    procedure Set_First_Variable_Of
680      (Node    : Project_Node_Id;
681       In_Tree : Project_Node_Tree_Ref;
682       To      : Variable_Node_Id);
683    pragma Inline (Set_First_Variable_Of);
684
685    procedure Set_First_Package_Of
686      (Node    : Project_Node_Id;
687       In_Tree : Project_Node_Tree_Ref;
688       To      : Package_Declaration_Id);
689    pragma Inline (Set_First_Package_Of);
690
691    procedure Set_Package_Id_Of
692      (Node    : Project_Node_Id;
693       In_Tree : Project_Node_Tree_Ref;
694       To      : Package_Node_Id);
695    pragma Inline (Set_Package_Id_Of);
696
697    procedure Set_Path_Name_Of
698      (Node    : Project_Node_Id;
699       In_Tree : Project_Node_Tree_Ref;
700       To      : Path_Name_Type);
701    pragma Inline (Set_Path_Name_Of);
702
703    procedure Set_String_Value_Of
704      (Node    : Project_Node_Id;
705       In_Tree : Project_Node_Tree_Ref;
706       To      : Name_Id);
707    pragma Inline (Set_String_Value_Of);
708
709    procedure Set_First_With_Clause_Of
710      (Node    : Project_Node_Id;
711       In_Tree : Project_Node_Tree_Ref;
712       To      : Project_Node_Id);
713    pragma Inline (Set_First_With_Clause_Of);
714
715    procedure Set_Project_Declaration_Of
716      (Node    : Project_Node_Id;
717       In_Tree : Project_Node_Tree_Ref;
718       To      : Project_Node_Id);
719    pragma Inline (Set_Project_Declaration_Of);
720
721    procedure Set_Project_Qualifier_Of
722      (Node    : Project_Node_Id;
723       In_Tree : Project_Node_Tree_Ref;
724       To      : Project_Qualifier);
725    pragma Inline (Set_Project_Qualifier_Of);
726
727    procedure Set_Extending_Project_Of
728      (Node    : Project_Node_Id;
729       In_Tree : Project_Node_Tree_Ref;
730       To      : Project_Node_Id);
731    pragma Inline (Set_Extending_Project_Of);
732
733    procedure Set_First_String_Type_Of
734      (Node    : Project_Node_Id;
735       In_Tree : Project_Node_Tree_Ref;
736       To      : Project_Node_Id);
737    pragma Inline (Set_First_String_Type_Of);
738
739    procedure Set_Extended_Project_Path_Of
740      (Node    : Project_Node_Id;
741       In_Tree : Project_Node_Tree_Ref;
742       To      : Path_Name_Type);
743    pragma Inline (Set_Extended_Project_Path_Of);
744
745    procedure Set_Project_Node_Of
746      (Node         : Project_Node_Id;
747       In_Tree      : Project_Node_Tree_Ref;
748       To           : Project_Node_Id;
749       Limited_With : Boolean := False);
750    pragma Inline (Set_Project_Node_Of);
751
752    procedure Set_Next_With_Clause_Of
753      (Node    : Project_Node_Id;
754       In_Tree : Project_Node_Tree_Ref;
755       To      : Project_Node_Id);
756    pragma Inline (Set_Next_With_Clause_Of);
757
758    procedure Set_First_Declarative_Item_Of
759      (Node    : Project_Node_Id;
760       In_Tree : Project_Node_Tree_Ref;
761       To      : Project_Node_Id);
762    pragma Inline (Set_First_Declarative_Item_Of);
763
764    procedure Set_Extended_Project_Of
765      (Node    : Project_Node_Id;
766       In_Tree : Project_Node_Tree_Ref;
767       To      : Project_Node_Id);
768    pragma Inline (Set_Extended_Project_Of);
769
770    procedure Set_Current_Item_Node
771      (Node    : Project_Node_Id;
772       In_Tree : Project_Node_Tree_Ref;
773       To      : Project_Node_Id);
774    pragma Inline (Set_Current_Item_Node);
775
776    procedure Set_Next_Declarative_Item
777      (Node    : Project_Node_Id;
778       In_Tree : Project_Node_Tree_Ref;
779       To      : Project_Node_Id);
780    pragma Inline (Set_Next_Declarative_Item);
781
782    procedure Set_Project_Of_Renamed_Package_Of
783      (Node    : Project_Node_Id;
784       In_Tree : Project_Node_Tree_Ref;
785       To      : Project_Node_Id);
786    pragma Inline (Set_Project_Of_Renamed_Package_Of);
787
788    procedure Set_Next_Package_In_Project
789      (Node    : Project_Node_Id;
790       In_Tree : Project_Node_Tree_Ref;
791       To      : Project_Node_Id);
792    pragma Inline (Set_Next_Package_In_Project);
793
794    procedure Set_First_Literal_String
795      (Node    : Project_Node_Id;
796       In_Tree : Project_Node_Tree_Ref;
797       To      : Project_Node_Id);
798    pragma Inline (Set_First_Literal_String);
799
800    procedure Set_Next_String_Type
801      (Node    : Project_Node_Id;
802       In_Tree : Project_Node_Tree_Ref;
803       To      : Project_Node_Id);
804    pragma Inline (Set_Next_String_Type);
805
806    procedure Set_Next_Literal_String
807      (Node    : Project_Node_Id;
808       In_Tree : Project_Node_Tree_Ref;
809       To      : Project_Node_Id);
810    pragma Inline (Set_Next_Literal_String);
811
812    procedure Set_Expression_Of
813      (Node    : Project_Node_Id;
814       In_Tree : Project_Node_Tree_Ref;
815       To      : Project_Node_Id);
816    pragma Inline (Set_Expression_Of);
817
818    procedure Set_Associative_Project_Of
819      (Node    : Project_Node_Id;
820       In_Tree : Project_Node_Tree_Ref;
821       To      : Project_Node_Id);
822    pragma Inline (Set_Associative_Project_Of);
823
824    procedure Set_Associative_Package_Of
825      (Node    : Project_Node_Id;
826       In_Tree : Project_Node_Tree_Ref;
827       To      : Project_Node_Id);
828    pragma Inline (Set_Associative_Package_Of);
829
830    procedure Set_Associative_Array_Index_Of
831      (Node    : Project_Node_Id;
832       In_Tree : Project_Node_Tree_Ref;
833       To      : Name_Id);
834    pragma Inline (Set_Associative_Array_Index_Of);
835
836    procedure Set_Next_Variable
837      (Node    : Project_Node_Id;
838       In_Tree : Project_Node_Tree_Ref;
839       To      : Project_Node_Id);
840    pragma Inline (Set_Next_Variable);
841
842    procedure Set_First_Term
843      (Node    : Project_Node_Id;
844       In_Tree : Project_Node_Tree_Ref;
845       To      : Project_Node_Id);
846    pragma Inline (Set_First_Term);
847
848    procedure Set_Next_Expression_In_List
849      (Node    : Project_Node_Id;
850       In_Tree : Project_Node_Tree_Ref;
851       To      : Project_Node_Id);
852    pragma Inline (Set_Next_Expression_In_List);
853
854    procedure Set_Current_Term
855      (Node    : Project_Node_Id;
856       In_Tree : Project_Node_Tree_Ref;
857       To      : Project_Node_Id);
858    pragma Inline (Set_Current_Term);
859
860    procedure Set_Next_Term
861      (Node    : Project_Node_Id;
862       In_Tree : Project_Node_Tree_Ref;
863       To      : Project_Node_Id);
864    pragma Inline (Set_Next_Term);
865
866    procedure Set_First_Expression_In_List
867      (Node    : Project_Node_Id;
868       In_Tree : Project_Node_Tree_Ref;
869       To      : Project_Node_Id);
870    pragma Inline (Set_First_Expression_In_List);
871
872    procedure Set_Package_Node_Of
873      (Node    : Project_Node_Id;
874       In_Tree : Project_Node_Tree_Ref;
875       To      : Project_Node_Id);
876    pragma Inline (Set_Package_Node_Of);
877
878    procedure Set_Source_Index_Of
879      (Node    : Project_Node_Id;
880       In_Tree : Project_Node_Tree_Ref;
881       To      : Int);
882    pragma Inline (Set_Source_Index_Of);
883
884    procedure Set_String_Type_Of
885      (Node    : Project_Node_Id;
886       In_Tree : Project_Node_Tree_Ref;
887       To      : Project_Node_Id);
888    pragma Inline (Set_String_Type_Of);
889
890    procedure Set_External_Reference_Of
891      (Node    : Project_Node_Id;
892       In_Tree : Project_Node_Tree_Ref;
893       To      : Project_Node_Id);
894    pragma Inline (Set_External_Reference_Of);
895
896    procedure Set_External_Default_Of
897      (Node    : Project_Node_Id;
898       In_Tree : Project_Node_Tree_Ref;
899       To      : Project_Node_Id);
900    pragma Inline (Set_External_Default_Of);
901
902    procedure Set_Case_Variable_Reference_Of
903      (Node    : Project_Node_Id;
904       In_Tree : Project_Node_Tree_Ref;
905       To      : Project_Node_Id);
906    pragma Inline (Set_Case_Variable_Reference_Of);
907
908    procedure Set_First_Case_Item_Of
909      (Node    : Project_Node_Id;
910       In_Tree : Project_Node_Tree_Ref;
911       To      : Project_Node_Id);
912    pragma Inline (Set_First_Case_Item_Of);
913
914    procedure Set_First_Choice_Of
915      (Node    : Project_Node_Id;
916       In_Tree : Project_Node_Tree_Ref;
917       To      : Project_Node_Id);
918    pragma Inline (Set_First_Choice_Of);
919
920    procedure Set_Next_Case_Item
921      (Node    : Project_Node_Id;
922       In_Tree : Project_Node_Tree_Ref;
923       To      : Project_Node_Id);
924    pragma Inline (Set_Next_Case_Item);
925
926    procedure Set_Case_Insensitive
927      (Node    : Project_Node_Id;
928       In_Tree : Project_Node_Tree_Ref;
929       To      : Boolean);
930
931    -------------------------------
932    -- Restricted Access Section --
933    -------------------------------
934
935    package Tree_Private_Part is
936
937       --  This is conceptually in the private part
938
939       --  However, for efficiency, some packages are accessing it directly
940
941       type Project_Node_Record is record
942
943          Kind : Project_Node_Kind;
944
945          Qualifier : Project_Qualifier := Unspecified;
946
947          Location : Source_Ptr := No_Location;
948
949          Directory : Path_Name_Type := No_Path;
950          --  Only for N_Project
951
952          Expr_Kind : Variable_Kind := Undefined;
953          --  See below for what Project_Node_Kind it is used
954
955          Variables : Variable_Node_Id := Empty_Node;
956          --  First variable in a project or a package
957
958          Packages : Package_Declaration_Id := Empty_Node;
959          --  First package declaration in a project
960
961          Pkg_Id : Package_Node_Id := Empty_Package;
962          --  Only used for N_Package_Declaration
963          --  The component Pkg_Id is an entry into the table Package_Attributes
964          --  (in Prj.Attr). It is used to indicate all the attributes of the
965          --  package with their characteristics.
966          --
967          --  The tables Prj.Attr.Attributes and Prj.Attr.Package_Attributes
968          --  are built once and for all through a call (from Prj.Initialize)
969          --  to procedure Prj.Attr.Initialize. It is never modified after that.
970
971          Name : Name_Id := No_Name;
972          --  See below for what Project_Node_Kind it is used
973
974          Src_Index : Int := 0;
975          --  Index of a unit in a multi-unit source.
976          --  Only for some N_Attribute_Declaration and N_Literal_String.
977
978          Path_Name : Path_Name_Type := No_Path;
979          --  See below for what Project_Node_Kind it is used
980
981          Value : Name_Id := No_Name;
982          --  See below for what Project_Node_Kind it is used
983
984          Field1 : Project_Node_Id := Empty_Node;
985          --  See below the meaning for each Project_Node_Kind
986
987          Field2 : Project_Node_Id := Empty_Node;
988          --  See below the meaning for each Project_Node_Kind
989
990          Field3 : Project_Node_Id := Empty_Node;
991          --  See below the meaning for each Project_Node_Kind
992
993          Field4 : Project_Node_Id := Empty_Node;
994          --  See below the meaning for each Project_Node_Kind
995
996          Flag1 : Boolean := False;
997          --  This flag is significant only for:
998          --    N_Attribute_Declaration and N_Attribute_Reference
999          --      It indicates for an associative array attribute, that the
1000          --      index is case insensitive.
1001          --    N_Comment - it indicates that the comment is preceded by an
1002          --                empty line.
1003          --    N_Project - it indicates that there are comments in the project
1004          --                source that cannot be kept in the tree.
1005          --    N_Project_Declaration
1006          --              - it indicates that there are unkept comments in the
1007          --                project.
1008          --    N_With_Clause
1009          --              - it indicates that this is not the last with in a
1010          --                with clause. It is set for "A", but not for "B" in
1011          --                    with "B";
1012          --                  and
1013          --                    with "A", "B";
1014
1015          Flag2 : Boolean := False;
1016          --  This flag is significant only for:
1017          --    N_Project - it indicates that the project "extends all" another
1018          --                project.
1019          --    N_Comment - it indicates that the comment is followed by an
1020          --                empty line.
1021          --    N_With_Clause
1022          --              - it indicates that the originally imported project
1023          --                is an extending all project.
1024
1025          Comments : Project_Node_Id := Empty_Node;
1026          --  For nodes other that N_Comment_Zones or N_Comment, designates the
1027          --  comment zones associated with the node.
1028          --  for N_Comment_Zones, designates the comment after the "end" of
1029          --  the construct.
1030          --  For N_Comment, designates the next comment, if any.
1031
1032       end record;
1033
1034       --  type Project_Node_Kind is
1035
1036       --   (N_Project,
1037       --    --  Name:      project name
1038       --    --  Path_Name: project path name
1039       --    --  Expr_Kind: Undefined
1040       --    --  Field1:    first with clause
1041       --    --  Field2:    project declaration
1042       --    --  Field3:    first string type
1043       --    --  Field4:    parent project, if any
1044       --    --  Value:     extended project path name (if any)
1045
1046       --    N_With_Clause,
1047       --    --  Name:      imported project name
1048       --    --  Path_Name: imported project path name
1049       --    --  Expr_Kind: Undefined
1050       --    --  Field1:    project node
1051       --    --  Field2:    next with clause
1052       --    --  Field3:    project node or empty if "limited with"
1053       --    --  Field4:    not used
1054       --    --  Value:     literal string withed
1055
1056       --    N_Project_Declaration,
1057       --    --  Name:      not used
1058       --    --  Path_Name: not used
1059       --    --  Expr_Kind: Undefined
1060       --    --  Field1:    first declarative item
1061       --    --  Field2:    extended project
1062       --    --  Field3:    extending project
1063       --    --  Field4:    not used
1064       --    --  Value:     not used
1065
1066       --    N_Declarative_Item,
1067       --    --  Name:      not used
1068       --    --  Path_Name: not used
1069       --    --  Expr_Kind: Undefined
1070       --    --  Field1:    current item node
1071       --    --  Field2:    next declarative item
1072       --    --  Field3:    not used
1073       --    --  Field4:    not used
1074       --    --  Value:     not used
1075
1076       --    N_Package_Declaration,
1077       --    --  Name:      package name
1078       --    --  Path_Name: not used
1079       --    --  Expr_Kind: Undefined
1080       --    --  Field1:    project of renamed package (if any)
1081       --    --  Field2:    first declarative item
1082       --    --  Field3:    next package in project
1083       --    --  Field4:    not used
1084       --    --  Value:     not used
1085
1086       --    N_String_Type_Declaration,
1087       --    --  Name:      type name
1088       --    --  Path_Name: not used
1089       --    --  Expr_Kind: Undefined
1090       --    --  Field1:    first literal string
1091       --    --  Field2:    next string type
1092       --    --  Field3:    not used
1093       --    --  Field4:    not used
1094       --    --  Value:     not used
1095
1096       --    N_Literal_String,
1097       --    --  Name:      not used
1098       --    --  Path_Name: not used
1099       --    --  Expr_Kind: Single
1100       --    --  Field1:    next literal string
1101       --    --  Field2:    not used
1102       --    --  Field3:    not used
1103       --    --  Field4:    not used
1104       --    --  Value:     string value
1105
1106       --    N_Attribute_Declaration,
1107       --    --  Name:      attribute name
1108       --    --  Path_Name: not used
1109       --    --  Expr_Kind: attribute kind
1110       --    --  Field1:    expression
1111       --    --  Field2:    project of full associative array
1112       --    --  Field3:    package of full associative array
1113       --    --  Field4:    not used
1114       --    --  Value:     associative array index
1115       --    --             (if an associative array element)
1116
1117       --    N_Typed_Variable_Declaration,
1118       --    --  Name:      variable name
1119       --    --  Path_Name: not used
1120       --    --  Expr_Kind: Single
1121       --    --  Field1:    expression
1122       --    --  Field2:    type of variable (N_String_Type_Declaration)
1123       --    --  Field3:    next variable
1124       --    --  Field4:    not used
1125       --    --  Value:     not used
1126
1127       --    N_Variable_Declaration,
1128       --    --  Name:      variable name
1129       --    --  Path_Name: not used
1130       --    --  Expr_Kind: variable kind
1131       --    --  Field1:    expression
1132       --    --  Field2:    not used
1133       --    --             Field3 is used for next variable, instead of Field2,
1134       --    --             so that it is the same field for
1135       --    --             N_Variable_Declaration and
1136       --    --             N_Typed_Variable_Declaration
1137       --    --  Field3:    next variable
1138       --    --  Field4:    not used
1139       --    --  Value:     not used
1140
1141       --    N_Expression,
1142       --    --  Name:      not used
1143       --    --  Path_Name: not used
1144       --    --  Expr_Kind: expression kind
1145       --    --  Field1:    first term
1146       --    --  Field2:    next expression in list
1147       --    --  Field3:    not used
1148       --    --  Value:     not used
1149
1150       --    N_Term,
1151       --    --  Name:      not used
1152       --    --  Path_Name: not used
1153       --    --  Expr_Kind: term kind
1154       --    --  Field1:    current term
1155       --    --  Field2:    next term in the expression
1156       --    --  Field3:    not used
1157       --    --  Field4:    not used
1158       --    --  Value:     not used
1159
1160       --    N_Literal_String_List,
1161       --    --  Designates a list of string expressions between brackets
1162       --    --  separated by commas. The string expressions are not necessarily
1163       --    --  literal strings.
1164       --    --  Name:      not used
1165       --    --  Path_Name: not used
1166       --    --  Expr_Kind: List
1167       --    --  Field1:    first expression
1168       --    --  Field2:    not used
1169       --    --  Field3:    not used
1170       --    --  Field4:    not used
1171       --    --  Value:     not used
1172
1173       --    N_Variable_Reference,
1174       --    --  Name:      variable name
1175       --    --  Path_Name: not used
1176       --    --  Expr_Kind: variable kind
1177       --    --  Field1:    project (if specified)
1178       --    --  Field2:    package (if specified)
1179       --    --  Field3:    type of variable (N_String_Type_Declaration), if any
1180       --    --  Field4:    not used
1181       --    --  Value:     not used
1182
1183       --    N_External_Value,
1184       --    --  Name:      not used
1185       --    --  Path_Name: not used
1186       --    --  Expr_Kind: Single
1187       --    --  Field1:    Name of the external reference (literal string)
1188       --    --  Field2:    Default (literal string)
1189       --    --  Field3:    not used
1190       --    --  Value:     not used
1191
1192       --    N_Attribute_Reference,
1193       --    --  Name:      attribute name
1194       --    --  Path_Name: not used
1195       --    --  Expr_Kind: attribute kind
1196       --    --  Field1:    project
1197       --    --  Field2:    package (if attribute of a package)
1198       --    --  Field3:    not used
1199       --    --  Field4:    not used
1200       --    --  Value:     associative array index
1201       --    --             (if an associative array element)
1202
1203       --    N_Case_Construction,
1204       --    --  Name:      not used
1205       --    --  Path_Name: not used
1206       --    --  Expr_Kind: Undefined
1207       --    --  Field1:    case variable reference
1208       --    --  Field2:    first case item
1209       --    --  Field3:    not used
1210       --    --  Field4:    not used
1211       --    --  Value:     not used
1212
1213       --    N_Case_Item
1214       --    --  Name:      not used
1215       --    --  Path_Name: not used
1216       --    --  Expr_Kind: not used
1217       --    --  Field1:    first choice (literal string), or Empty_Node
1218       --    --             for when others
1219       --    --  Field2:    first declarative item
1220       --    --  Field3:    next case item
1221       --    --  Field4:    not used
1222       --    --  Value:     not used
1223
1224       --    N_Comment_zones
1225       --    --  Name:      not used
1226       --    --  Path_Name: not used
1227       --    --  Expr_Kind: not used
1228       --    --  Field1:    comment before the construct
1229       --    --  Field2:    comment after the construct
1230       --    --  Field3:    comment before the "end" of the construct
1231       --    --  Value:     end of line comment
1232       --    --  Field4:    not used
1233       --    --  Comments:  comment after the "end" of the construct
1234
1235       --    N_Comment
1236       --    --  Name:      not used
1237       --    --  Path_Name: not used
1238       --    --  Expr_Kind: not used
1239       --    --  Field1:    not used
1240       --    --  Field2:    not used
1241       --    --  Field3:    not used
1242       --    --  Field4:    not used
1243       --    --  Value:     comment
1244       --    --  Flag1:     comment is preceded by an empty line
1245       --    --  Flag2:     comment is followed by an empty line
1246       --    --  Comments:  next comment
1247
1248       package Project_Node_Table is
1249         new GNAT.Dynamic_Tables
1250           (Table_Component_Type => Project_Node_Record,
1251            Table_Index_Type     => Project_Node_Id,
1252            Table_Low_Bound      => First_Node_Id,
1253            Table_Initial        => Project_Nodes_Initial,
1254            Table_Increment      => Project_Nodes_Increment);
1255       --  This table contains the syntactic tree of project data
1256       --  from project files.
1257
1258       type Project_Name_And_Node is record
1259          Name : Name_Id;
1260          --  Name of the project
1261
1262          Node : Project_Node_Id;
1263          --  Node of the project in table Project_Nodes
1264
1265          Canonical_Path : Path_Name_Type;
1266          --  Resolved and canonical path of a real project file.
1267          --  No_Name in case of virtual projects.
1268
1269          Extended : Boolean;
1270          --  True when the project is being extended by another project
1271
1272          Proj_Qualifier : Project_Qualifier;
1273          --  The project qualifier of the project, if any
1274       end record;
1275
1276       No_Project_Name_And_Node : constant Project_Name_And_Node :=
1277         (Name           => No_Name,
1278          Node           => Empty_Node,
1279          Canonical_Path => No_Path,
1280          Extended       => True,
1281          Proj_Qualifier => Unspecified);
1282
1283       package Projects_Htable is new GNAT.Dynamic_HTables.Simple_HTable
1284         (Header_Num => Header_Num,
1285          Element    => Project_Name_And_Node,
1286          No_Element => No_Project_Name_And_Node,
1287          Key        => Name_Id,
1288          Hash       => Hash,
1289          Equal      => "=");
1290       --  This hash table contains a mapping of project names to project nodes.
1291       --  Note that this hash table contains only the nodes whose Kind is
1292       --  N_Project. It is used to find the node of a project from its name,
1293       --  and to verify if a project has already been parsed, knowing its name.
1294
1295    end Tree_Private_Part;
1296
1297    type Project_Node_Tree_Data is record
1298       Project_Nodes : Tree_Private_Part.Project_Node_Table.Instance;
1299       Projects_HT   : Tree_Private_Part.Projects_Htable.Instance;
1300    end record;
1301    --  The data for a project node tree
1302
1303    procedure Free (Prj : in out Project_Node_Tree_Ref);
1304    --  Free memory used by Prj
1305
1306 private
1307    type Comment_Array is array (Positive range <>) of Comment_Data;
1308    type Comments_Ptr is access Comment_Array;
1309
1310    type Comment_State is record
1311       End_Of_Line_Node   : Project_Node_Id := Empty_Node;
1312
1313       Previous_Line_Node : Project_Node_Id := Empty_Node;
1314
1315       Previous_End_Node  : Project_Node_Id := Empty_Node;
1316
1317       Unkept_Comments    : Boolean := False;
1318
1319       Comments           : Comments_Ptr := null;
1320    end record;
1321
1322 end Prj.Tree;