OSDN Git Service

2003-10-22 Arnaud Charlet <charlet@act-europe.fr>
[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-2003 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 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,  59 Temple Place - Suite 330,  Boston, --
20 -- MA 02111-1307, USA.                                                      --
21 --                                                                          --
22 -- GNAT was originally developed  by the GNAT team at  New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
24 --                                                                          --
25 ------------------------------------------------------------------------------
26
27 --  This package defines the structure of the Project File tree.
28
29 with GNAT.HTable;
30
31 with Prj.Attr; use Prj.Attr;
32 with Prj.Com;  use Prj.Com;
33 with Types;    use Types;
34 with Table;
35
36 package Prj.Tree is
37
38    Project_Nodes_Initial   : constant := 1_000;
39    Project_Nodes_Increment : constant := 100;
40    --  Allocation parameters for initializing and extending number
41    --  of nodes in table Tree_Private_Part.Project_Nodes
42
43    Project_Node_Low_Bound  : constant := 0;
44    Project_Node_High_Bound : constant := 099_999_999;
45    --  Range of values for project node id's (in practice infinite)
46
47    type Project_Node_Id is range
48      Project_Node_Low_Bound .. Project_Node_High_Bound;
49    --  The index of table Tree_Private_Part.Project_Nodes
50
51    Empty_Node : constant Project_Node_Id := Project_Node_Low_Bound;
52    --  Designates no node in table Project_Nodes
53
54    First_Node_Id : constant Project_Node_Id := Project_Node_Low_Bound + 1;
55
56    subtype Variable_Node_Id is Project_Node_Id;
57    --  Used to designate a node whose expected kind is one of
58    --  N_Typed_Variable_Declaration, N_Variable_Declaration or
59    --  N_Variable_Reference.
60
61    subtype Package_Declaration_Id is Project_Node_Id;
62    --  Used to designate a node whose expected kind is N_Proect_Declaration
63
64    type Project_Node_Kind is
65      (N_Project,
66       N_With_Clause,
67       N_Project_Declaration,
68       N_Declarative_Item,
69       N_Package_Declaration,
70       N_String_Type_Declaration,
71       N_Literal_String,
72       N_Attribute_Declaration,
73       N_Typed_Variable_Declaration,
74       N_Variable_Declaration,
75       N_Expression,
76       N_Term,
77       N_Literal_String_List,
78       N_Variable_Reference,
79       N_External_Value,
80       N_Attribute_Reference,
81       N_Case_Construction,
82       N_Case_Item);
83    --  Each node in the tree is of a Project_Node_Kind
84    --  For the signification of the fields in each node of a
85    --  Project_Node_Kind, look at package Tree_Private_Part.
86
87    procedure Initialize;
88    --  Initialize the Project File tree: empty the Project_Nodes table
89    --  and reset the Projects_Htable.
90
91    function Default_Project_Node
92      (Of_Kind       : Project_Node_Kind;
93       And_Expr_Kind : Variable_Kind := Undefined)
94       return          Project_Node_Id;
95    --  Returns a Project_Node_Record with the specified Kind and
96    --  Expr_Kind; all the other components have default nil values.
97
98    function Hash (N : Project_Node_Id) return Header_Num;
99    --  Used for hash tables where the key is a Project_Node_Id
100
101    function Imported_Or_Extended_Project_Of
102      (Project   : Project_Node_Id;
103       With_Name : Name_Id)
104       return      Project_Node_Id;
105    --  Return the node of a project imported or extended by project Project and
106    --  whose name is With_Name. Return Empty_Node if there is no such project.
107
108    ----------------------
109    -- Access Functions --
110    ----------------------
111
112    --  The following query functions are part of the abstract interface
113    --  of the Project File tree
114
115    function Name_Of (Node : Project_Node_Id) return Name_Id;
116    pragma Inline (Name_Of);
117    --  Valid for all non empty nodes. May return No_Name for nodes that have
118    --  no names.
119
120    function Kind_Of (Node : Project_Node_Id) return Project_Node_Kind;
121    pragma Inline (Kind_Of);
122    --  Valid for all non empty nodes
123
124    function Location_Of (Node : Project_Node_Id) return Source_Ptr;
125    pragma Inline (Location_Of);
126    --  Valid for all non empty nodes
127
128    function Directory_Of (Node : Project_Node_Id) return Name_Id;
129    pragma Inline (Directory_Of);
130    --  Only valid for N_Project nodes.
131
132    function Expression_Kind_Of (Node : Project_Node_Id) return Variable_Kind;
133    pragma Inline (Expression_Kind_Of);
134    --  Only valid for N_Literal_String, N_Attribute_Declaration,
135    --  N_Variable_Declaration, N_Typed_Variable_Declaration, N_Expression,
136    --  N_Term, N_Variable_Reference or N_Attribute_Reference nodes.
137
138    function First_Variable_Of
139      (Node  : Project_Node_Id)
140       return  Variable_Node_Id;
141    pragma Inline (First_Variable_Of);
142    --  Only valid for N_Project or N_Package_Declaration nodes
143
144    function First_Package_Of
145      (Node  : Project_Node_Id)
146       return  Package_Declaration_Id;
147    pragma Inline (First_Package_Of);
148    --  Only valid for N_Project nodes
149
150    function Package_Id_Of (Node  : Project_Node_Id) return Package_Node_Id;
151    pragma Inline (Package_Id_Of);
152    --  Only valid for N_Package_Declaration nodes
153
154    function Path_Name_Of (Node  : Project_Node_Id) return Name_Id;
155    pragma Inline (Path_Name_Of);
156    --  Only valid for N_Project and N_With_Clause nodes.
157
158    function String_Value_Of (Node  : Project_Node_Id) return Name_Id;
159    pragma Inline (String_Value_Of);
160    --  Only valid for N_With_Clause or N_Literal_String nodes.
161
162    function First_With_Clause_Of
163      (Node  : Project_Node_Id)
164       return  Project_Node_Id;
165    pragma Inline (First_With_Clause_Of);
166    --  Only valid for N_Project nodes
167
168    function Project_Declaration_Of
169      (Node  : Project_Node_Id)
170       return  Project_Node_Id;
171    pragma Inline (Project_Declaration_Of);
172    --  Only valid for N_Project nodes
173
174    function Extending_Project_Of
175      (Node  : Project_Node_Id)
176       return  Project_Node_Id;
177    pragma Inline (Extending_Project_Of);
178    --  Only valid for N_Project_Declaration nodes
179
180    function First_String_Type_Of
181      (Node  : Project_Node_Id)
182       return  Project_Node_Id;
183    pragma Inline (First_String_Type_Of);
184    --  Only valid for N_Project nodes
185
186    function Extended_Project_Path_Of
187      (Node  : Project_Node_Id)
188       return  Name_Id;
189    pragma Inline (Extended_Project_Path_Of);
190    --  Only valid for N_With_Clause nodes
191
192    function Project_Node_Of
193      (Node  : Project_Node_Id)
194       return  Project_Node_Id;
195    pragma Inline (Project_Node_Of);
196    --  Only valid for N_With_Clause, N_Variable_Reference and
197    --  N_Attribute_Reference nodes.
198
199    function Non_Limited_Project_Node_Of
200      (Node  : Project_Node_Id)
201       return  Project_Node_Id;
202    pragma Inline (Non_Limited_Project_Node_Of);
203    --  Only valid for N_With_Clause nodes. Returns Empty_Node for limited
204    --  imported project files, otherwise returns the same result as
205    --  Project_Node_Of.
206
207    function Next_With_Clause_Of
208      (Node  : Project_Node_Id)
209       return  Project_Node_Id;
210    pragma Inline (Next_With_Clause_Of);
211    --  Only valid for N_With_Clause nodes
212
213    function First_Declarative_Item_Of
214      (Node  : Project_Node_Id)
215       return  Project_Node_Id;
216    pragma Inline (First_Declarative_Item_Of);
217    --  Only valid for N_With_Clause nodes
218
219    function Extended_Project_Of
220      (Node  : Project_Node_Id)
221       return Project_Node_Id;
222    pragma Inline (Extended_Project_Of);
223    --  Only valid for N_With_Clause nodes
224
225    function Current_Item_Node
226      (Node  : Project_Node_Id)
227       return  Project_Node_Id;
228    pragma Inline (Current_Item_Node);
229    --  Only valid for N_Declarative_Item nodes
230
231    function Next_Declarative_Item
232      (Node  : Project_Node_Id)
233       return  Project_Node_Id;
234    pragma Inline (Next_Declarative_Item);
235    --  Only valid for N_Declarative_Item node
236
237    function Project_Of_Renamed_Package_Of
238      (Node  : Project_Node_Id)
239       return  Project_Node_Id;
240    pragma Inline (Project_Of_Renamed_Package_Of);
241    --  Only valid for N_Package_Declaration nodes.
242    --  May return Empty_Node.
243
244    function Next_Package_In_Project
245      (Node  : Project_Node_Id)
246       return  Project_Node_Id;
247    pragma Inline (Next_Package_In_Project);
248    --  Only valid for N_Package_Declaration nodes
249
250    function First_Literal_String
251      (Node  : Project_Node_Id)
252       return  Project_Node_Id;
253    pragma Inline (First_Literal_String);
254    --  Only valid for N_String_Type_Declaration nodes
255
256    function Next_String_Type
257      (Node  : Project_Node_Id)
258       return  Project_Node_Id;
259    pragma Inline (Next_String_Type);
260    --  Only valid for N_String_Type_Declaration nodes
261
262    function Next_Literal_String
263      (Node  : Project_Node_Id)
264       return  Project_Node_Id;
265    pragma Inline (Next_Literal_String);
266    --  Only valid for N_Literal_String nodes
267
268    function Expression_Of
269      (Node  : Project_Node_Id)
270       return  Project_Node_Id;
271    pragma Inline (Expression_Of);
272    --  Only valid for N_Attribute_Declaration, N_Typed_Variable_Declaration
273    --  or N_Variable_Declaration nodes
274
275    function Associative_Project_Of
276      (Node  : Project_Node_Id)
277       return  Project_Node_Id;
278    pragma Inline (Associative_Project_Of);
279    --  Only valid for N_Attribute_Declaration nodes
280
281    function Associative_Package_Of
282      (Node  : Project_Node_Id)
283       return  Project_Node_Id;
284    pragma Inline (Associative_Package_Of);
285    --  Only valid for N_Attribute_Declaration nodes
286
287    function Value_Is_Valid
288      (For_Typed_Variable : Project_Node_Id;
289       Value              : Name_Id)
290       return               Boolean;
291    pragma Inline (Value_Is_Valid);
292    --  Only valid for N_Typed_Variable_Declaration. Returns True if Value is
293    --  in the list of allowed strings for For_Typed_Variable. False otherwise.
294
295    function Associative_Array_Index_Of
296      (Node  : Project_Node_Id)
297       return  Name_Id;
298    pragma Inline (Associative_Array_Index_Of);
299    --  Only valid for N_Attribute_Declaration and N_Attribute_Reference.
300    --  Returns No_String for non associative array attributes.
301
302    function Next_Variable
303      (Node  : Project_Node_Id)
304       return  Project_Node_Id;
305    pragma Inline (Next_Variable);
306    --  Only valid for N_Typed_Variable_Declaration or N_Variable_Declaration
307    --  nodes.
308
309    function First_Term
310      (Node  : Project_Node_Id)
311       return  Project_Node_Id;
312    pragma Inline (First_Term);
313    --  Only valid for N_Expression nodes
314
315    function Next_Expression_In_List
316      (Node  : Project_Node_Id)
317       return  Project_Node_Id;
318    pragma Inline (Next_Expression_In_List);
319    --  Only valid for N_Expression nodes
320
321    function Current_Term
322      (Node  : Project_Node_Id)
323       return  Project_Node_Id;
324    pragma Inline (Current_Term);
325    --  Only valid for N_Term nodes
326
327    function Next_Term
328      (Node  : Project_Node_Id)
329       return  Project_Node_Id;
330    pragma Inline (Next_Term);
331    --  Only valid for N_Term nodes
332
333    function First_Expression_In_List
334      (Node  : Project_Node_Id)
335       return  Project_Node_Id;
336    pragma Inline (First_Expression_In_List);
337    --  Only valid for N_Literal_String_List nodes
338
339    function Package_Node_Of
340      (Node  : Project_Node_Id)
341       return  Project_Node_Id;
342    pragma Inline (Package_Node_Of);
343    --  Only valid for N_Variable_Reference or N_Attribute_Reference nodes.
344    --  May return Empty_Node.
345
346    function String_Type_Of
347      (Node  : Project_Node_Id)
348       return  Project_Node_Id;
349    pragma Inline (String_Type_Of);
350    --  Only valid for N_Variable_Reference or N_Typed_Variable_Declaration
351    --  nodes.
352
353    function External_Reference_Of
354      (Node  : Project_Node_Id)
355       return  Project_Node_Id;
356    pragma Inline (External_Reference_Of);
357    --  Only valid for N_External_Value nodes
358
359    function External_Default_Of
360      (Node  : Project_Node_Id)
361       return  Project_Node_Id;
362    pragma Inline (External_Default_Of);
363    --  Only valid for N_External_Value nodes
364
365    function Case_Variable_Reference_Of
366      (Node  : Project_Node_Id)
367       return  Project_Node_Id;
368    pragma Inline (Case_Variable_Reference_Of);
369    --  Only valid for N_Case_Construction nodes
370
371    function First_Case_Item_Of
372      (Node  : Project_Node_Id)
373       return  Project_Node_Id;
374    pragma Inline (First_Case_Item_Of);
375    --  Only valid for N_Case_Construction nodes
376
377    function First_Choice_Of
378      (Node  : Project_Node_Id)
379       return  Project_Node_Id;
380    pragma Inline (First_Choice_Of);
381    --  Return the first choice in a N_Case_Item, or Empty_Node if
382    --  this is when others.
383
384    function Next_Case_Item
385      (Node  : Project_Node_Id)
386       return  Project_Node_Id;
387    pragma Inline (Next_Case_Item);
388    --  Only valid for N_Case_Item nodes
389
390    function Case_Insensitive (Node : Project_Node_Id) return Boolean;
391    --  Only valid for N_Attribute_Declaration and N_Attribute_Reference nodes
392
393    --------------------
394    -- Set Procedures --
395    --------------------
396
397    --  The following procedures are part of the abstract interface of
398    --  the Project File tree.
399
400    --  Each Set_* procedure is valid only for the same Project_Node_Kind
401    --  nodes as the corresponding query function above.
402
403    procedure Set_Name_Of
404      (Node : Project_Node_Id;
405       To   : Name_Id);
406    pragma Inline (Set_Name_Of);
407
408    procedure Set_Kind_Of
409      (Node : Project_Node_Id;
410       To   : Project_Node_Kind);
411    pragma Inline (Set_Kind_Of);
412
413    procedure Set_Location_Of
414      (Node : Project_Node_Id;
415       To   : Source_Ptr);
416    pragma Inline (Set_Location_Of);
417
418    procedure Set_Directory_Of
419      (Node : Project_Node_Id;
420       To   : Name_Id);
421    pragma Inline (Set_Directory_Of);
422
423    procedure Set_Expression_Kind_Of
424      (Node : Project_Node_Id;
425       To   : Variable_Kind);
426    pragma Inline (Set_Expression_Kind_Of);
427
428    procedure Set_First_Variable_Of
429      (Node : Project_Node_Id;
430       To   : Variable_Node_Id);
431    pragma Inline (Set_First_Variable_Of);
432
433    procedure Set_First_Package_Of
434      (Node : Project_Node_Id;
435       To   : Package_Declaration_Id);
436    pragma Inline (Set_First_Package_Of);
437
438    procedure Set_Package_Id_Of
439      (Node : Project_Node_Id;
440       To   : Package_Node_Id);
441    pragma Inline (Set_Package_Id_Of);
442
443    procedure Set_Path_Name_Of
444      (Node : Project_Node_Id;
445       To   : Name_Id);
446    pragma Inline (Set_Path_Name_Of);
447
448    procedure Set_String_Value_Of
449      (Node : Project_Node_Id;
450       To   : Name_Id);
451    pragma Inline (Set_String_Value_Of);
452
453    procedure Set_First_With_Clause_Of
454      (Node : Project_Node_Id;
455       To   : Project_Node_Id);
456    pragma Inline (Set_First_With_Clause_Of);
457
458    procedure Set_Project_Declaration_Of
459      (Node : Project_Node_Id;
460       To   : Project_Node_Id);
461    pragma Inline (Set_Project_Declaration_Of);
462
463    procedure Set_Extending_Project_Of
464      (Node : Project_Node_Id;
465       To   : Project_Node_Id);
466    pragma Inline (Set_Extending_Project_Of);
467
468    procedure Set_First_String_Type_Of
469      (Node : Project_Node_Id;
470       To   : Project_Node_Id);
471    pragma Inline (Set_First_String_Type_Of);
472
473    procedure Set_Extended_Project_Path_Of
474      (Node : Project_Node_Id;
475       To   : Name_Id);
476    pragma Inline (Set_Extended_Project_Path_Of);
477
478    procedure Set_Project_Node_Of
479      (Node         : Project_Node_Id;
480       To           : Project_Node_Id;
481       Limited_With : Boolean := False);
482    pragma Inline (Set_Project_Node_Of);
483
484    procedure Set_Next_With_Clause_Of
485      (Node : Project_Node_Id;
486       To   : Project_Node_Id);
487    pragma Inline (Set_Next_With_Clause_Of);
488
489    procedure Set_First_Declarative_Item_Of
490      (Node : Project_Node_Id;
491       To   : Project_Node_Id);
492    pragma Inline (Set_First_Declarative_Item_Of);
493
494    procedure Set_Extended_Project_Of
495      (Node : Project_Node_Id;
496       To   : Project_Node_Id);
497    pragma Inline (Set_Extended_Project_Of);
498
499    procedure Set_Current_Item_Node
500      (Node : Project_Node_Id;
501       To   : Project_Node_Id);
502    pragma Inline (Set_Current_Item_Node);
503
504    procedure Set_Next_Declarative_Item
505      (Node : Project_Node_Id;
506       To   : Project_Node_Id);
507    pragma Inline (Set_Next_Declarative_Item);
508
509    procedure Set_Project_Of_Renamed_Package_Of
510      (Node : Project_Node_Id;
511       To   : Project_Node_Id);
512    pragma Inline (Set_Project_Of_Renamed_Package_Of);
513
514    procedure Set_Next_Package_In_Project
515      (Node : Project_Node_Id;
516       To   : Project_Node_Id);
517    pragma Inline (Set_Next_Package_In_Project);
518
519    procedure Set_First_Literal_String
520      (Node : Project_Node_Id;
521       To   : Project_Node_Id);
522    pragma Inline (Set_First_Literal_String);
523
524    procedure Set_Next_String_Type
525      (Node : Project_Node_Id;
526       To   : Project_Node_Id);
527    pragma Inline (Set_Next_String_Type);
528
529    procedure Set_Next_Literal_String
530      (Node : Project_Node_Id;
531       To   : Project_Node_Id);
532    pragma Inline (Set_Next_Literal_String);
533
534    procedure Set_Expression_Of
535      (Node : Project_Node_Id;
536       To   : Project_Node_Id);
537    pragma Inline (Set_Expression_Of);
538
539    procedure Set_Associative_Project_Of
540      (Node : Project_Node_Id;
541       To   : Project_Node_Id);
542    pragma Inline (Set_Associative_Project_Of);
543
544    procedure Set_Associative_Package_Of
545      (Node : Project_Node_Id;
546       To   : Project_Node_Id);
547    pragma Inline (Set_Associative_Package_Of);
548
549    procedure Set_Associative_Array_Index_Of
550      (Node : Project_Node_Id;
551       To   : Name_Id);
552    pragma Inline (Set_Associative_Array_Index_Of);
553
554    procedure Set_Next_Variable
555      (Node : Project_Node_Id;
556       To   : Project_Node_Id);
557    pragma Inline (Set_Next_Variable);
558
559    procedure Set_First_Term
560      (Node : Project_Node_Id;
561       To   : Project_Node_Id);
562    pragma Inline (Set_First_Term);
563
564    procedure Set_Next_Expression_In_List
565      (Node : Project_Node_Id;
566       To   : Project_Node_Id);
567    pragma Inline (Set_Next_Expression_In_List);
568
569    procedure Set_Current_Term
570      (Node : Project_Node_Id;
571       To   : Project_Node_Id);
572    pragma Inline (Set_Current_Term);
573
574    procedure Set_Next_Term
575      (Node : Project_Node_Id;
576       To   : Project_Node_Id);
577    pragma Inline (Set_Next_Term);
578
579    procedure Set_First_Expression_In_List
580      (Node : Project_Node_Id;
581       To   : Project_Node_Id);
582    pragma Inline (Set_First_Expression_In_List);
583
584    procedure Set_Package_Node_Of
585      (Node : Project_Node_Id;
586       To   : Project_Node_Id);
587    pragma Inline (Set_Package_Node_Of);
588
589    procedure Set_String_Type_Of
590      (Node : Project_Node_Id;
591       To   : Project_Node_Id);
592    pragma Inline (Set_String_Type_Of);
593
594    procedure Set_External_Reference_Of
595      (Node : Project_Node_Id;
596       To   : Project_Node_Id);
597    pragma Inline (Set_External_Reference_Of);
598
599    procedure Set_External_Default_Of
600      (Node : Project_Node_Id;
601       To   : Project_Node_Id);
602    pragma Inline (Set_External_Default_Of);
603
604    procedure Set_Case_Variable_Reference_Of
605      (Node : Project_Node_Id;
606       To   : Project_Node_Id);
607    pragma Inline (Set_Case_Variable_Reference_Of);
608
609    procedure Set_First_Case_Item_Of
610      (Node : Project_Node_Id;
611       To   : Project_Node_Id);
612    pragma Inline (Set_First_Case_Item_Of);
613
614    procedure Set_First_Choice_Of
615      (Node : Project_Node_Id;
616       To   : Project_Node_Id);
617    pragma Inline (Set_First_Choice_Of);
618
619    procedure Set_Next_Case_Item
620      (Node : Project_Node_Id;
621       To   : Project_Node_Id);
622    pragma Inline (Set_Next_Case_Item);
623
624    procedure Set_Case_Insensitive
625      (Node : Project_Node_Id;
626       To   : Boolean);
627
628    -------------------------------
629    -- Restricted Access Section --
630    -------------------------------
631
632    package Tree_Private_Part is
633
634       --  This is conceptually in the private part.
635       --  However, for efficiency, some packages are accessing it directly.
636
637       type Project_Node_Record is record
638
639          Kind : Project_Node_Kind;
640
641          Location : Source_Ptr := No_Location;
642
643          Directory : Name_Id       := No_Name;
644          --  Only for N_Project
645
646          Expr_Kind : Variable_Kind := Undefined;
647          --  See below for what Project_Node_Kind it is used
648
649          Variables : Variable_Node_Id := Empty_Node;
650          --  First variable in a project or a package
651
652          Packages : Package_Declaration_Id := Empty_Node;
653          --  First package declaration in a project
654
655          Pkg_Id : Package_Node_Id := Empty_Package;
656          --  Only used for N_Package_Declaration
657          --  The component Pkg_Id is an entry into the table Package_Attributes
658          --  (in Prj.Attr). It is used to indicate all the attributes of the
659          --  package with their characteristics.
660          --
661          --  The tables Prj.Attr.Attributes and Prj.Attr.Package_Attributes
662          --  are built once and for all through a call (from Prj.Initialize)
663          --  to procedure Prj.Attr.Initialize. It is never modified after that.
664
665          Name : Name_Id := No_Name;
666          --  See below for what Project_Node_Kind it is used
667
668          Path_Name : Name_Id := No_Name;
669          --  See below for what Project_Node_Kind it is used
670
671          Value : Name_Id := No_Name;
672          --  See below for what Project_Node_Kind it is used
673
674          Field1 : Project_Node_Id := Empty_Node;
675          --  See below the meaning for each Project_Node_Kind
676
677          Field2 : Project_Node_Id := Empty_Node;
678          --  See below the meaning for each Project_Node_Kind
679
680          Field3 : Project_Node_Id := Empty_Node;
681          --  See below the meaning for each Project_Node_Kind
682
683          Case_Insensitive : Boolean := False;
684          --  This flag is significant only for N_Attribute_Declaration and
685          --  N_Atribute_Reference. It indicates for an associative array
686          --  attribute, that the index is case insensitive.
687
688       end record;
689
690       --  type Project_Node_Kind is
691
692       --   (N_Project,
693       --    --  Name:      project name
694       --    --  Path_Name: project path name
695       --    --  Expr_Kind: Undefined
696       --    --  Field1:    first with clause
697       --    --  Field2:    project declaration
698       --    --  Field3:    first string type
699       --    --  Value:     extended project path name (if any)
700
701       --    N_With_Clause,
702       --    --  Name:      imported project name
703       --    --  Path_Name: imported project path name
704       --    --  Expr_Kind: Undefined
705       --    --  Field1:    project node
706       --    --  Field2:    next with clause
707       --    --  Field3:    project node or empty if "limited with"
708       --    --  Value:     literal string withed
709
710       --    N_Project_Declaration,
711       --    --  Name:      not used
712       --    --  Path_Name: not used
713       --    --  Expr_Kind: Undefined
714       --    --  Field1:    first declarative item
715       --    --  Field2:    extended project
716       --    --  Field3:    extending project
717       --    --  Value:     not used
718
719       --    N_Declarative_Item,
720       --    --  Name:      not used
721       --    --  Path_Name: not used
722       --    --  Expr_Kind: Undefined
723       --    --  Field1:    current item node
724       --    --  Field2:    next declarative item
725       --    --  Field3:    not used
726       --    --  Value:     not used
727
728       --    N_Package_Declaration,
729       --    --  Name:      package name
730       --    --  Path_Name: not used
731       --    --  Expr_Kind: Undefined
732       --    --  Field1:    project of renamed package (if any)
733       --    --  Field2:    first declarative item
734       --    --  Field3:    next package in project
735       --    --  Value:     not used
736
737       --    N_String_Type_Declaration,
738       --    --  Name:      type name
739       --    --  Path_Name: not used
740       --    --  Expr_Kind: Undefined
741       --    --  Field1:    first literal string
742       --    --  Field2:    next string type
743       --    --  Field3:    not used
744       --    --  Value:     not used
745
746       --    N_Literal_String,
747       --    --  Name:      not used
748       --    --  Path_Name: not used
749       --    --  Expr_Kind: Single
750       --    --  Field1:    next literal string
751       --    --  Field2:    not used
752       --    --  Field3:    not used
753       --    --  Value:     string value
754
755       --    N_Attribute_Declaration,
756       --    --  Name:      attribute name
757       --    --  Path_Name: not used
758       --    --  Expr_Kind: attribute kind
759       --    --  Field1:    expression
760       --    --  Field2:    project of full associative array
761       --    --  Field3:    package of full associative array
762       --    --  Value:     associative array index
763       --    --             (if an associative array element)
764
765       --    N_Typed_Variable_Declaration,
766       --    --  Name:      variable name
767       --    --  Path_Name: not used
768       --    --  Expr_Kind: Single
769       --    --  Field1:    expression
770       --    --  Field2:    type of variable (N_String_Type_Declaration)
771       --    --  Field3:    next variable
772       --    --  Value:     not used
773
774       --    N_Variable_Declaration,
775       --    --  Name:      variable name
776       --    --  Path_Name: not used
777       --    --  Expr_Kind: variable kind
778       --    --  Field1:    expression
779       --    --  Field2:    not used
780       --    --             Field3 is used for next variable, instead of Field2,
781       --    --             so that it is the same field for
782       --    --             N_Variable_Declaration and
783       --    --             N_Typed_Variable_Declaration
784       --    --  Field3:    next variable
785       --    --  Value:     not used
786
787       --    N_Expression,
788       --    --  Name:      not used
789       --    --  Path_Name: not used
790       --    --  Expr_Kind: expression kind
791       --    --  Field1:    first term
792       --    --  Field2:    next expression in list
793       --    --  Field3:    not used
794       --    --  Value:     not used
795
796       --    N_Term,
797       --    --  Name:      not used
798       --    --  Path_Name: not used
799       --    --  Expr_Kind: term kind
800       --    --  Field1:    current term
801       --    --  Field2:    next term in the expression
802       --    --  Field3:    not used
803       --    --  Value:     not used
804
805       --    N_Literal_String_List,
806       --    --  Designates a list of string expressions between brackets
807       --    --  separated by commas. The string expressions are not necessarily
808       --    --  literal strings.
809       --    --  Name:      not used
810       --    --  Path_Name: not used
811       --    --  Expr_Kind: List
812       --    --  Field1:    first expression
813       --    --  Field2:    not used
814       --    --  Field3:    not used
815       --    --  Value:     not used
816
817       --    N_Variable_Reference,
818       --    --  Name:      variable name
819       --    --  Path_Name: not used
820       --    --  Expr_Kind: variable kind
821       --    --  Field1:    project (if specified)
822       --    --  Field2:    package (if specified)
823       --    --  Field3:    type of variable (N_String_Type_Declaration), if any
824       --    --  Value:     not used
825
826       --    N_External_Value,
827       --    --  Name:      not used
828       --    --  Path_Name: not used
829       --    --  Expr_Kind: Single
830       --    --  Field1:    Name of the external reference (literal string)
831       --    --  Field2:    Default (literal string)
832       --    --  Field3:    not used
833       --    --  Value:     not used
834
835       --    N_Attribute_Reference,
836       --    --  Name:      attribute name
837       --    --  Path_Name: not used
838       --    --  Expr_Kind: attribute kind
839       --    --  Field1:    project
840       --    --  Field2:    package (if attribute of a package)
841       --    --  Field3:    not used
842       --    --  Value:     associative array index
843       --    --             (if an associative array element)
844
845       --    N_Case_Construction,
846       --    --  Name:      not used
847       --    --  Path_Name: not used
848       --    --  Expr_Kind: Undefined
849       --    --  Field1:    case variable reference
850       --    --  Field2:    first case item
851       --    --  Field3:    not used
852       --    --  Value:     not used
853
854       --    N_Case_Item);
855       --    --  Name:      not used
856       --    --  Path_Name: not used
857       --    --  Expr_Kind: not used
858       --    --  Field1:    first choice (literal string), or Empty_Node
859       --    --             for when others
860       --    --  Field2:    first declarative item
861       --    --  Field3:    next case item
862       --    --  Value:     not used
863
864       package Project_Nodes is
865          new Table.Table (Table_Component_Type => Project_Node_Record,
866                           Table_Index_Type     => Project_Node_Id,
867                           Table_Low_Bound      => First_Node_Id,
868                           Table_Initial        => Project_Nodes_Initial,
869                           Table_Increment      => Project_Nodes_Increment,
870                           Table_Name           => "Project_Nodes");
871       --  This table contains the syntactic tree of project data
872       --  from project files.
873
874       type Project_Name_And_Node is record
875          Name : Name_Id;
876          --  Name of the project
877
878          Node : Project_Node_Id;
879          --  Node of the project in table Project_Nodes
880
881          Extended : Boolean;
882          --  True when the project is being extended by another project
883       end record;
884
885       No_Project_Name_And_Node : constant Project_Name_And_Node :=
886         (Name => No_Name, Node => Empty_Node, Extended => True);
887
888       package Projects_Htable is new GNAT.HTable.Simple_HTable
889         (Header_Num => Header_Num,
890          Element    => Project_Name_And_Node,
891          No_Element => No_Project_Name_And_Node,
892          Key        => Name_Id,
893          Hash       => Hash,
894          Equal      => "=");
895       --  This hash table contains a mapping of project names to project nodes.
896       --  Note that this hash table contains only the nodes whose Kind is
897       --  N_Project. It is used to find the node of a project from its
898       --  name, and to verify if a project has already been parsed, knowing
899       --  its name.
900
901    end Tree_Private_Part;
902
903 end Prj.Tree;