objc-act.c (synth_module_prologue): Use TREE_NO_WARNING instead of DECL_IN_SYSTEM_HEADER.
[official-gcc.git] / gcc / ada / scans.adb
blob4422064b28fd0245ec58fa06ea2df9817fefe7f7
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S C A N S --
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 2, 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 COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
21 -- --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
28 -- --
29 -- GNAT was originally developed by the GNAT team at New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
31 -- --
32 ------------------------------------------------------------------------------
34 with Snames; use Snames;
36 package body Scans is
38 -----------------------------
39 -- Initialize_Ada_Keywords --
40 -----------------------------
42 procedure Initialize_Ada_Keywords is
43 procedure Set_Reserved (N : Name_Id; T : Token_Type);
44 pragma Inline (Set_Reserved);
45 -- Set given name as a reserved word (T is the corresponding token)
47 ------------------
48 -- Set_Reserved --
49 ------------------
51 procedure Set_Reserved (N : Name_Id; T : Token_Type) is
52 begin
53 -- Set up Token_Type values in Names table entries for reserved
54 -- words. We use the Pos value of the Token_Type value. Note that
55 -- Is_Keyword_Name relies on the fact that Token_Type'Val (0) is not
56 -- a reserved word!
58 Set_Name_Table_Byte (N, Token_Type'Pos (T));
59 end Set_Reserved;
61 -- Start of processing for Initialize_Ada_Keywords
63 begin
64 -- Establish reserved words
66 Set_Reserved (Name_Abort, Tok_Abort);
67 Set_Reserved (Name_Abs, Tok_Abs);
68 Set_Reserved (Name_Abstract, Tok_Abstract);
69 Set_Reserved (Name_Accept, Tok_Accept);
70 Set_Reserved (Name_Access, Tok_Access);
71 Set_Reserved (Name_And, Tok_And);
72 Set_Reserved (Name_Aliased, Tok_Aliased);
73 Set_Reserved (Name_All, Tok_All);
74 Set_Reserved (Name_Array, Tok_Array);
75 Set_Reserved (Name_At, Tok_At);
76 Set_Reserved (Name_Begin, Tok_Begin);
77 Set_Reserved (Name_Body, Tok_Body);
78 Set_Reserved (Name_Case, Tok_Case);
79 Set_Reserved (Name_Constant, Tok_Constant);
80 Set_Reserved (Name_Declare, Tok_Declare);
81 Set_Reserved (Name_Delay, Tok_Delay);
82 Set_Reserved (Name_Delta, Tok_Delta);
83 Set_Reserved (Name_Digits, Tok_Digits);
84 Set_Reserved (Name_Do, Tok_Do);
85 Set_Reserved (Name_Else, Tok_Else);
86 Set_Reserved (Name_Elsif, Tok_Elsif);
87 Set_Reserved (Name_End, Tok_End);
88 Set_Reserved (Name_Entry, Tok_Entry);
89 Set_Reserved (Name_Exception, Tok_Exception);
90 Set_Reserved (Name_Exit, Tok_Exit);
91 Set_Reserved (Name_For, Tok_For);
92 Set_Reserved (Name_Function, Tok_Function);
93 Set_Reserved (Name_Generic, Tok_Generic);
94 Set_Reserved (Name_Goto, Tok_Goto);
95 Set_Reserved (Name_If, Tok_If);
96 Set_Reserved (Name_In, Tok_In);
97 Set_Reserved (Name_Is, Tok_Is);
98 Set_Reserved (Name_Limited, Tok_Limited);
99 Set_Reserved (Name_Loop, Tok_Loop);
100 Set_Reserved (Name_Mod, Tok_Mod);
101 Set_Reserved (Name_New, Tok_New);
102 Set_Reserved (Name_Not, Tok_Not);
103 Set_Reserved (Name_Null, Tok_Null);
104 Set_Reserved (Name_Of, Tok_Of);
105 Set_Reserved (Name_Or, Tok_Or);
106 Set_Reserved (Name_Others, Tok_Others);
107 Set_Reserved (Name_Out, Tok_Out);
108 Set_Reserved (Name_Package, Tok_Package);
109 Set_Reserved (Name_Pragma, Tok_Pragma);
110 Set_Reserved (Name_Private, Tok_Private);
111 Set_Reserved (Name_Procedure, Tok_Procedure);
112 Set_Reserved (Name_Protected, Tok_Protected);
113 Set_Reserved (Name_Raise, Tok_Raise);
114 Set_Reserved (Name_Range, Tok_Range);
115 Set_Reserved (Name_Record, Tok_Record);
116 Set_Reserved (Name_Rem, Tok_Rem);
117 Set_Reserved (Name_Renames, Tok_Renames);
118 Set_Reserved (Name_Requeue, Tok_Requeue);
119 Set_Reserved (Name_Return, Tok_Return);
120 Set_Reserved (Name_Reverse, Tok_Reverse);
121 Set_Reserved (Name_Select, Tok_Select);
122 Set_Reserved (Name_Separate, Tok_Separate);
123 Set_Reserved (Name_Subtype, Tok_Subtype);
124 Set_Reserved (Name_Tagged, Tok_Tagged);
125 Set_Reserved (Name_Task, Tok_Task);
126 Set_Reserved (Name_Terminate, Tok_Terminate);
127 Set_Reserved (Name_Then, Tok_Then);
128 Set_Reserved (Name_Type, Tok_Type);
129 Set_Reserved (Name_Until, Tok_Until);
130 Set_Reserved (Name_Use, Tok_Use);
131 Set_Reserved (Name_When, Tok_When);
132 Set_Reserved (Name_While, Tok_While);
133 Set_Reserved (Name_With, Tok_With);
134 Set_Reserved (Name_Xor, Tok_Xor);
136 -- Ada 2005 reserved words
138 Set_Reserved (Name_Interface, Tok_Interface);
139 Set_Reserved (Name_Overriding, Tok_Overriding);
140 Set_Reserved (Name_Synchronized, Tok_Synchronized);
142 end Initialize_Ada_Keywords;
144 ------------------------
145 -- Restore_Scan_State --
146 ------------------------
148 procedure Restore_Scan_State (Saved_State : Saved_Scan_State) is
149 begin
150 Scan_Ptr := Saved_State.Save_Scan_Ptr;
151 Token := Saved_State.Save_Token;
152 Token_Ptr := Saved_State.Save_Token_Ptr;
153 Current_Line_Start := Saved_State.Save_Current_Line_Start;
154 Start_Column := Saved_State.Save_Start_Column;
155 Checksum := Saved_State.Save_Checksum;
156 First_Non_Blank_Location := Saved_State.Save_First_Non_Blank_Location;
157 Token_Node := Saved_State.Save_Token_Node;
158 Token_Name := Saved_State.Save_Token_Name;
159 Prev_Token := Saved_State.Save_Prev_Token;
160 Prev_Token_Ptr := Saved_State.Save_Prev_Token_Ptr;
161 end Restore_Scan_State;
163 ---------------------
164 -- Save_Scan_State --
165 ---------------------
167 procedure Save_Scan_State (Saved_State : out Saved_Scan_State) is
168 begin
169 Saved_State.Save_Scan_Ptr := Scan_Ptr;
170 Saved_State.Save_Token := Token;
171 Saved_State.Save_Token_Ptr := Token_Ptr;
172 Saved_State.Save_Current_Line_Start := Current_Line_Start;
173 Saved_State.Save_Start_Column := Start_Column;
174 Saved_State.Save_Checksum := Checksum;
175 Saved_State.Save_First_Non_Blank_Location := First_Non_Blank_Location;
176 Saved_State.Save_Token_Node := Token_Node;
177 Saved_State.Save_Token_Name := Token_Name;
178 Saved_State.Save_Prev_Token := Prev_Token;
179 Saved_State.Save_Prev_Token_Ptr := Prev_Token_Ptr;
180 end Save_Scan_State;
182 end Scans;