1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
11 -- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
13 -- GNAT is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 2, or (at your option) any later ver- --
16 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
19 -- for more details. You should have received a copy of the GNU General --
20 -- Public License distributed with GNAT; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
24 -- GNAT was originally developed by the GNAT team at New York University. --
25 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
27 ------------------------------------------------------------------------------
29 pragma Style_Checks
(All_Checks
);
30 -- Turn off subprogram body ordering check. Subprograms are in order
31 -- by RM section rather than alphabetical
36 -----------------------
37 -- Local Subprograms --
38 -----------------------
40 function P_Use_Package_Clause
return Node_Id
;
41 function P_Use_Type_Clause
return Node_Id
;
47 -- USE_CLAUSE ::= USE_PACKAGE_CLAUSE | USE_TYPE_CLAUSE
49 -- The caller has checked that the initial token is USE
51 -- Error recovery: cannot raise Error_Resync
53 function P_Use_Clause
return Node_Id
is
57 if Token
= Tok_Type
then
58 return P_Use_Type_Clause
;
61 return P_Use_Package_Clause
;
65 -----------------------------
66 -- 8.4 Use Package Clause --
67 -----------------------------
69 -- USE_PACKAGE_CLAUSE ::= use package_NAME {, package_NAME};
71 -- The caller has scanned out the USE keyword
73 -- Error recovery: cannot raise Error_Resync
75 function P_Use_Package_Clause
return Node_Id
is
79 Use_Node
:= New_Node
(N_Use_Package_Clause
, Prev_Token_Ptr
);
80 Set_Names
(Use_Node
, New_List
);
82 if Token
= Tok_Package
then
83 Error_Msg_SC
("PACKAGE should not appear here");
88 Append
(P_Qualified_Simple_Name
, Names
(Use_Node
));
89 exit when Token
/= Tok_Comma
;
95 end P_Use_Package_Clause
;
97 --------------------------
98 -- 8.4 Use Type Clause --
99 --------------------------
101 -- USE_TYPE_CLAUSE ::= use type SUBTYPE_MARK {, SUBTYPE_MARK};
103 -- The caller has checked that the initial token is USE, scanned it out
104 -- and that the current token is TYPE.
106 -- Error recovery: cannot raise Error_Resync
108 function P_Use_Type_Clause
return Node_Id
is
112 Use_Node
:= New_Node
(N_Use_Type_Clause
, Prev_Token_Ptr
);
113 Set_Subtype_Marks
(Use_Node
, New_List
);
116 Error_Msg_SC
("(Ada 83) use type not allowed!");
122 Append
(P_Subtype_Mark
, Subtype_Marks
(Use_Node
));
124 exit when Token
/= Tok_Comma
;
130 end P_Use_Type_Clause
;
132 -------------------------------
133 -- 8.5 Renaming Declaration --
134 -------------------------------
136 -- Object renaming declarations and exception renaming declarations
137 -- are parsed by P_Identifier_Declaration (3.3.1)
139 -- Subprogram renaming declarations are parsed by P_Subprogram (6.1)
141 -- Package renaming declarations are parsed by P_Package (7.1)
143 -- Generic renaming declarations are parsed by P_Generic (12.1)
145 ----------------------------------------
146 -- 8.5.1 Object Renaming Declaration --
147 ----------------------------------------
149 -- Parsed by P_Identifier_Declarations (3.3.1)
151 ----------------------------------------
152 -- 8.5.2 Exception Renaming Declaration --
153 ----------------------------------------
155 -- Parsed by P_Identifier_Declarations (3.3.1)
157 -----------------------------------------
158 -- 8.5.3 Package Renaming Declaration --
159 -----------------------------------------
161 -- Parsed by P_Package (7.1)
163 --------------------------------------------
164 -- 8.5.4 Subprogram Renaming Declaration --
165 --------------------------------------------
167 -- Parsed by P_Subprogram (6.1)
169 -----------------------------------------
170 -- 8.5.2 Generic Renaming Declaration --
171 -----------------------------------------
173 -- Parsed by P_Generic (12.1)