1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 2001-2003 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, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, 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 -- This package defines the structure of the Project File tree.
31 with Prj.Attr; use Prj.Attr;
32 with Prj.Com; use Prj.Com;
33 with Types; use Types;
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
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)
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
51 Empty_Node : constant Project_Node_Id := Project_Node_Low_Bound;
52 -- Designates no node in table Project_Nodes
54 First_Node_Id : constant Project_Node_Id := Project_Node_Low_Bound + 1;
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.
61 subtype Package_Declaration_Id is Project_Node_Id;
62 -- Used to designate a node whose expected kind is N_Proect_Declaration
64 type Project_Node_Kind is
67 N_Project_Declaration,
69 N_Package_Declaration,
70 N_String_Type_Declaration,
72 N_Attribute_Declaration,
73 N_Typed_Variable_Declaration,
74 N_Variable_Declaration,
77 N_Literal_String_List,
80 N_Attribute_Reference,
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.
88 -- Initialize the Project File tree: empty the Project_Nodes table
89 -- and reset the Projects_Htable.
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.
98 function Hash (N : Project_Node_Id) return Header_Num;
99 -- Used for hash tables where the key is a Project_Node_Id
101 function Imported_Or_Extended_Project_Of
102 (Project : Project_Node_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.
108 ----------------------
109 -- Access Functions --
110 ----------------------
112 -- The following query functions are part of the abstract interface
113 -- of the Project File tree
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
120 function Kind_Of (Node : Project_Node_Id) return Project_Node_Kind;
121 pragma Inline (Kind_Of);
122 -- Valid for all non empty nodes
124 function Location_Of (Node : Project_Node_Id) return Source_Ptr;
125 pragma Inline (Location_Of);
126 -- Valid for all non empty nodes
128 function Directory_Of (Node : Project_Node_Id) return Name_Id;
129 pragma Inline (Directory_Of);
130 -- Only valid for N_Project nodes.
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.
138 function Is_Extending_All (Node : Project_Node_Id) return Boolean;
139 pragma Inline (Is_Extending_All);
140 -- Only valid for N_Project
142 function First_Variable_Of
143 (Node : Project_Node_Id)
144 return Variable_Node_Id;
145 pragma Inline (First_Variable_Of);
146 -- Only valid for N_Project or N_Package_Declaration nodes
148 function First_Package_Of
149 (Node : Project_Node_Id)
150 return Package_Declaration_Id;
151 pragma Inline (First_Package_Of);
152 -- Only valid for N_Project nodes
154 function Package_Id_Of (Node : Project_Node_Id) return Package_Node_Id;
155 pragma Inline (Package_Id_Of);
156 -- Only valid for N_Package_Declaration nodes
158 function Path_Name_Of (Node : Project_Node_Id) return Name_Id;
159 pragma Inline (Path_Name_Of);
160 -- Only valid for N_Project and N_With_Clause nodes.
162 function String_Value_Of (Node : Project_Node_Id) return Name_Id;
163 pragma Inline (String_Value_Of);
164 -- Only valid for N_With_Clause or N_Literal_String nodes.
166 function First_With_Clause_Of
167 (Node : Project_Node_Id)
168 return Project_Node_Id;
169 pragma Inline (First_With_Clause_Of);
170 -- Only valid for N_Project nodes
172 function Project_Declaration_Of
173 (Node : Project_Node_Id)
174 return Project_Node_Id;
175 pragma Inline (Project_Declaration_Of);
176 -- Only valid for N_Project nodes
178 function Extending_Project_Of
179 (Node : Project_Node_Id)
180 return Project_Node_Id;
181 pragma Inline (Extending_Project_Of);
182 -- Only valid for N_Project_Declaration nodes
184 function First_String_Type_Of
185 (Node : Project_Node_Id)
186 return Project_Node_Id;
187 pragma Inline (First_String_Type_Of);
188 -- Only valid for N_Project nodes
190 function Extended_Project_Path_Of
191 (Node : Project_Node_Id)
193 pragma Inline (Extended_Project_Path_Of);
194 -- Only valid for N_With_Clause nodes
196 function Project_Node_Of
197 (Node : Project_Node_Id)
198 return Project_Node_Id;
199 pragma Inline (Project_Node_Of);
200 -- Only valid for N_With_Clause, N_Variable_Reference and
201 -- N_Attribute_Reference nodes.
203 function Non_Limited_Project_Node_Of
204 (Node : Project_Node_Id)
205 return Project_Node_Id;
206 pragma Inline (Non_Limited_Project_Node_Of);
207 -- Only valid for N_With_Clause nodes. Returns Empty_Node for limited
208 -- imported project files, otherwise returns the same result as
211 function Next_With_Clause_Of
212 (Node : Project_Node_Id)
213 return Project_Node_Id;
214 pragma Inline (Next_With_Clause_Of);
215 -- Only valid for N_With_Clause nodes
217 function First_Declarative_Item_Of
218 (Node : Project_Node_Id)
219 return Project_Node_Id;
220 pragma Inline (First_Declarative_Item_Of);
221 -- Only valid for N_With_Clause nodes
223 function Extended_Project_Of
224 (Node : Project_Node_Id)
225 return Project_Node_Id;
226 pragma Inline (Extended_Project_Of);
227 -- Only valid for N_Project_Declaration nodes
229 function Current_Item_Node
230 (Node : Project_Node_Id)
231 return Project_Node_Id;
232 pragma Inline (Current_Item_Node);
233 -- Only valid for N_Declarative_Item nodes
235 function Next_Declarative_Item
236 (Node : Project_Node_Id)
237 return Project_Node_Id;
238 pragma Inline (Next_Declarative_Item);
239 -- Only valid for N_Declarative_Item node
241 function Project_Of_Renamed_Package_Of
242 (Node : Project_Node_Id)
243 return Project_Node_Id;
244 pragma Inline (Project_Of_Renamed_Package_Of);
245 -- Only valid for N_Package_Declaration nodes.
246 -- May return Empty_Node.
248 function Next_Package_In_Project
249 (Node : Project_Node_Id)
250 return Project_Node_Id;
251 pragma Inline (Next_Package_In_Project);
252 -- Only valid for N_Package_Declaration nodes
254 function First_Literal_String
255 (Node : Project_Node_Id)
256 return Project_Node_Id;
257 pragma Inline (First_Literal_String);
258 -- Only valid for N_String_Type_Declaration nodes
260 function Next_String_Type
261 (Node : Project_Node_Id)
262 return Project_Node_Id;
263 pragma Inline (Next_String_Type);
264 -- Only valid for N_String_Type_Declaration nodes
266 function Next_Literal_String
267 (Node : Project_Node_Id)
268 return Project_Node_Id;
269 pragma Inline (Next_Literal_String);
270 -- Only valid for N_Literal_String nodes
272 function Expression_Of
273 (Node : Project_Node_Id)
274 return Project_Node_Id;
275 pragma Inline (Expression_Of);
276 -- Only valid for N_Attribute_Declaration, N_Typed_Variable_Declaration
277 -- or N_Variable_Declaration nodes
279 function Associative_Project_Of
280 (Node : Project_Node_Id)
281 return Project_Node_Id;
282 pragma Inline (Associative_Project_Of);
283 -- Only valid for N_Attribute_Declaration nodes
285 function Associative_Package_Of
286 (Node : Project_Node_Id)
287 return Project_Node_Id;
288 pragma Inline (Associative_Package_Of);
289 -- Only valid for N_Attribute_Declaration nodes
291 function Value_Is_Valid
292 (For_Typed_Variable : Project_Node_Id;
295 pragma Inline (Value_Is_Valid);
296 -- Only valid for N_Typed_Variable_Declaration. Returns True if Value is
297 -- in the list of allowed strings for For_Typed_Variable. False otherwise.
299 function Associative_Array_Index_Of
300 (Node : Project_Node_Id)
302 pragma Inline (Associative_Array_Index_Of);
303 -- Only valid for N_Attribute_Declaration and N_Attribute_Reference.
304 -- Returns No_String for non associative array attributes.
306 function Next_Variable
307 (Node : Project_Node_Id)
308 return Project_Node_Id;
309 pragma Inline (Next_Variable);
310 -- Only valid for N_Typed_Variable_Declaration or N_Variable_Declaration
314 (Node : Project_Node_Id)
315 return Project_Node_Id;
316 pragma Inline (First_Term);
317 -- Only valid for N_Expression nodes
319 function Next_Expression_In_List
320 (Node : Project_Node_Id)
321 return Project_Node_Id;
322 pragma Inline (Next_Expression_In_List);
323 -- Only valid for N_Expression nodes
325 function Current_Term
326 (Node : Project_Node_Id)
327 return Project_Node_Id;
328 pragma Inline (Current_Term);
329 -- Only valid for N_Term nodes
332 (Node : Project_Node_Id)
333 return Project_Node_Id;
334 pragma Inline (Next_Term);
335 -- Only valid for N_Term nodes
337 function First_Expression_In_List
338 (Node : Project_Node_Id)
339 return Project_Node_Id;
340 pragma Inline (First_Expression_In_List);
341 -- Only valid for N_Literal_String_List nodes
343 function Package_Node_Of
344 (Node : Project_Node_Id)
345 return Project_Node_Id;
346 pragma Inline (Package_Node_Of);
347 -- Only valid for N_Variable_Reference or N_Attribute_Reference nodes.
348 -- May return Empty_Node.
350 function String_Type_Of
351 (Node : Project_Node_Id)
352 return Project_Node_Id;
353 pragma Inline (String_Type_Of);
354 -- Only valid for N_Variable_Reference or N_Typed_Variable_Declaration
357 function External_Reference_Of
358 (Node : Project_Node_Id)
359 return Project_Node_Id;
360 pragma Inline (External_Reference_Of);
361 -- Only valid for N_External_Value nodes
363 function External_Default_Of
364 (Node : Project_Node_Id)
365 return Project_Node_Id;
366 pragma Inline (External_Default_Of);
367 -- Only valid for N_External_Value nodes
369 function Case_Variable_Reference_Of
370 (Node : Project_Node_Id)
371 return Project_Node_Id;
372 pragma Inline (Case_Variable_Reference_Of);
373 -- Only valid for N_Case_Construction nodes
375 function First_Case_Item_Of
376 (Node : Project_Node_Id)
377 return Project_Node_Id;
378 pragma Inline (First_Case_Item_Of);
379 -- Only valid for N_Case_Construction nodes
381 function First_Choice_Of
382 (Node : Project_Node_Id)
383 return Project_Node_Id;
384 pragma Inline (First_Choice_Of);
385 -- Return the first choice in a N_Case_Item, or Empty_Node if
386 -- this is when others.
388 function Next_Case_Item
389 (Node : Project_Node_Id)
390 return Project_Node_Id;
391 pragma Inline (Next_Case_Item);
392 -- Only valid for N_Case_Item nodes
394 function Case_Insensitive (Node : Project_Node_Id) return Boolean;
395 -- Only valid for N_Attribute_Declaration and N_Attribute_Reference nodes
401 -- The following procedures are part of the abstract interface of
402 -- the Project File tree.
404 -- Each Set_* procedure is valid only for the same Project_Node_Kind
405 -- nodes as the corresponding query function above.
407 procedure Set_Name_Of
408 (Node : Project_Node_Id;
410 pragma Inline (Set_Name_Of);
412 procedure Set_Kind_Of
413 (Node : Project_Node_Id;
414 To : Project_Node_Kind);
415 pragma Inline (Set_Kind_Of);
417 procedure Set_Location_Of
418 (Node : Project_Node_Id;
420 pragma Inline (Set_Location_Of);
422 procedure Set_Directory_Of
423 (Node : Project_Node_Id;
425 pragma Inline (Set_Directory_Of);
427 procedure Set_Expression_Kind_Of
428 (Node : Project_Node_Id;
430 pragma Inline (Set_Expression_Kind_Of);
432 procedure Set_Is_Extending_All (Node : Project_Node_Id);
433 pragma Inline (Set_Is_Extending_All);
435 procedure Set_First_Variable_Of
436 (Node : Project_Node_Id;
437 To : Variable_Node_Id);
438 pragma Inline (Set_First_Variable_Of);
440 procedure Set_First_Package_Of
441 (Node : Project_Node_Id;
442 To : Package_Declaration_Id);
443 pragma Inline (Set_First_Package_Of);
445 procedure Set_Package_Id_Of
446 (Node : Project_Node_Id;
447 To : Package_Node_Id);
448 pragma Inline (Set_Package_Id_Of);
450 procedure Set_Path_Name_Of
451 (Node : Project_Node_Id;
453 pragma Inline (Set_Path_Name_Of);
455 procedure Set_String_Value_Of
456 (Node : Project_Node_Id;
458 pragma Inline (Set_String_Value_Of);
460 procedure Set_First_With_Clause_Of
461 (Node : Project_Node_Id;
462 To : Project_Node_Id);
463 pragma Inline (Set_First_With_Clause_Of);
465 procedure Set_Project_Declaration_Of
466 (Node : Project_Node_Id;
467 To : Project_Node_Id);
468 pragma Inline (Set_Project_Declaration_Of);
470 procedure Set_Extending_Project_Of
471 (Node : Project_Node_Id;
472 To : Project_Node_Id);
473 pragma Inline (Set_Extending_Project_Of);
475 procedure Set_First_String_Type_Of
476 (Node : Project_Node_Id;
477 To : Project_Node_Id);
478 pragma Inline (Set_First_String_Type_Of);
480 procedure Set_Extended_Project_Path_Of
481 (Node : Project_Node_Id;
483 pragma Inline (Set_Extended_Project_Path_Of);
485 procedure Set_Project_Node_Of
486 (Node : Project_Node_Id;
487 To : Project_Node_Id;
488 Limited_With : Boolean := False);
489 pragma Inline (Set_Project_Node_Of);
491 procedure Set_Next_With_Clause_Of
492 (Node : Project_Node_Id;
493 To : Project_Node_Id);
494 pragma Inline (Set_Next_With_Clause_Of);
496 procedure Set_First_Declarative_Item_Of
497 (Node : Project_Node_Id;
498 To : Project_Node_Id);
499 pragma Inline (Set_First_Declarative_Item_Of);
501 procedure Set_Extended_Project_Of
502 (Node : Project_Node_Id;
503 To : Project_Node_Id);
504 pragma Inline (Set_Extended_Project_Of);
506 procedure Set_Current_Item_Node
507 (Node : Project_Node_Id;
508 To : Project_Node_Id);
509 pragma Inline (Set_Current_Item_Node);
511 procedure Set_Next_Declarative_Item
512 (Node : Project_Node_Id;
513 To : Project_Node_Id);
514 pragma Inline (Set_Next_Declarative_Item);
516 procedure Set_Project_Of_Renamed_Package_Of
517 (Node : Project_Node_Id;
518 To : Project_Node_Id);
519 pragma Inline (Set_Project_Of_Renamed_Package_Of);
521 procedure Set_Next_Package_In_Project
522 (Node : Project_Node_Id;
523 To : Project_Node_Id);
524 pragma Inline (Set_Next_Package_In_Project);
526 procedure Set_First_Literal_String
527 (Node : Project_Node_Id;
528 To : Project_Node_Id);
529 pragma Inline (Set_First_Literal_String);
531 procedure Set_Next_String_Type
532 (Node : Project_Node_Id;
533 To : Project_Node_Id);
534 pragma Inline (Set_Next_String_Type);
536 procedure Set_Next_Literal_String
537 (Node : Project_Node_Id;
538 To : Project_Node_Id);
539 pragma Inline (Set_Next_Literal_String);
541 procedure Set_Expression_Of
542 (Node : Project_Node_Id;
543 To : Project_Node_Id);
544 pragma Inline (Set_Expression_Of);
546 procedure Set_Associative_Project_Of
547 (Node : Project_Node_Id;
548 To : Project_Node_Id);
549 pragma Inline (Set_Associative_Project_Of);
551 procedure Set_Associative_Package_Of
552 (Node : Project_Node_Id;
553 To : Project_Node_Id);
554 pragma Inline (Set_Associative_Package_Of);
556 procedure Set_Associative_Array_Index_Of
557 (Node : Project_Node_Id;
559 pragma Inline (Set_Associative_Array_Index_Of);
561 procedure Set_Next_Variable
562 (Node : Project_Node_Id;
563 To : Project_Node_Id);
564 pragma Inline (Set_Next_Variable);
566 procedure Set_First_Term
567 (Node : Project_Node_Id;
568 To : Project_Node_Id);
569 pragma Inline (Set_First_Term);
571 procedure Set_Next_Expression_In_List
572 (Node : Project_Node_Id;
573 To : Project_Node_Id);
574 pragma Inline (Set_Next_Expression_In_List);
576 procedure Set_Current_Term
577 (Node : Project_Node_Id;
578 To : Project_Node_Id);
579 pragma Inline (Set_Current_Term);
581 procedure Set_Next_Term
582 (Node : Project_Node_Id;
583 To : Project_Node_Id);
584 pragma Inline (Set_Next_Term);
586 procedure Set_First_Expression_In_List
587 (Node : Project_Node_Id;
588 To : Project_Node_Id);
589 pragma Inline (Set_First_Expression_In_List);
591 procedure Set_Package_Node_Of
592 (Node : Project_Node_Id;
593 To : Project_Node_Id);
594 pragma Inline (Set_Package_Node_Of);
596 procedure Set_String_Type_Of
597 (Node : Project_Node_Id;
598 To : Project_Node_Id);
599 pragma Inline (Set_String_Type_Of);
601 procedure Set_External_Reference_Of
602 (Node : Project_Node_Id;
603 To : Project_Node_Id);
604 pragma Inline (Set_External_Reference_Of);
606 procedure Set_External_Default_Of
607 (Node : Project_Node_Id;
608 To : Project_Node_Id);
609 pragma Inline (Set_External_Default_Of);
611 procedure Set_Case_Variable_Reference_Of
612 (Node : Project_Node_Id;
613 To : Project_Node_Id);
614 pragma Inline (Set_Case_Variable_Reference_Of);
616 procedure Set_First_Case_Item_Of
617 (Node : Project_Node_Id;
618 To : Project_Node_Id);
619 pragma Inline (Set_First_Case_Item_Of);
621 procedure Set_First_Choice_Of
622 (Node : Project_Node_Id;
623 To : Project_Node_Id);
624 pragma Inline (Set_First_Choice_Of);
626 procedure Set_Next_Case_Item
627 (Node : Project_Node_Id;
628 To : Project_Node_Id);
629 pragma Inline (Set_Next_Case_Item);
631 procedure Set_Case_Insensitive
632 (Node : Project_Node_Id;
635 -------------------------------
636 -- Restricted Access Section --
637 -------------------------------
639 package Tree_Private_Part is
641 -- This is conceptually in the private part.
642 -- However, for efficiency, some packages are accessing it directly.
644 type Project_Node_Record is record
646 Kind : Project_Node_Kind;
648 Location : Source_Ptr := No_Location;
650 Directory : Name_Id := No_Name;
651 -- Only for N_Project
653 Expr_Kind : Variable_Kind := Undefined;
654 -- See below for what Project_Node_Kind it is used
656 Variables : Variable_Node_Id := Empty_Node;
657 -- First variable in a project or a package
659 Packages : Package_Declaration_Id := Empty_Node;
660 -- First package declaration in a project
662 Pkg_Id : Package_Node_Id := Empty_Package;
663 -- Only used for N_Package_Declaration
664 -- The component Pkg_Id is an entry into the table Package_Attributes
665 -- (in Prj.Attr). It is used to indicate all the attributes of the
666 -- package with their characteristics.
668 -- The tables Prj.Attr.Attributes and Prj.Attr.Package_Attributes
669 -- are built once and for all through a call (from Prj.Initialize)
670 -- to procedure Prj.Attr.Initialize. It is never modified after that.
672 Name : Name_Id := No_Name;
673 -- See below for what Project_Node_Kind it is used
675 Path_Name : Name_Id := No_Name;
676 -- See below for what Project_Node_Kind it is used
678 Value : Name_Id := No_Name;
679 -- See below for what Project_Node_Kind it is used
681 Field1 : Project_Node_Id := Empty_Node;
682 -- See below the meaning for each Project_Node_Kind
684 Field2 : Project_Node_Id := Empty_Node;
685 -- See below the meaning for each Project_Node_Kind
687 Field3 : Project_Node_Id := Empty_Node;
688 -- See below the meaning for each Project_Node_Kind
690 Case_Insensitive : Boolean := False;
691 -- This flag is significant only for N_Attribute_Declaration and
692 -- N_Atribute_Reference. It indicates for an associative array
693 -- attribute, that the index is case insensitive.
695 Extending_All : Boolean := False;
696 -- This flag is significant only for N_Project. It indicates that
697 -- the project "extends all" another project.
701 -- type Project_Node_Kind is
704 -- -- Name: project name
705 -- -- Path_Name: project path name
706 -- -- Expr_Kind: Undefined
707 -- -- Field1: first with clause
708 -- -- Field2: project declaration
709 -- -- Field3: first string type
710 -- -- Value: extended project path name (if any)
713 -- -- Name: imported project name
714 -- -- Path_Name: imported project path name
715 -- -- Expr_Kind: Undefined
716 -- -- Field1: project node
717 -- -- Field2: next with clause
718 -- -- Field3: project node or empty if "limited with"
719 -- -- Value: literal string withed
721 -- N_Project_Declaration,
723 -- -- Path_Name: not used
724 -- -- Expr_Kind: Undefined
725 -- -- Field1: first declarative item
726 -- -- Field2: extended project
727 -- -- Field3: extending project
728 -- -- Value: not used
730 -- N_Declarative_Item,
732 -- -- Path_Name: not used
733 -- -- Expr_Kind: Undefined
734 -- -- Field1: current item node
735 -- -- Field2: next declarative item
736 -- -- Field3: not used
737 -- -- Value: not used
739 -- N_Package_Declaration,
740 -- -- Name: package name
741 -- -- Path_Name: not used
742 -- -- Expr_Kind: Undefined
743 -- -- Field1: project of renamed package (if any)
744 -- -- Field2: first declarative item
745 -- -- Field3: next package in project
746 -- -- Value: not used
748 -- N_String_Type_Declaration,
749 -- -- Name: type name
750 -- -- Path_Name: not used
751 -- -- Expr_Kind: Undefined
752 -- -- Field1: first literal string
753 -- -- Field2: next string type
754 -- -- Field3: not used
755 -- -- Value: not used
759 -- -- Path_Name: not used
760 -- -- Expr_Kind: Single
761 -- -- Field1: next literal string
762 -- -- Field2: not used
763 -- -- Field3: not used
764 -- -- Value: string value
766 -- N_Attribute_Declaration,
767 -- -- Name: attribute name
768 -- -- Path_Name: not used
769 -- -- Expr_Kind: attribute kind
770 -- -- Field1: expression
771 -- -- Field2: project of full associative array
772 -- -- Field3: package of full associative array
773 -- -- Value: associative array index
774 -- -- (if an associative array element)
776 -- N_Typed_Variable_Declaration,
777 -- -- Name: variable name
778 -- -- Path_Name: not used
779 -- -- Expr_Kind: Single
780 -- -- Field1: expression
781 -- -- Field2: type of variable (N_String_Type_Declaration)
782 -- -- Field3: next variable
783 -- -- Value: not used
785 -- N_Variable_Declaration,
786 -- -- Name: variable name
787 -- -- Path_Name: not used
788 -- -- Expr_Kind: variable kind
789 -- -- Field1: expression
790 -- -- Field2: not used
791 -- -- Field3 is used for next variable, instead of Field2,
792 -- -- so that it is the same field for
793 -- -- N_Variable_Declaration and
794 -- -- N_Typed_Variable_Declaration
795 -- -- Field3: next variable
796 -- -- Value: not used
800 -- -- Path_Name: not used
801 -- -- Expr_Kind: expression kind
802 -- -- Field1: first term
803 -- -- Field2: next expression in list
804 -- -- Field3: not used
805 -- -- Value: not used
809 -- -- Path_Name: not used
810 -- -- Expr_Kind: term kind
811 -- -- Field1: current term
812 -- -- Field2: next term in the expression
813 -- -- Field3: not used
814 -- -- Value: not used
816 -- N_Literal_String_List,
817 -- -- Designates a list of string expressions between brackets
818 -- -- separated by commas. The string expressions are not necessarily
819 -- -- literal strings.
821 -- -- Path_Name: not used
822 -- -- Expr_Kind: List
823 -- -- Field1: first expression
824 -- -- Field2: not used
825 -- -- Field3: not used
826 -- -- Value: not used
828 -- N_Variable_Reference,
829 -- -- Name: variable name
830 -- -- Path_Name: not used
831 -- -- Expr_Kind: variable kind
832 -- -- Field1: project (if specified)
833 -- -- Field2: package (if specified)
834 -- -- Field3: type of variable (N_String_Type_Declaration), if any
835 -- -- Value: not used
839 -- -- Path_Name: not used
840 -- -- Expr_Kind: Single
841 -- -- Field1: Name of the external reference (literal string)
842 -- -- Field2: Default (literal string)
843 -- -- Field3: not used
844 -- -- Value: not used
846 -- N_Attribute_Reference,
847 -- -- Name: attribute name
848 -- -- Path_Name: not used
849 -- -- Expr_Kind: attribute kind
850 -- -- Field1: project
851 -- -- Field2: package (if attribute of a package)
852 -- -- Field3: not used
853 -- -- Value: associative array index
854 -- -- (if an associative array element)
856 -- N_Case_Construction,
858 -- -- Path_Name: not used
859 -- -- Expr_Kind: Undefined
860 -- -- Field1: case variable reference
861 -- -- Field2: first case item
862 -- -- Field3: not used
863 -- -- Value: not used
867 -- -- Path_Name: not used
868 -- -- Expr_Kind: not used
869 -- -- Field1: first choice (literal string), or Empty_Node
870 -- -- for when others
871 -- -- Field2: first declarative item
872 -- -- Field3: next case item
873 -- -- Value: not used
875 package Project_Nodes is
876 new Table.Table (Table_Component_Type => Project_Node_Record,
877 Table_Index_Type => Project_Node_Id,
878 Table_Low_Bound => First_Node_Id,
879 Table_Initial => Project_Nodes_Initial,
880 Table_Increment => Project_Nodes_Increment,
881 Table_Name => "Project_Nodes");
882 -- This table contains the syntactic tree of project data
883 -- from project files.
885 type Project_Name_And_Node is record
887 -- Name of the project
889 Node : Project_Node_Id;
890 -- Node of the project in table Project_Nodes
893 -- True when the project is being extended by another project
896 No_Project_Name_And_Node : constant Project_Name_And_Node :=
897 (Name => No_Name, Node => Empty_Node, Extended => True);
899 package Projects_Htable is new GNAT.HTable.Simple_HTable
900 (Header_Num => Header_Num,
901 Element => Project_Name_And_Node,
902 No_Element => No_Project_Name_And_Node,
906 -- This hash table contains a mapping of project names to project nodes.
907 -- Note that this hash table contains only the nodes whose Kind is
908 -- N_Project. It is used to find the node of a project from its
909 -- name, and to verify if a project has already been parsed, knowing
912 end Tree_Private_Part;