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