OSDN Git Service

Delete all lines containing "$Revision:".
[pf3gnuchains/gcc-fork.git] / gcc / ada / par-ch8.adb
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                              P A R . C H 8                               --
6 --                                                                          --
7 --                                 B o d y                                  --
8 --                                                                          --
9 --                                                                          --
10 --          Copyright (C) 1992-2001 Free Software Foundation, Inc.          --
11 --                                                                          --
12 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
13 -- terms of the  GNU General Public License as published  by the Free Soft- --
14 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
15 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
18 -- for  more details.  You should have  received  a copy of the GNU General --
19 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
20 -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
21 -- MA 02111-1307, USA.                                                      --
22 --                                                                          --
23 -- GNAT was originally developed  by the GNAT team at  New York University. --
24 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
25 --                                                                          --
26 ------------------------------------------------------------------------------
27
28 pragma Style_Checks (All_Checks);
29 --  Turn off subprogram body ordering check. Subprograms are in order
30 --  by RM section rather than alphabetical
31
32 separate (Par)
33 package body Ch8 is
34
35    -----------------------
36    -- Local Subprograms --
37    -----------------------
38
39    function P_Use_Package_Clause                           return Node_Id;
40    function P_Use_Type_Clause                              return Node_Id;
41
42    ---------------------
43    -- 8.4  Use Clause --
44    ---------------------
45
46    --  USE_CLAUSE ::= USE_PACKAGE_CLAUSE | USE_TYPE_CLAUSE
47
48    --  The caller has checked that the initial token is USE
49
50    --  Error recovery: cannot raise Error_Resync
51
52    function P_Use_Clause return Node_Id is
53    begin
54       Scan; -- past USE
55
56       if Token = Tok_Type then
57          return P_Use_Type_Clause;
58
59       else
60          return P_Use_Package_Clause;
61       end if;
62    end P_Use_Clause;
63
64    -----------------------------
65    -- 8.4  Use Package Clause --
66    -----------------------------
67
68    --  USE_PACKAGE_CLAUSE ::= use package_NAME {, package_NAME};
69
70    --  The caller has scanned out the USE keyword
71
72    --  Error recovery: cannot raise Error_Resync
73
74    function P_Use_Package_Clause return Node_Id is
75       Use_Node : Node_Id;
76
77    begin
78       Use_Node := New_Node (N_Use_Package_Clause, Prev_Token_Ptr);
79       Set_Names (Use_Node, New_List);
80
81       if Token = Tok_Package then
82          Error_Msg_SC ("PACKAGE should not appear here");
83          Scan; -- past PACKAGE
84       end if;
85
86       loop
87          Append (P_Qualified_Simple_Name, Names (Use_Node));
88          exit when Token /= Tok_Comma;
89          Scan; -- past comma
90       end loop;
91
92       TF_Semicolon;
93       return Use_Node;
94    end P_Use_Package_Clause;
95
96    --------------------------
97    -- 8.4  Use Type Clause --
98    --------------------------
99
100    --  USE_TYPE_CLAUSE ::= use type SUBTYPE_MARK {, SUBTYPE_MARK};
101
102    --  The caller has checked that the initial token is USE, scanned it out
103    --  and that the current token is TYPE.
104
105    --  Error recovery: cannot raise Error_Resync
106
107    function P_Use_Type_Clause return Node_Id is
108       Use_Node : Node_Id;
109
110    begin
111       Use_Node := New_Node (N_Use_Type_Clause, Prev_Token_Ptr);
112       Set_Subtype_Marks (Use_Node, New_List);
113
114       if Ada_83 then
115          Error_Msg_SC ("(Ada 83) use type not allowed!");
116       end if;
117
118       Scan; -- past TYPE
119
120       loop
121          Append (P_Subtype_Mark, Subtype_Marks (Use_Node));
122          No_Constraint;
123          exit when Token /= Tok_Comma;
124          Scan; -- past comma
125       end loop;
126
127       TF_Semicolon;
128       return Use_Node;
129    end P_Use_Type_Clause;
130
131    -------------------------------
132    -- 8.5  Renaming Declaration --
133    -------------------------------
134
135    --  Object renaming declarations and exception renaming declarations
136    --  are parsed by P_Identifier_Declaration (3.3.1)
137
138    --  Subprogram renaming declarations are parsed by P_Subprogram (6.1)
139
140    --  Package renaming declarations are parsed by P_Package (7.1)
141
142    --  Generic renaming declarations are parsed by P_Generic (12.1)
143
144    ----------------------------------------
145    -- 8.5.1  Object Renaming Declaration --
146    ----------------------------------------
147
148    --  Parsed by P_Identifier_Declarations (3.3.1)
149
150    ----------------------------------------
151    -- 8.5.2  Exception Renaming Declaration --
152    ----------------------------------------
153
154    --  Parsed by P_Identifier_Declarations (3.3.1)
155
156    -----------------------------------------
157    -- 8.5.3  Package Renaming Declaration --
158    -----------------------------------------
159
160    --  Parsed by P_Package (7.1)
161
162    --------------------------------------------
163    -- 8.5.4  Subprogram Renaming Declaration --
164    --------------------------------------------
165
166    --  Parsed by P_Subprogram (6.1)
167
168    -----------------------------------------
169    -- 8.5.2  Generic Renaming Declaration --
170    -----------------------------------------
171
172    --  Parsed by P_Generic (12.1)
173
174 end Ch8;