OSDN Git Service

* gcc-interface/gigi.h (gnat_mark_addressable): Rename parameter.
[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 --          Copyright (C) 1992-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 pragma Style_Checks (All_Checks);
27 --  Turn off subprogram body ordering check. Subprograms are in order
28 --  by RM section rather than alphabetical
29
30 separate (Par)
31 package body Ch8 is
32
33    -----------------------
34    -- Local Subprograms --
35    -----------------------
36
37    function P_Use_Package_Clause                           return Node_Id;
38    function P_Use_Type_Clause                              return Node_Id;
39
40    ---------------------
41    -- 8.4  Use Clause --
42    ---------------------
43
44    --  USE_CLAUSE ::= USE_PACKAGE_CLAUSE | USE_TYPE_CLAUSE
45
46    --  The caller has checked that the initial token is USE
47
48    --  Error recovery: cannot raise Error_Resync
49
50    function P_Use_Clause return Node_Id is
51    begin
52       Scan; -- past USE
53
54       if Token = Tok_Type then
55          return P_Use_Type_Clause;
56
57       else
58          return P_Use_Package_Clause;
59       end if;
60    end P_Use_Clause;
61
62    -----------------------------
63    -- 8.4  Use Package Clause --
64    -----------------------------
65
66    --  USE_PACKAGE_CLAUSE ::= use package_NAME {, package_NAME};
67
68    --  The caller has scanned out the USE keyword
69
70    --  Error recovery: cannot raise Error_Resync
71
72    function P_Use_Package_Clause return Node_Id is
73       Use_Node : Node_Id;
74
75    begin
76       Use_Node := New_Node (N_Use_Package_Clause, Prev_Token_Ptr);
77       Set_Names (Use_Node, New_List);
78
79       if Token = Tok_Package then
80          Error_Msg_SC ("PACKAGE should not appear here");
81          Scan; -- past PACKAGE
82       end if;
83
84       loop
85          Append (P_Qualified_Simple_Name, Names (Use_Node));
86          exit when Token /= Tok_Comma;
87          Scan; -- past comma
88       end loop;
89
90       TF_Semicolon;
91       return Use_Node;
92    end P_Use_Package_Clause;
93
94    --------------------------
95    -- 8.4  Use Type Clause --
96    --------------------------
97
98    --  USE_TYPE_CLAUSE ::= use type SUBTYPE_MARK {, SUBTYPE_MARK};
99
100    --  The caller has checked that the initial token is USE, scanned it out
101    --  and that the current token is TYPE.
102
103    --  Error recovery: cannot raise Error_Resync
104
105    function P_Use_Type_Clause return Node_Id is
106       Use_Node : Node_Id;
107
108    begin
109       Use_Node := New_Node (N_Use_Type_Clause, Prev_Token_Ptr);
110       Set_Subtype_Marks (Use_Node, New_List);
111
112       if Ada_Version = Ada_83 then
113          Error_Msg_SC ("(Ada 83) use type not allowed!");
114       end if;
115
116       Scan; -- past TYPE
117
118       loop
119          Append (P_Subtype_Mark, Subtype_Marks (Use_Node));
120          No_Constraint;
121          exit when Token /= Tok_Comma;
122          Scan; -- past comma
123       end loop;
124
125       TF_Semicolon;
126       return Use_Node;
127    end P_Use_Type_Clause;
128
129    -------------------------------
130    -- 8.5  Renaming Declaration --
131    -------------------------------
132
133    --  Object renaming declarations and exception renaming declarations
134    --  are parsed by P_Identifier_Declaration (3.3.1)
135
136    --  Subprogram renaming declarations are parsed by P_Subprogram (6.1)
137
138    --  Package renaming declarations are parsed by P_Package (7.1)
139
140    --  Generic renaming declarations are parsed by P_Generic (12.1)
141
142    ----------------------------------------
143    -- 8.5.1  Object Renaming Declaration --
144    ----------------------------------------
145
146    --  Parsed by P_Identifier_Declarations (3.3.1)
147
148    ----------------------------------------
149    -- 8.5.2  Exception Renaming Declaration --
150    ----------------------------------------
151
152    --  Parsed by P_Identifier_Declarations (3.3.1)
153
154    -----------------------------------------
155    -- 8.5.3  Package Renaming Declaration --
156    -----------------------------------------
157
158    --  Parsed by P_Package (7.1)
159
160    --------------------------------------------
161    -- 8.5.4  Subprogram Renaming Declaration --
162    --------------------------------------------
163
164    --  Parsed by P_Subprogram (6.1)
165
166    -----------------------------------------
167    -- 8.5.2  Generic Renaming Declaration --
168    -----------------------------------------
169
170    --  Parsed by P_Generic (12.1)
171
172 end Ch8;