1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 2001-2009, Free Software Foundation, Inc. --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 ------------------------------------------------------------------------------
26 -- This package defines the structure of the Project File tree
28 with GNAT.Dynamic_HTables;
29 with GNAT.Dynamic_Tables;
33 with Prj.Attr; use Prj.Attr;
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.
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
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)
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
55 Empty_Node : constant Project_Node_Id := Project_Node_Low_Bound;
56 -- Designates no node in table Project_Nodes
58 First_Node_Id : constant Project_Node_Id := Project_Node_Low_Bound + 1;
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.
65 subtype Package_Declaration_Id is Project_Node_Id;
66 -- Used to designate a node whose expected kind is N_Project_Declaration
68 type Project_Node_Kind is
71 N_Project_Declaration,
73 N_Package_Declaration,
74 N_String_Type_Declaration,
76 N_Attribute_Declaration,
77 N_Typed_Variable_Declaration,
78 N_Variable_Declaration,
81 N_Literal_String_List,
84 N_Attribute_Reference,
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
93 function Present (Node : Project_Node_Id) return Boolean;
94 pragma Inline (Present);
95 -- Return True if Node /= Empty_Node
97 function No (Node : Project_Node_Id) return Boolean;
99 -- Return True if Node = Empty_Node
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.
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 -- To create a node for a project itself, see Create_Project below instead
113 function Hash (N : Project_Node_Id) return Header_Num;
114 -- Used for hash tables where the key is a Project_Node_Id
116 function Imported_Or_Extended_Project_Of
117 (Project : Project_Node_Id;
118 In_Tree : Project_Node_Tree_Ref;
119 With_Name : Name_Id) return Project_Node_Id;
120 -- Return the node of a project imported or extended by project Project and
121 -- whose name is With_Name. Return Empty_Node if there is no such project.
127 type Comment_State is private;
128 -- A type to store the values of several global variables related to
131 procedure Save (S : out Comment_State);
132 -- Save in variable S the comment state. Called before scanning a new
135 procedure Restore_And_Free (S : in out Comment_State);
136 -- Restore the comment state to a previously saved value. Called after
137 -- scanning a project file. Frees the memory occupied by S
139 procedure Reset_State;
140 -- Set the comment state to its initial value. Called before scanning a
143 function There_Are_Unkept_Comments return Boolean;
144 -- Indicates that some of the comments in a project file could not be
145 -- stored in the parse tree.
147 procedure Set_Previous_Line_Node (To : Project_Node_Id);
148 -- Indicate the node on the previous line. If there are comments
149 -- immediately following this line, then they should be associated with
152 procedure Set_Previous_End_Node (To : Project_Node_Id);
153 -- Indicate that on the previous line the "end" belongs to node To.
154 -- If there are comments immediately following this "end" line, they
155 -- should be associated with this node.
157 procedure Set_End_Of_Line (To : Project_Node_Id);
158 -- Indicate the node on the current line. If there is an end of line
159 -- comment, then it should be associated with this node.
161 procedure Set_Next_End_Node (To : Project_Node_Id);
162 -- Put node To on the top of the end node stack. When an END line is found
163 -- with this node on the top of the end node stack, the comments, if any,
164 -- immediately preceding this "end" line will be associated with this node.
166 procedure Remove_Next_End_Node;
167 -- Remove the top of the end node stack
169 ------------------------
170 -- Comment Processing --
171 ------------------------
173 type Comment_Data is record
174 Value : Name_Id := No_Name;
175 Follows_Empty_Line : Boolean := False;
176 Is_Followed_By_Empty_Line : Boolean := False;
178 -- Component type for Comments Table below
180 package Comments is new Table.Table
181 (Table_Component_Type => Comment_Data,
182 Table_Index_Type => Natural,
183 Table_Low_Bound => 1,
185 Table_Increment => 100,
186 Table_Name => "Prj.Tree.Comments");
187 -- A table to store the comments that may be stored is the tree
189 procedure Scan (In_Tree : Project_Node_Tree_Ref);
190 -- Scan the tokens and accumulate comments
192 type Comment_Location is
193 (Before, After, Before_End, After_End, End_Of_Line);
194 -- Used in call to Add_Comments below
196 procedure Add_Comments
197 (To : Project_Node_Id;
198 In_Tree : Project_Node_Tree_Ref;
199 Where : Comment_Location);
200 -- Add comments to this node
202 ----------------------
203 -- Access Functions --
204 ----------------------
206 -- The following query functions are part of the abstract interface
207 -- of the Project File tree. They provide access to fields of a project.
209 -- The access functions should be called only with valid arguments.
210 -- For each function the condition of validity is specified. If an access
211 -- function is called with invalid arguments, then exception
212 -- Assertion_Error is raised if assertions are enabled, otherwise the
213 -- behaviour is not defined and may result in a crash.
216 (Node : Project_Node_Id;
217 In_Tree : Project_Node_Tree_Ref) return Name_Id;
218 pragma Inline (Name_Of);
219 -- Valid for all non empty nodes. May return No_Name for nodes that have
223 (Node : Project_Node_Id;
224 In_Tree : Project_Node_Tree_Ref) return Project_Node_Kind;
225 pragma Inline (Kind_Of);
226 -- Valid for all non empty nodes
229 (Node : Project_Node_Id;
230 In_Tree : Project_Node_Tree_Ref) return Source_Ptr;
231 pragma Inline (Location_Of);
232 -- Valid for all non empty nodes
234 function First_Comment_After
235 (Node : Project_Node_Id;
236 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
237 -- Valid only for N_Comment_Zones nodes
239 function First_Comment_After_End
240 (Node : Project_Node_Id;
241 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
242 -- Valid only for N_Comment_Zones nodes
244 function First_Comment_Before
245 (Node : Project_Node_Id;
246 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
247 -- Valid only for N_Comment_Zones nodes
249 function First_Comment_Before_End
250 (Node : Project_Node_Id;
251 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
252 -- Valid only for N_Comment_Zones nodes
254 function Next_Comment
255 (Node : Project_Node_Id;
256 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
257 -- Valid only for N_Comment nodes
259 function End_Of_Line_Comment
260 (Node : Project_Node_Id;
261 In_Tree : Project_Node_Tree_Ref) return Name_Id;
262 -- Valid only for non empty nodes
264 function Follows_Empty_Line
265 (Node : Project_Node_Id;
266 In_Tree : Project_Node_Tree_Ref) return Boolean;
267 -- Valid only for N_Comment nodes
269 function Is_Followed_By_Empty_Line
270 (Node : Project_Node_Id;
271 In_Tree : Project_Node_Tree_Ref) return Boolean;
272 -- Valid only for N_Comment nodes
274 function Parent_Project_Of
275 (Node : Project_Node_Id;
276 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
277 pragma Inline (Parent_Project_Of);
278 -- Valid only for N_Project nodes
280 function Project_File_Includes_Unkept_Comments
281 (Node : Project_Node_Id;
282 In_Tree : Project_Node_Tree_Ref) return Boolean;
283 -- Valid only for N_Project nodes
285 function Directory_Of
286 (Node : Project_Node_Id;
287 In_Tree : Project_Node_Tree_Ref) return Path_Name_Type;
288 pragma Inline (Directory_Of);
289 -- Returns the directory that contains the project file. This always ends
290 -- with a directory separator. Only valid for N_Project nodes.
292 function Expression_Kind_Of
293 (Node : Project_Node_Id;
294 In_Tree : Project_Node_Tree_Ref) return Variable_Kind;
295 pragma Inline (Expression_Kind_Of);
296 -- Only valid for N_Literal_String, N_Attribute_Declaration,
297 -- N_Variable_Declaration, N_Typed_Variable_Declaration, N_Expression,
298 -- N_Term, N_Variable_Reference or N_Attribute_Reference nodes.
300 function Is_Extending_All
301 (Node : Project_Node_Id;
302 In_Tree : Project_Node_Tree_Ref) return Boolean;
303 pragma Inline (Is_Extending_All);
304 -- Only valid for N_Project and N_With_Clause
306 function Is_Not_Last_In_List
307 (Node : Project_Node_Id;
308 In_Tree : Project_Node_Tree_Ref) return Boolean;
309 pragma Inline (Is_Not_Last_In_List);
310 -- Only valid for N_With_Clause
312 function First_Variable_Of
313 (Node : Project_Node_Id;
314 In_Tree : Project_Node_Tree_Ref) return Variable_Node_Id;
315 pragma Inline (First_Variable_Of);
316 -- Only valid for N_Project or N_Package_Declaration nodes
318 function First_Package_Of
319 (Node : Project_Node_Id;
320 In_Tree : Project_Node_Tree_Ref) return Package_Declaration_Id;
321 pragma Inline (First_Package_Of);
322 -- Only valid for N_Project nodes
324 function Package_Id_Of
325 (Node : Project_Node_Id;
326 In_Tree : Project_Node_Tree_Ref) return Package_Node_Id;
327 pragma Inline (Package_Id_Of);
328 -- Only valid for N_Package_Declaration nodes
330 function Path_Name_Of
331 (Node : Project_Node_Id;
332 In_Tree : Project_Node_Tree_Ref) return Path_Name_Type;
333 pragma Inline (Path_Name_Of);
334 -- Only valid for N_Project and N_With_Clause nodes
336 function String_Value_Of
337 (Node : Project_Node_Id;
338 In_Tree : Project_Node_Tree_Ref) return Name_Id;
339 pragma Inline (String_Value_Of);
340 -- Only valid for N_With_Clause, N_Literal_String nodes or N_Comment.
341 -- For a N_With_Clause created automatically for a virtual extending
342 -- project, No_Name is returned.
344 function Source_Index_Of
345 (Node : Project_Node_Id;
346 In_Tree : Project_Node_Tree_Ref) return Int;
347 pragma Inline (Source_Index_Of);
348 -- Only valid for N_Literal_String and N_Attribute_Declaration nodes
350 function First_With_Clause_Of
351 (Node : Project_Node_Id;
352 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
353 pragma Inline (First_With_Clause_Of);
354 -- Only valid for N_Project nodes
356 function Project_Declaration_Of
357 (Node : Project_Node_Id;
358 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
359 pragma Inline (Project_Declaration_Of);
360 -- Only valid for N_Project nodes
362 function Project_Qualifier_Of
363 (Node : Project_Node_Id;
364 In_Tree : Project_Node_Tree_Ref) return Project_Qualifier;
365 pragma Inline (Project_Qualifier_Of);
366 -- Only valid for N_Project nodes
368 function Extending_Project_Of
369 (Node : Project_Node_Id;
370 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
371 pragma Inline (Extending_Project_Of);
372 -- Only valid for N_Project_Declaration nodes
374 function First_String_Type_Of
375 (Node : Project_Node_Id;
376 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
377 pragma Inline (First_String_Type_Of);
378 -- Only valid for N_Project nodes
380 function Extended_Project_Path_Of
381 (Node : Project_Node_Id;
382 In_Tree : Project_Node_Tree_Ref) return Path_Name_Type;
383 pragma Inline (Extended_Project_Path_Of);
384 -- Only valid for N_With_Clause nodes
386 function Project_Node_Of
387 (Node : Project_Node_Id;
388 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
389 pragma Inline (Project_Node_Of);
390 -- Only valid for N_With_Clause, N_Variable_Reference and
391 -- N_Attribute_Reference nodes.
393 function Non_Limited_Project_Node_Of
394 (Node : Project_Node_Id;
395 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
396 pragma Inline (Non_Limited_Project_Node_Of);
397 -- Only valid for N_With_Clause nodes. Returns Empty_Node for limited
398 -- imported project files, otherwise returns the same result as
401 function Next_With_Clause_Of
402 (Node : Project_Node_Id;
403 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
404 pragma Inline (Next_With_Clause_Of);
405 -- Only valid for N_With_Clause nodes
407 function First_Declarative_Item_Of
408 (Node : Project_Node_Id;
409 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
410 pragma Inline (First_Declarative_Item_Of);
411 -- Only valid for N_With_Clause nodes
413 function Extended_Project_Of
414 (Node : Project_Node_Id;
415 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
416 pragma Inline (Extended_Project_Of);
417 -- Only valid for N_Project_Declaration nodes
419 function Current_Item_Node
420 (Node : Project_Node_Id;
421 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
422 pragma Inline (Current_Item_Node);
423 -- Only valid for N_Declarative_Item nodes
425 function Next_Declarative_Item
426 (Node : Project_Node_Id;
427 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
428 pragma Inline (Next_Declarative_Item);
429 -- Only valid for N_Declarative_Item node
431 function Project_Of_Renamed_Package_Of
432 (Node : Project_Node_Id;
433 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
434 pragma Inline (Project_Of_Renamed_Package_Of);
435 -- Only valid for N_Package_Declaration nodes. May return Empty_Node.
437 function Next_Package_In_Project
438 (Node : Project_Node_Id;
439 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
440 pragma Inline (Next_Package_In_Project);
441 -- Only valid for N_Package_Declaration nodes
443 function First_Literal_String
444 (Node : Project_Node_Id;
445 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
446 pragma Inline (First_Literal_String);
447 -- Only valid for N_String_Type_Declaration nodes
449 function Next_String_Type
450 (Node : Project_Node_Id;
451 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
452 pragma Inline (Next_String_Type);
453 -- Only valid for N_String_Type_Declaration nodes
455 function Next_Literal_String
456 (Node : Project_Node_Id;
457 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
458 pragma Inline (Next_Literal_String);
459 -- Only valid for N_Literal_String nodes
461 function Expression_Of
462 (Node : Project_Node_Id;
463 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
464 pragma Inline (Expression_Of);
465 -- Only valid for N_Attribute_Declaration, N_Typed_Variable_Declaration
466 -- or N_Variable_Declaration nodes
468 function Associative_Project_Of
469 (Node : Project_Node_Id;
470 In_Tree : Project_Node_Tree_Ref)
471 return Project_Node_Id;
472 pragma Inline (Associative_Project_Of);
473 -- Only valid for N_Attribute_Declaration nodes
475 function Associative_Package_Of
476 (Node : Project_Node_Id;
477 In_Tree : Project_Node_Tree_Ref)
478 return Project_Node_Id;
479 pragma Inline (Associative_Package_Of);
480 -- Only valid for N_Attribute_Declaration nodes
482 function Value_Is_Valid
483 (For_Typed_Variable : Project_Node_Id;
484 In_Tree : Project_Node_Tree_Ref;
485 Value : Name_Id) return Boolean;
486 pragma Inline (Value_Is_Valid);
487 -- Only valid for N_Typed_Variable_Declaration. Returns True if Value is
488 -- in the list of allowed strings for For_Typed_Variable. False otherwise.
490 function Associative_Array_Index_Of
491 (Node : Project_Node_Id;
492 In_Tree : Project_Node_Tree_Ref) return Name_Id;
493 pragma Inline (Associative_Array_Index_Of);
494 -- Only valid for N_Attribute_Declaration and N_Attribute_Reference.
495 -- Returns No_String for non associative array attributes.
497 function Next_Variable
498 (Node : Project_Node_Id;
499 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
500 pragma Inline (Next_Variable);
501 -- Only valid for N_Typed_Variable_Declaration or N_Variable_Declaration
505 (Node : Project_Node_Id;
506 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
507 pragma Inline (First_Term);
508 -- Only valid for N_Expression nodes
510 function Next_Expression_In_List
511 (Node : Project_Node_Id;
512 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
513 pragma Inline (Next_Expression_In_List);
514 -- Only valid for N_Expression nodes
516 function Current_Term
517 (Node : Project_Node_Id;
518 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
519 pragma Inline (Current_Term);
520 -- Only valid for N_Term nodes
523 (Node : Project_Node_Id;
524 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
525 pragma Inline (Next_Term);
526 -- Only valid for N_Term nodes
528 function First_Expression_In_List
529 (Node : Project_Node_Id;
530 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
531 pragma Inline (First_Expression_In_List);
532 -- Only valid for N_Literal_String_List nodes
534 function Package_Node_Of
535 (Node : Project_Node_Id;
536 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
537 pragma Inline (Package_Node_Of);
538 -- Only valid for N_Variable_Reference or N_Attribute_Reference nodes.
539 -- May return Empty_Node.
541 function String_Type_Of
542 (Node : Project_Node_Id;
543 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
544 pragma Inline (String_Type_Of);
545 -- Only valid for N_Variable_Reference or N_Typed_Variable_Declaration
548 function External_Reference_Of
549 (Node : Project_Node_Id;
550 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
551 pragma Inline (External_Reference_Of);
552 -- Only valid for N_External_Value nodes
554 function External_Default_Of
555 (Node : Project_Node_Id;
556 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
557 pragma Inline (External_Default_Of);
558 -- Only valid for N_External_Value nodes
560 function Case_Variable_Reference_Of
561 (Node : Project_Node_Id;
562 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
563 pragma Inline (Case_Variable_Reference_Of);
564 -- Only valid for N_Case_Construction nodes
566 function First_Case_Item_Of
567 (Node : Project_Node_Id;
568 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
569 pragma Inline (First_Case_Item_Of);
570 -- Only valid for N_Case_Construction nodes
572 function First_Choice_Of
573 (Node : Project_Node_Id;
574 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
575 pragma Inline (First_Choice_Of);
576 -- Return the first choice in a N_Case_Item, or Empty_Node if
577 -- this is when others.
579 function Next_Case_Item
580 (Node : Project_Node_Id;
581 In_Tree : Project_Node_Tree_Ref) return Project_Node_Id;
582 pragma Inline (Next_Case_Item);
583 -- Only valid for N_Case_Item nodes
585 function Case_Insensitive
586 (Node : Project_Node_Id;
587 In_Tree : Project_Node_Tree_Ref) return Boolean;
588 -- Only valid for N_Attribute_Declaration and N_Attribute_Reference nodes
590 -----------------------
591 -- Create procedures --
592 -----------------------
593 -- The following procedures are used to edit a project file tree. They are
594 -- slightly higher-level than the Set_* procedures below
596 function Create_Project
597 (In_Tree : Project_Node_Tree_Ref;
599 Full_Path : Path_Name_Type;
600 Is_Config_File : Boolean := False) return Project_Node_Id;
601 -- Create a new node for a project and register it in the tree so that it
602 -- can be retrieved later on.
604 function Create_Package
605 (Tree : Project_Node_Tree_Ref;
606 Project : Project_Node_Id;
607 Pkg : String) return Project_Node_Id;
608 -- Create a new package in Project. If the package already exists, it is
609 -- returned. The name of the package *must* be lower-cases, or none of its
610 -- attributes will be recognized.
612 function Create_Attribute
613 (Tree : Project_Node_Tree_Ref;
614 Prj_Or_Pkg : Project_Node_Id;
616 Index_Name : Name_Id := No_Name;
617 Kind : Variable_Kind := List;
618 At_Index : Integer := 0) return Project_Node_Id;
619 -- Create a new attribute. The new declaration is added at the end of the
620 -- declarative item list for Prj_Or_Pkg (a project or a package), but
621 -- before any package declaration). No addition is done if Prj_Or_Pkg is
622 -- Empty_Node. If Index_Name is not "", then if creates an attribute value
623 -- for a specific index. At_Index is used for the " at <idx>" in the naming
624 -- exceptions. Use Set_Expression_Of to set the value of the attribute (in
625 -- which case Enclose_In_Expression might be useful)
627 function Create_Literal_String
628 (Str : Namet.Name_Id;
629 Tree : Project_Node_Tree_Ref) return Project_Node_Id;
630 -- Create a literal string whose value is Str
633 (Tree : Project_Node_Tree_Ref;
634 Parent : Project_Node_Id;
635 Expr : Project_Node_Id;
636 Add_Before_First_Pkg : Boolean := False;
637 Add_Before_First_Case : Boolean := False);
638 -- Add a new declarative item in the list in Parent. This new declarative
639 -- item will contain Expr (unless Expr is already a declarative item, in
640 -- which case it is added directly to the list). The new item is inserted
641 -- at the end of the list, unless Add_Before_First_Pkg is True. In the
642 -- latter case, it is added just before the first case construction is
643 -- seen, or before the first package (this assumes that all packages are
644 -- found at the end of the project, which isn't true in the general case
645 -- unless you have normalized the project to match this description).
647 function Enclose_In_Expression
648 (Node : Project_Node_Id;
649 Tree : Project_Node_Tree_Ref) return Project_Node_Id;
650 -- Enclose the Node inside a N_Expression node, and return this expression
656 -- The following procedures are part of the abstract interface of the
657 -- Project File tree.
659 -- Each Set_* procedure is valid only for the same Project_Node_Kind
660 -- nodes as the corresponding query function above.
661 -- These are very low-level, and manipulate the tree itself directly. You
662 -- should look at the Create_* procedure instead if you want to use higher
665 procedure Set_Name_Of
666 (Node : Project_Node_Id;
667 In_Tree : Project_Node_Tree_Ref;
669 pragma Inline (Set_Name_Of);
671 procedure Set_Kind_Of
672 (Node : Project_Node_Id;
673 In_Tree : Project_Node_Tree_Ref;
674 To : Project_Node_Kind);
675 pragma Inline (Set_Kind_Of);
677 procedure Set_Location_Of
678 (Node : Project_Node_Id;
679 In_Tree : Project_Node_Tree_Ref;
681 pragma Inline (Set_Location_Of);
683 procedure Set_First_Comment_After
684 (Node : Project_Node_Id;
685 In_Tree : Project_Node_Tree_Ref;
686 To : Project_Node_Id);
687 pragma Inline (Set_First_Comment_After);
689 procedure Set_First_Comment_After_End
690 (Node : Project_Node_Id;
691 In_Tree : Project_Node_Tree_Ref;
692 To : Project_Node_Id);
693 pragma Inline (Set_First_Comment_After_End);
695 procedure Set_First_Comment_Before
696 (Node : Project_Node_Id;
697 In_Tree : Project_Node_Tree_Ref;
698 To : Project_Node_Id);
699 pragma Inline (Set_First_Comment_Before);
701 procedure Set_First_Comment_Before_End
702 (Node : Project_Node_Id;
703 In_Tree : Project_Node_Tree_Ref;
704 To : Project_Node_Id);
705 pragma Inline (Set_First_Comment_Before_End);
707 procedure Set_Next_Comment
708 (Node : Project_Node_Id;
709 In_Tree : Project_Node_Tree_Ref;
710 To : Project_Node_Id);
711 pragma Inline (Set_Next_Comment);
713 procedure Set_Parent_Project_Of
714 (Node : Project_Node_Id;
715 In_Tree : Project_Node_Tree_Ref;
716 To : Project_Node_Id);
718 procedure Set_Project_File_Includes_Unkept_Comments
719 (Node : Project_Node_Id;
720 In_Tree : Project_Node_Tree_Ref;
723 procedure Set_Directory_Of
724 (Node : Project_Node_Id;
725 In_Tree : Project_Node_Tree_Ref;
726 To : Path_Name_Type);
727 pragma Inline (Set_Directory_Of);
729 procedure Set_Expression_Kind_Of
730 (Node : Project_Node_Id;
731 In_Tree : Project_Node_Tree_Ref;
733 pragma Inline (Set_Expression_Kind_Of);
735 procedure Set_Is_Extending_All
736 (Node : Project_Node_Id;
737 In_Tree : Project_Node_Tree_Ref);
738 pragma Inline (Set_Is_Extending_All);
740 procedure Set_Is_Not_Last_In_List
741 (Node : Project_Node_Id;
742 In_Tree : Project_Node_Tree_Ref);
743 pragma Inline (Set_Is_Not_Last_In_List);
745 procedure Set_First_Variable_Of
746 (Node : Project_Node_Id;
747 In_Tree : Project_Node_Tree_Ref;
748 To : Variable_Node_Id);
749 pragma Inline (Set_First_Variable_Of);
751 procedure Set_First_Package_Of
752 (Node : Project_Node_Id;
753 In_Tree : Project_Node_Tree_Ref;
754 To : Package_Declaration_Id);
755 pragma Inline (Set_First_Package_Of);
757 procedure Set_Package_Id_Of
758 (Node : Project_Node_Id;
759 In_Tree : Project_Node_Tree_Ref;
760 To : Package_Node_Id);
761 pragma Inline (Set_Package_Id_Of);
763 procedure Set_Path_Name_Of
764 (Node : Project_Node_Id;
765 In_Tree : Project_Node_Tree_Ref;
766 To : Path_Name_Type);
767 pragma Inline (Set_Path_Name_Of);
769 procedure Set_String_Value_Of
770 (Node : Project_Node_Id;
771 In_Tree : Project_Node_Tree_Ref;
773 pragma Inline (Set_String_Value_Of);
775 procedure Set_First_With_Clause_Of
776 (Node : Project_Node_Id;
777 In_Tree : Project_Node_Tree_Ref;
778 To : Project_Node_Id);
779 pragma Inline (Set_First_With_Clause_Of);
781 procedure Set_Project_Declaration_Of
782 (Node : Project_Node_Id;
783 In_Tree : Project_Node_Tree_Ref;
784 To : Project_Node_Id);
785 pragma Inline (Set_Project_Declaration_Of);
787 procedure Set_Project_Qualifier_Of
788 (Node : Project_Node_Id;
789 In_Tree : Project_Node_Tree_Ref;
790 To : Project_Qualifier);
791 pragma Inline (Set_Project_Qualifier_Of);
793 procedure Set_Extending_Project_Of
794 (Node : Project_Node_Id;
795 In_Tree : Project_Node_Tree_Ref;
796 To : Project_Node_Id);
797 pragma Inline (Set_Extending_Project_Of);
799 procedure Set_First_String_Type_Of
800 (Node : Project_Node_Id;
801 In_Tree : Project_Node_Tree_Ref;
802 To : Project_Node_Id);
803 pragma Inline (Set_First_String_Type_Of);
805 procedure Set_Extended_Project_Path_Of
806 (Node : Project_Node_Id;
807 In_Tree : Project_Node_Tree_Ref;
808 To : Path_Name_Type);
809 pragma Inline (Set_Extended_Project_Path_Of);
811 procedure Set_Project_Node_Of
812 (Node : Project_Node_Id;
813 In_Tree : Project_Node_Tree_Ref;
814 To : Project_Node_Id;
815 Limited_With : Boolean := False);
816 pragma Inline (Set_Project_Node_Of);
818 procedure Set_Next_With_Clause_Of
819 (Node : Project_Node_Id;
820 In_Tree : Project_Node_Tree_Ref;
821 To : Project_Node_Id);
822 pragma Inline (Set_Next_With_Clause_Of);
824 procedure Set_First_Declarative_Item_Of
825 (Node : Project_Node_Id;
826 In_Tree : Project_Node_Tree_Ref;
827 To : Project_Node_Id);
828 pragma Inline (Set_First_Declarative_Item_Of);
830 procedure Set_Extended_Project_Of
831 (Node : Project_Node_Id;
832 In_Tree : Project_Node_Tree_Ref;
833 To : Project_Node_Id);
834 pragma Inline (Set_Extended_Project_Of);
836 procedure Set_Current_Item_Node
837 (Node : Project_Node_Id;
838 In_Tree : Project_Node_Tree_Ref;
839 To : Project_Node_Id);
840 pragma Inline (Set_Current_Item_Node);
842 procedure Set_Next_Declarative_Item
843 (Node : Project_Node_Id;
844 In_Tree : Project_Node_Tree_Ref;
845 To : Project_Node_Id);
846 pragma Inline (Set_Next_Declarative_Item);
848 procedure Set_Project_Of_Renamed_Package_Of
849 (Node : Project_Node_Id;
850 In_Tree : Project_Node_Tree_Ref;
851 To : Project_Node_Id);
852 pragma Inline (Set_Project_Of_Renamed_Package_Of);
854 procedure Set_Next_Package_In_Project
855 (Node : Project_Node_Id;
856 In_Tree : Project_Node_Tree_Ref;
857 To : Project_Node_Id);
858 pragma Inline (Set_Next_Package_In_Project);
860 procedure Set_First_Literal_String
861 (Node : Project_Node_Id;
862 In_Tree : Project_Node_Tree_Ref;
863 To : Project_Node_Id);
864 pragma Inline (Set_First_Literal_String);
866 procedure Set_Next_String_Type
867 (Node : Project_Node_Id;
868 In_Tree : Project_Node_Tree_Ref;
869 To : Project_Node_Id);
870 pragma Inline (Set_Next_String_Type);
872 procedure Set_Next_Literal_String
873 (Node : Project_Node_Id;
874 In_Tree : Project_Node_Tree_Ref;
875 To : Project_Node_Id);
876 pragma Inline (Set_Next_Literal_String);
878 procedure Set_Expression_Of
879 (Node : Project_Node_Id;
880 In_Tree : Project_Node_Tree_Ref;
881 To : Project_Node_Id);
882 pragma Inline (Set_Expression_Of);
884 procedure Set_Associative_Project_Of
885 (Node : Project_Node_Id;
886 In_Tree : Project_Node_Tree_Ref;
887 To : Project_Node_Id);
888 pragma Inline (Set_Associative_Project_Of);
890 procedure Set_Associative_Package_Of
891 (Node : Project_Node_Id;
892 In_Tree : Project_Node_Tree_Ref;
893 To : Project_Node_Id);
894 pragma Inline (Set_Associative_Package_Of);
896 procedure Set_Associative_Array_Index_Of
897 (Node : Project_Node_Id;
898 In_Tree : Project_Node_Tree_Ref;
900 pragma Inline (Set_Associative_Array_Index_Of);
902 procedure Set_Next_Variable
903 (Node : Project_Node_Id;
904 In_Tree : Project_Node_Tree_Ref;
905 To : Project_Node_Id);
906 pragma Inline (Set_Next_Variable);
908 procedure Set_First_Term
909 (Node : Project_Node_Id;
910 In_Tree : Project_Node_Tree_Ref;
911 To : Project_Node_Id);
912 pragma Inline (Set_First_Term);
914 procedure Set_Next_Expression_In_List
915 (Node : Project_Node_Id;
916 In_Tree : Project_Node_Tree_Ref;
917 To : Project_Node_Id);
918 pragma Inline (Set_Next_Expression_In_List);
920 procedure Set_Current_Term
921 (Node : Project_Node_Id;
922 In_Tree : Project_Node_Tree_Ref;
923 To : Project_Node_Id);
924 pragma Inline (Set_Current_Term);
926 procedure Set_Next_Term
927 (Node : Project_Node_Id;
928 In_Tree : Project_Node_Tree_Ref;
929 To : Project_Node_Id);
930 pragma Inline (Set_Next_Term);
932 procedure Set_First_Expression_In_List
933 (Node : Project_Node_Id;
934 In_Tree : Project_Node_Tree_Ref;
935 To : Project_Node_Id);
936 pragma Inline (Set_First_Expression_In_List);
938 procedure Set_Package_Node_Of
939 (Node : Project_Node_Id;
940 In_Tree : Project_Node_Tree_Ref;
941 To : Project_Node_Id);
942 pragma Inline (Set_Package_Node_Of);
944 procedure Set_Source_Index_Of
945 (Node : Project_Node_Id;
946 In_Tree : Project_Node_Tree_Ref;
948 pragma Inline (Set_Source_Index_Of);
950 procedure Set_String_Type_Of
951 (Node : Project_Node_Id;
952 In_Tree : Project_Node_Tree_Ref;
953 To : Project_Node_Id);
954 pragma Inline (Set_String_Type_Of);
956 procedure Set_External_Reference_Of
957 (Node : Project_Node_Id;
958 In_Tree : Project_Node_Tree_Ref;
959 To : Project_Node_Id);
960 pragma Inline (Set_External_Reference_Of);
962 procedure Set_External_Default_Of
963 (Node : Project_Node_Id;
964 In_Tree : Project_Node_Tree_Ref;
965 To : Project_Node_Id);
966 pragma Inline (Set_External_Default_Of);
968 procedure Set_Case_Variable_Reference_Of
969 (Node : Project_Node_Id;
970 In_Tree : Project_Node_Tree_Ref;
971 To : Project_Node_Id);
972 pragma Inline (Set_Case_Variable_Reference_Of);
974 procedure Set_First_Case_Item_Of
975 (Node : Project_Node_Id;
976 In_Tree : Project_Node_Tree_Ref;
977 To : Project_Node_Id);
978 pragma Inline (Set_First_Case_Item_Of);
980 procedure Set_First_Choice_Of
981 (Node : Project_Node_Id;
982 In_Tree : Project_Node_Tree_Ref;
983 To : Project_Node_Id);
984 pragma Inline (Set_First_Choice_Of);
986 procedure Set_Next_Case_Item
987 (Node : Project_Node_Id;
988 In_Tree : Project_Node_Tree_Ref;
989 To : Project_Node_Id);
990 pragma Inline (Set_Next_Case_Item);
992 procedure Set_Case_Insensitive
993 (Node : Project_Node_Id;
994 In_Tree : Project_Node_Tree_Ref;
997 -------------------------------
998 -- Restricted Access Section --
999 -------------------------------
1001 package Tree_Private_Part is
1003 -- This is conceptually in the private part
1005 -- However, for efficiency, some packages are accessing it directly
1007 type Project_Node_Record is record
1009 Kind : Project_Node_Kind;
1011 Qualifier : Project_Qualifier := Unspecified;
1013 Location : Source_Ptr := No_Location;
1015 Directory : Path_Name_Type := No_Path;
1016 -- Only for N_Project
1018 Expr_Kind : Variable_Kind := Undefined;
1019 -- See below for what Project_Node_Kind it is used
1021 Variables : Variable_Node_Id := Empty_Node;
1022 -- First variable in a project or a package
1024 Packages : Package_Declaration_Id := Empty_Node;
1025 -- First package declaration in a project
1027 Pkg_Id : Package_Node_Id := Empty_Package;
1028 -- Only used for N_Package_Declaration
1030 -- The component Pkg_Id is an entry into the table Package_Attributes
1031 -- (in Prj.Attr). It is used to indicate all the attributes of the
1032 -- package with their characteristics.
1034 -- The tables Prj.Attr.Attributes and Prj.Attr.Package_Attributes
1035 -- are built once and for all through a call (from Prj.Initialize)
1036 -- to procedure Prj.Attr.Initialize. It is never modified after that.
1038 Name : Name_Id := No_Name;
1039 -- See below for what Project_Node_Kind it is used
1041 Src_Index : Int := 0;
1042 -- Index of a unit in a multi-unit source.
1043 -- Only for some N_Attribute_Declaration and N_Literal_String.
1045 Path_Name : Path_Name_Type := No_Path;
1046 -- See below for what Project_Node_Kind it is used
1048 Value : Name_Id := No_Name;
1049 -- See below for what Project_Node_Kind it is used
1051 Field1 : Project_Node_Id := Empty_Node;
1052 -- See below the meaning for each Project_Node_Kind
1054 Field2 : Project_Node_Id := Empty_Node;
1055 -- See below the meaning for each Project_Node_Kind
1057 Field3 : Project_Node_Id := Empty_Node;
1058 -- See below the meaning for each Project_Node_Kind
1060 Field4 : Project_Node_Id := Empty_Node;
1061 -- See below the meaning for each Project_Node_Kind
1063 Flag1 : Boolean := False;
1064 -- This flag is significant only for:
1066 -- N_Attribute_Declaration and N_Attribute_Reference
1067 -- Indicates for an associative array attribute, that the
1068 -- index is case insensitive.
1071 -- Indicates that the comment is preceded by an empty line.
1074 -- Indicates that there are comments in the project source that
1075 -- cannot be kept in the tree.
1077 -- N_Project_Declaration
1078 -- Indicates that there are unkept comments in the project.
1081 -- Indicates that this is not the last with in a with clause.
1082 -- Set for "A", but not for "B" in with "B"; and with "A", "B";
1084 Flag2 : Boolean := False;
1085 -- This flag is significant only for:
1088 -- Indicates that the project "extends all" another project.
1091 -- Indicates that the comment is followed by an empty line.
1094 -- Indicates that the originally imported project is an extending
1097 Comments : Project_Node_Id := Empty_Node;
1098 -- For nodes other that N_Comment_Zones or N_Comment, designates the
1099 -- comment zones associated with the node.
1101 -- For N_Comment_Zones, designates the comment after the "end" of
1104 -- For N_Comment, designates the next comment, if any.
1108 -- type Project_Node_Kind is
1111 -- -- Name: project name
1112 -- -- Path_Name: project path name
1113 -- -- Expr_Kind: Undefined
1114 -- -- Field1: first with clause
1115 -- -- Field2: project declaration
1116 -- -- Field3: first string type
1117 -- -- Field4: parent project, if any
1118 -- -- Value: extended project path name (if any)
1121 -- -- Name: imported project name
1122 -- -- Path_Name: imported project path name
1123 -- -- Expr_Kind: Undefined
1124 -- -- Field1: project node
1125 -- -- Field2: next with clause
1126 -- -- Field3: project node or empty if "limited with"
1127 -- -- Field4: not used
1128 -- -- Value: literal string withed
1130 -- N_Project_Declaration,
1131 -- -- Name: not used
1132 -- -- Path_Name: not used
1133 -- -- Expr_Kind: Undefined
1134 -- -- Field1: first declarative item
1135 -- -- Field2: extended project
1136 -- -- Field3: extending project
1137 -- -- Field4: not used
1138 -- -- Value: not used
1140 -- N_Declarative_Item,
1141 -- -- Name: not used
1142 -- -- Path_Name: not used
1143 -- -- Expr_Kind: Undefined
1144 -- -- Field1: current item node
1145 -- -- Field2: next declarative item
1146 -- -- Field3: not used
1147 -- -- Field4: not used
1148 -- -- Value: not used
1150 -- N_Package_Declaration,
1151 -- -- Name: package name
1152 -- -- Path_Name: not used
1153 -- -- Expr_Kind: Undefined
1154 -- -- Field1: project of renamed package (if any)
1155 -- -- Field2: first declarative item
1156 -- -- Field3: next package in project
1157 -- -- Field4: not used
1158 -- -- Value: not used
1160 -- N_String_Type_Declaration,
1161 -- -- Name: type name
1162 -- -- Path_Name: not used
1163 -- -- Expr_Kind: Undefined
1164 -- -- Field1: first literal string
1165 -- -- Field2: next string type
1166 -- -- Field3: not used
1167 -- -- Field4: not used
1168 -- -- Value: not used
1170 -- N_Literal_String,
1171 -- -- Name: not used
1172 -- -- Path_Name: not used
1173 -- -- Expr_Kind: Single
1174 -- -- Field1: next literal string
1175 -- -- Field2: not used
1176 -- -- Field3: not used
1177 -- -- Field4: not used
1178 -- -- Value: string value
1180 -- N_Attribute_Declaration,
1181 -- -- Name: attribute name
1182 -- -- Path_Name: not used
1183 -- -- Expr_Kind: attribute kind
1184 -- -- Field1: expression
1185 -- -- Field2: project of full associative array
1186 -- -- Field3: package of full associative array
1187 -- -- Field4: not used
1188 -- -- Value: associative array index
1189 -- -- (if an associative array element)
1191 -- N_Typed_Variable_Declaration,
1192 -- -- Name: variable name
1193 -- -- Path_Name: not used
1194 -- -- Expr_Kind: Single
1195 -- -- Field1: expression
1196 -- -- Field2: type of variable (N_String_Type_Declaration)
1197 -- -- Field3: next variable
1198 -- -- Field4: not used
1199 -- -- Value: not used
1201 -- N_Variable_Declaration,
1202 -- -- Name: variable name
1203 -- -- Path_Name: not used
1204 -- -- Expr_Kind: variable kind
1205 -- -- Field1: expression
1206 -- -- Field2: not used
1207 -- -- Field3 is used for next variable, instead of Field2,
1208 -- -- so that it is the same field for
1209 -- -- N_Variable_Declaration and
1210 -- -- N_Typed_Variable_Declaration
1211 -- -- Field3: next variable
1212 -- -- Field4: not used
1213 -- -- Value: not used
1216 -- -- Name: not used
1217 -- -- Path_Name: not used
1218 -- -- Expr_Kind: expression kind
1219 -- -- Field1: first term
1220 -- -- Field2: next expression in list
1221 -- -- Field3: not used
1222 -- -- Value: not used
1225 -- -- Name: not used
1226 -- -- Path_Name: not used
1227 -- -- Expr_Kind: term kind
1228 -- -- Field1: current term
1229 -- -- Field2: next term in the expression
1230 -- -- Field3: not used
1231 -- -- Field4: not used
1232 -- -- Value: not used
1234 -- N_Literal_String_List,
1235 -- -- Designates a list of string expressions between brackets
1236 -- -- separated by commas. The string expressions are not necessarily
1237 -- -- literal strings.
1238 -- -- Name: not used
1239 -- -- Path_Name: not used
1240 -- -- Expr_Kind: List
1241 -- -- Field1: first expression
1242 -- -- Field2: not used
1243 -- -- Field3: not used
1244 -- -- Field4: not used
1245 -- -- Value: not used
1247 -- N_Variable_Reference,
1248 -- -- Name: variable name
1249 -- -- Path_Name: not used
1250 -- -- Expr_Kind: variable kind
1251 -- -- Field1: project (if specified)
1252 -- -- Field2: package (if specified)
1253 -- -- Field3: type of variable (N_String_Type_Declaration), if any
1254 -- -- Field4: not used
1255 -- -- Value: not used
1257 -- N_External_Value,
1258 -- -- Name: not used
1259 -- -- Path_Name: not used
1260 -- -- Expr_Kind: Single
1261 -- -- Field1: Name of the external reference (literal string)
1262 -- -- Field2: Default (literal string)
1263 -- -- Field3: not used
1264 -- -- Value: not used
1266 -- N_Attribute_Reference,
1267 -- -- Name: attribute name
1268 -- -- Path_Name: not used
1269 -- -- Expr_Kind: attribute kind
1270 -- -- Field1: project
1271 -- -- Field2: package (if attribute of a package)
1272 -- -- Field3: not used
1273 -- -- Field4: not used
1274 -- -- Value: associative array index
1275 -- -- (if an associative array element)
1277 -- N_Case_Construction,
1278 -- -- Name: not used
1279 -- -- Path_Name: not used
1280 -- -- Expr_Kind: Undefined
1281 -- -- Field1: case variable reference
1282 -- -- Field2: first case item
1283 -- -- Field3: not used
1284 -- -- Field4: not used
1285 -- -- Value: not used
1288 -- -- Name: not used
1289 -- -- Path_Name: not used
1290 -- -- Expr_Kind: not used
1291 -- -- Field1: first choice (literal string), or Empty_Node
1292 -- -- for when others
1293 -- -- Field2: first declarative item
1294 -- -- Field3: next case item
1295 -- -- Field4: not used
1296 -- -- Value: not used
1299 -- -- Name: not used
1300 -- -- Path_Name: not used
1301 -- -- Expr_Kind: not used
1302 -- -- Field1: comment before the construct
1303 -- -- Field2: comment after the construct
1304 -- -- Field3: comment before the "end" of the construct
1305 -- -- Value: end of line comment
1306 -- -- Field4: not used
1307 -- -- Comments: comment after the "end" of the construct
1310 -- -- Name: not used
1311 -- -- Path_Name: not used
1312 -- -- Expr_Kind: not used
1313 -- -- Field1: not used
1314 -- -- Field2: not used
1315 -- -- Field3: not used
1316 -- -- Field4: not used
1317 -- -- Value: comment
1318 -- -- Flag1: comment is preceded by an empty line
1319 -- -- Flag2: comment is followed by an empty line
1320 -- -- Comments: next comment
1322 package Project_Node_Table is new
1324 (Table_Component_Type => Project_Node_Record,
1325 Table_Index_Type => Project_Node_Id,
1326 Table_Low_Bound => First_Node_Id,
1327 Table_Initial => Project_Nodes_Initial,
1328 Table_Increment => Project_Nodes_Increment);
1329 -- Table contains the syntactic tree of project data from project files
1331 type Project_Name_And_Node is record
1333 -- Name of the project
1335 Node : Project_Node_Id;
1336 -- Node of the project in table Project_Nodes
1338 Canonical_Path : Path_Name_Type;
1339 -- Resolved and canonical path of a real project file.
1340 -- No_Name in case of virtual projects.
1343 -- True when the project is being extended by another project
1345 Proj_Qualifier : Project_Qualifier;
1346 -- The project qualifier of the project, if any
1349 No_Project_Name_And_Node : constant Project_Name_And_Node :=
1352 Canonical_Path => No_Path,
1354 Proj_Qualifier => Unspecified);
1356 package Projects_Htable is new GNAT.Dynamic_HTables.Simple_HTable
1357 (Header_Num => Header_Num,
1358 Element => Project_Name_And_Node,
1359 No_Element => No_Project_Name_And_Node,
1363 -- This hash table contains a mapping of project names to project nodes.
1364 -- Note that this hash table contains only the nodes whose Kind is
1365 -- N_Project. It is used to find the node of a project from its name,
1366 -- and to verify if a project has already been parsed, knowing its name.
1368 end Tree_Private_Part;
1370 type Project_Node_Tree_Data is record
1371 Project_Nodes : Tree_Private_Part.Project_Node_Table.Instance;
1372 Projects_HT : Tree_Private_Part.Projects_Htable.Instance;
1374 -- The data for a project node tree
1376 procedure Free (Proj : in out Project_Node_Tree_Ref);
1377 -- Free memory used by Prj
1380 type Comment_Array is array (Positive range <>) of Comment_Data;
1381 type Comments_Ptr is access Comment_Array;
1383 type Comment_State is record
1384 End_Of_Line_Node : Project_Node_Id := Empty_Node;
1385 Previous_Line_Node : Project_Node_Id := Empty_Node;
1386 Previous_End_Node : Project_Node_Id := Empty_Node;
1387 Unkept_Comments : Boolean := False;
1388 Comments : Comments_Ptr := null;