OSDN Git Service

2008-05-27 Thomas Quinot <quinot@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / prj-strt.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                             P R J . S T R T                              --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --          Copyright (C) 2001-2007, 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 --  This package implements parsing of string expressions in project files
27
28 with Prj.Tree;  use Prj.Tree;
29
30 private package Prj.Strt is
31
32    procedure Parse_String_Type_List
33      (In_Tree      : Project_Node_Tree_Ref;
34       First_String : out Project_Node_Id);
35    --  Get the list of literal strings that are allowed for a typed string.
36    --  On entry, the current token is the first literal string following
37    --  a left parenthesis in a string type declaration such as:
38    --    type Toto is ("string_1", "string_2", "string_3");
39    --  On exit, the current token is the right parenthesis.
40    --  The parameter First_String is a node that contained the first
41    --  literal string of the string type, linked with the following
42    --  literal strings.
43    --
44    --  Report an error if
45    --    - a literal string is not found at the beginning of the list
46    --      or after a comma
47    --    - two literal strings in the list are equal
48
49    procedure Start_New_Case_Construction
50      (In_Tree     : Project_Node_Tree_Ref;
51       String_Type : Project_Node_Id);
52    --  This procedure is called at the beginning of a case construction
53    --  The parameter String_Type is the node for the string type
54    --  of the case label variable.
55    --  The different literal strings of the string type are stored
56    --  into a table to be checked against the case labels of the
57    --  case construction.
58
59    procedure End_Case_Construction
60      (Check_All_Labels   : Boolean;
61       Case_Location      : Source_Ptr);
62    --  This procedure is called at the end of a case construction
63    --  to remove the case labels and to restore the previous state.
64    --  In particular, in the case of nested case constructions,
65    --  the case labels of the enclosing case construction are restored.
66    --  When When_Others is False and we are not in quiet output, a warning
67    --  is emitted for each value of the case variable string type that has
68    --  not been specified.
69
70    procedure Parse_Choice_List
71      (In_Tree      : Project_Node_Tree_Ref;
72       First_Choice : out Project_Node_Id);
73    --  Get the label for a choice list.
74    --  Report an error if
75    --    - a case label is not a literal string
76    --    - a case label is not in the typed string list
77    --    - the same case label is repeated in the same case construction
78
79    procedure Parse_Expression
80      (In_Tree         : Project_Node_Tree_Ref;
81       Expression      : out Project_Node_Id;
82       Current_Project : Project_Node_Id;
83       Current_Package : Project_Node_Id;
84       Optional_Index  : Boolean);
85    --  Parse a simple string expression or a string list expression.
86    --  Current_Project is the node of the project file being parsed.
87    --  Current_Package is the node of the package being parsed,
88    --  or Empty_Node when we are at the project level (not in a package).
89    --  On exit, Expression is the node of the expression that has
90    --  been parsed.
91
92    procedure Parse_Variable_Reference
93      (In_Tree         : Project_Node_Tree_Ref;
94       Variable        : out Project_Node_Id;
95       Current_Project : Project_Node_Id;
96       Current_Package : Project_Node_Id);
97    --  Parse a variable or attribute reference.
98    --  Used internally (in expressions) and for case variables (in Prj.Dect).
99    --  Current_Package is the node of the package being parsed,
100    --  or Empty_Node when we are at the project level (not in a package).
101    --  On exit, Variable is the node of the variable or attribute reference.
102    --  A variable reference is made of one to three simple names.
103    --  An attribute reference is made of one or two simple names,
104    --  followed by an apostrophe, followed by the attribute simple name.
105
106 end Prj.Strt;