1 |
706 |
jeremybenn |
------------------------------------------------------------------------------
|
2 |
|
|
-- --
|
3 |
|
|
-- GNAT COMPILER COMPONENTS --
|
4 |
|
|
-- --
|
5 |
|
|
-- P R J . P A R T --
|
6 |
|
|
-- --
|
7 |
|
|
-- S p e c --
|
8 |
|
|
-- --
|
9 |
|
|
-- Copyright (C) 2000-2011, Free Software Foundation, Inc. --
|
10 |
|
|
-- --
|
11 |
|
|
-- GNAT is free software; you can redistribute it and/or modify it under --
|
12 |
|
|
-- terms of the GNU General Public License as published by the Free Soft- --
|
13 |
|
|
-- ware Foundation; either version 3, or (at your option) any later ver- --
|
14 |
|
|
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
|
15 |
|
|
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
|
16 |
|
|
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
|
17 |
|
|
-- for more details. You should have received a copy of the GNU General --
|
18 |
|
|
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
|
19 |
|
|
-- http://www.gnu.org/licenses for a complete copy of the license. --
|
20 |
|
|
-- --
|
21 |
|
|
-- GNAT was originally developed by the GNAT team at New York University. --
|
22 |
|
|
-- Extensive contributions were provided by Ada Core Technologies Inc. --
|
23 |
|
|
-- --
|
24 |
|
|
------------------------------------------------------------------------------
|
25 |
|
|
|
26 |
|
|
-- Implements the parsing of project files into a tree
|
27 |
|
|
|
28 |
|
|
with Prj.Tree; use Prj.Tree;
|
29 |
|
|
|
30 |
|
|
package Prj.Part is
|
31 |
|
|
|
32 |
|
|
type Errout_Mode is
|
33 |
|
|
(Always_Finalize,
|
34 |
|
|
Finalize_If_Error,
|
35 |
|
|
Never_Finalize);
|
36 |
|
|
-- Whether Parse should call Errout.Finalize (which prints the error
|
37 |
|
|
-- messages on stdout). When Never_Finalize is used, Errout is not reset
|
38 |
|
|
-- either at the beginning of Parse.
|
39 |
|
|
|
40 |
|
|
procedure Parse
|
41 |
|
|
(In_Tree : Project_Node_Tree_Ref;
|
42 |
|
|
Project : out Project_Node_Id;
|
43 |
|
|
Project_File_Name : String;
|
44 |
|
|
Errout_Handling : Errout_Mode := Always_Finalize;
|
45 |
|
|
Packages_To_Check : String_List_Access;
|
46 |
|
|
Store_Comments : Boolean := False;
|
47 |
|
|
Current_Directory : String := "";
|
48 |
|
|
Is_Config_File : Boolean;
|
49 |
|
|
Env : in out Prj.Tree.Environment;
|
50 |
|
|
Target_Name : String := "");
|
51 |
|
|
-- Parse project file and all its imported project files and create a tree.
|
52 |
|
|
-- Return the node for the project (or Empty_Node if parsing failed). If
|
53 |
|
|
-- Always_Errout_Finalize is True, Errout.Finalize is called in all cases,
|
54 |
|
|
-- Otherwise, Errout.Finalize is only called if there are errors (but not
|
55 |
|
|
-- if there are only warnings). Packages_To_Check indicates the packages
|
56 |
|
|
-- where any unknown attribute produces an error. For other packages, an
|
57 |
|
|
-- unknown attribute produces a warning. When Store_Comments is True,
|
58 |
|
|
-- comments are stored in the parse tree.
|
59 |
|
|
--
|
60 |
|
|
-- Current_Directory is used for optimization purposes only, avoiding extra
|
61 |
|
|
-- system calls.
|
62 |
|
|
--
|
63 |
|
|
-- Is_Config_File should be set to True if the project represents a config
|
64 |
|
|
-- file (.cgpr) since some specific checks apply.
|
65 |
|
|
--
|
66 |
|
|
-- Target_Name will be used to initialize the default project path, unless
|
67 |
|
|
-- In_Tree.Project_Path has already been initialized (which is the
|
68 |
|
|
-- recommended use).
|
69 |
|
|
|
70 |
|
|
end Prj.Part;
|