Daily bump.
[official-gcc.git] / gcc / ada / par-ch8.adb
blob9d1b386280db07164422ab4ce04943b8e7a47d13
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- P A R . C H 8 --
6 -- --
7 -- B o d y --
8 -- --
9 -- $Revision: 1.16 $
10 -- --
11 -- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
12 -- --
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. --
23 -- --
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). --
26 -- --
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
33 separate (Par)
34 package body Ch8 is
36 -----------------------
37 -- Local Subprograms --
38 -----------------------
40 function P_Use_Package_Clause return Node_Id;
41 function P_Use_Type_Clause return Node_Id;
43 ---------------------
44 -- 8.4 Use Clause --
45 ---------------------
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
54 begin
55 Scan; -- past USE
57 if Token = Tok_Type then
58 return P_Use_Type_Clause;
60 else
61 return P_Use_Package_Clause;
62 end if;
63 end P_Use_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
76 Use_Node : Node_Id;
78 begin
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");
84 Scan; -- past PACKAGE
85 end if;
87 loop
88 Append (P_Qualified_Simple_Name, Names (Use_Node));
89 exit when Token /= Tok_Comma;
90 Scan; -- past comma
91 end loop;
93 TF_Semicolon;
94 return Use_Node;
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
109 Use_Node : Node_Id;
111 begin
112 Use_Node := New_Node (N_Use_Type_Clause, Prev_Token_Ptr);
113 Set_Subtype_Marks (Use_Node, New_List);
115 if Ada_83 then
116 Error_Msg_SC ("(Ada 83) use type not allowed!");
117 end if;
119 Scan; -- past TYPE
121 loop
122 Append (P_Subtype_Mark, Subtype_Marks (Use_Node));
123 No_Constraint;
124 exit when Token /= Tok_Comma;
125 Scan; -- past comma
126 end loop;
128 TF_Semicolon;
129 return Use_Node;
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)
175 end Ch8;