aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/scans.adb
diff options
context:
space:
mode:
authorThomas Quinot <quinot@adacore.com>2006-02-15 10:32:12 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2006-02-15 10:32:12 +0100
commit68e2ea275783d8b96d51913913fe88b4f61ee0c9 (patch)
treed3b7db1cb334e3cd4b6396c5d647f032daea89f5 /gcc/ada/scans.adb
parent6f301919dc530893fa43e994531ff347f955000a (diff)
downloadgcc-68e2ea275783d8b96d51913913fe88b4f61ee0c9.zip
gcc-68e2ea275783d8b96d51913913fe88b4f61ee0c9.tar.gz
gcc-68e2ea275783d8b96d51913913fe88b4f61ee0c9.tar.bz2
ali-util.adb (Get_File_Checksum): Update to account for change in profile of Initialize_Scanner.
2006-02-13 Thomas Quinot <quinot@adacore.com> Vincent Celier <celier@adacore.com> Robert Dewar <dewar@adacore.com> * ali-util.adb (Get_File_Checksum): Update to account for change in profile of Initialize_Scanner. * gprep.adb (Gnatprep): Update to account for change in profile of Initialize_Scanner. (Process_One_File): Same. * lib.adb (Get_Code_Or_Source_Unit): New subprogram factoring the common code between Get_Code_Unit and Get_Source_Unit. Reimplement that behaviour using the new Unit information recorded in the source files table, rather than going through all units every time. (Get_Code_Unit): Reimplement in terms of Get_Code_Or_Source_Unit. (Get_Source_Unit): Same. * prepcomp.adb (Parse_Preprocessing_Data_File): Update to account for change in profile of Initialize_Scanner. (Prepare_To_Preprocess): Same. * lib.ads: Fix typo in comment (templace -> template). * prj-part.adb (Parse_Single_Project): Update to account for change in profile of Initialize_Scanner. * scn.adb (Initialize_Scanner): Account for change in profile of Scng.Initialize_Scanner: set Current_Source_Unit in Scn instead of Scng. Also record the association of the given Source_File_Index to the corresponding Unit_Number_Type. * scng.ads, scng.adb (Initialize_Scanner.Set_Reserved): Remove procedure. (Initialize_Scanner): Call Scans.Initialize_Ada_Keywords. Remove Unit formal for generic scanner: this formal is only relevant to Scn (the scanner instance used to parse Ada source files), not to other instances. Update comment accordingly. (Scan): Use new function Snames.Is_Keyword_Name. * sinfo-cn.adb: Fix typo in comment. * sinput.adb (Unit, Set_Unit): Accessors for new source file attribute Unit. * sinput.ads (Source_File_Record): New component Unit, used to capture the unit identifier (if any) associated to a source file. * sinput-c.adb, sinput-l.adb (Load_File): Initialize new component Unit in Source_File_Record. * sinput-p.adb (Source_File_Is_Subunit): Update to account for change in profile of Initialize_Scanner. * scans.adb (Initialize_Ada_Keywords): New procedure * scans.ads (Initialize_Ada_Keywords): New procedure to initialize the Ada keywords in the Namet table, without the need to call Initialize_Scanner. * snames.adb: Add pragma Ada_2005 (synonym for Ada_05) (Is_Keyword_Name): New function * snames.ads: Add subtype Configuration_Pragma_Names Add pragma Ada_2005 (synonym for Ada_05) (Is_Keyword_Name): New function * snames.h: Add pragma Ada_2005 (synonym for Ada_05) From-SVN: r111032
Diffstat (limited to 'gcc/ada/scans.adb')
-rw-r--r--gcc/ada/scans.adb113
1 files changed, 111 insertions, 2 deletions
diff --git a/gcc/ada/scans.adb b/gcc/ada/scans.adb
index 42c393f..a22fdfd 100644
--- a/gcc/ada/scans.adb
+++ b/gcc/ada/scans.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2006, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -31,13 +31,122 @@
-- --
------------------------------------------------------------------------------
+with Namet; use Namet;
+with Snames; use Snames;
+
package body Scans is
+ -----------------------------
+ -- Initialize_Ada_Keywords --
+ -----------------------------
+
+ procedure Initialize_Ada_Keywords is
+ procedure Set_Reserved (N : Name_Id; T : Token_Type);
+ pragma Inline (Set_Reserved);
+ -- Set given name as a reserved word (T is the corresponding token)
+
+ ------------------
+ -- Set_Reserved --
+ ------------------
+
+ procedure Set_Reserved (N : Name_Id; T : Token_Type) is
+ begin
+ -- Set up Token_Type values in Names table entries for reserved
+ -- words. We use the Pos value of the Token_Type value. Note that
+ -- Is_Keyword_Name relies on the fact that Token_Type'Val (0) is not
+ -- a reserved word!
+
+ Set_Name_Table_Byte (N, Token_Type'Pos (T));
+ end Set_Reserved;
+
+ -- Start of processing for Initialize_Ada_Keywords
+
+ begin
+ -- Establish reserved words
+
+ Set_Reserved (Name_Abort, Tok_Abort);
+ Set_Reserved (Name_Abs, Tok_Abs);
+ Set_Reserved (Name_Abstract, Tok_Abstract);
+ Set_Reserved (Name_Accept, Tok_Accept);
+ Set_Reserved (Name_Access, Tok_Access);
+ Set_Reserved (Name_And, Tok_And);
+ Set_Reserved (Name_Aliased, Tok_Aliased);
+ Set_Reserved (Name_All, Tok_All);
+ Set_Reserved (Name_Array, Tok_Array);
+ Set_Reserved (Name_At, Tok_At);
+ Set_Reserved (Name_Begin, Tok_Begin);
+ Set_Reserved (Name_Body, Tok_Body);
+ Set_Reserved (Name_Case, Tok_Case);
+ Set_Reserved (Name_Constant, Tok_Constant);
+ Set_Reserved (Name_Declare, Tok_Declare);
+ Set_Reserved (Name_Delay, Tok_Delay);
+ Set_Reserved (Name_Delta, Tok_Delta);
+ Set_Reserved (Name_Digits, Tok_Digits);
+ Set_Reserved (Name_Do, Tok_Do);
+ Set_Reserved (Name_Else, Tok_Else);
+ Set_Reserved (Name_Elsif, Tok_Elsif);
+ Set_Reserved (Name_End, Tok_End);
+ Set_Reserved (Name_Entry, Tok_Entry);
+ Set_Reserved (Name_Exception, Tok_Exception);
+ Set_Reserved (Name_Exit, Tok_Exit);
+ Set_Reserved (Name_For, Tok_For);
+ Set_Reserved (Name_Function, Tok_Function);
+ Set_Reserved (Name_Generic, Tok_Generic);
+ Set_Reserved (Name_Goto, Tok_Goto);
+ Set_Reserved (Name_If, Tok_If);
+ Set_Reserved (Name_In, Tok_In);
+ Set_Reserved (Name_Is, Tok_Is);
+ Set_Reserved (Name_Limited, Tok_Limited);
+ Set_Reserved (Name_Loop, Tok_Loop);
+ Set_Reserved (Name_Mod, Tok_Mod);
+ Set_Reserved (Name_New, Tok_New);
+ Set_Reserved (Name_Not, Tok_Not);
+ Set_Reserved (Name_Null, Tok_Null);
+ Set_Reserved (Name_Of, Tok_Of);
+ Set_Reserved (Name_Or, Tok_Or);
+ Set_Reserved (Name_Others, Tok_Others);
+ Set_Reserved (Name_Out, Tok_Out);
+ Set_Reserved (Name_Package, Tok_Package);
+ Set_Reserved (Name_Pragma, Tok_Pragma);
+ Set_Reserved (Name_Private, Tok_Private);
+ Set_Reserved (Name_Procedure, Tok_Procedure);
+ Set_Reserved (Name_Protected, Tok_Protected);
+ Set_Reserved (Name_Raise, Tok_Raise);
+ Set_Reserved (Name_Range, Tok_Range);
+ Set_Reserved (Name_Record, Tok_Record);
+ Set_Reserved (Name_Rem, Tok_Rem);
+ Set_Reserved (Name_Renames, Tok_Renames);
+ Set_Reserved (Name_Requeue, Tok_Requeue);
+ Set_Reserved (Name_Return, Tok_Return);
+ Set_Reserved (Name_Reverse, Tok_Reverse);
+ Set_Reserved (Name_Select, Tok_Select);
+ Set_Reserved (Name_Separate, Tok_Separate);
+ Set_Reserved (Name_Subtype, Tok_Subtype);
+ Set_Reserved (Name_Tagged, Tok_Tagged);
+ Set_Reserved (Name_Task, Tok_Task);
+ Set_Reserved (Name_Terminate, Tok_Terminate);
+ Set_Reserved (Name_Then, Tok_Then);
+ Set_Reserved (Name_Type, Tok_Type);
+ Set_Reserved (Name_Until, Tok_Until);
+ Set_Reserved (Name_Use, Tok_Use);
+ Set_Reserved (Name_When, Tok_When);
+ Set_Reserved (Name_While, Tok_While);
+ Set_Reserved (Name_With, Tok_With);
+ Set_Reserved (Name_Xor, Tok_Xor);
+
+ -- Ada 2005 reserved words
+
+ Set_Reserved (Name_Interface, Tok_Interface);
+ Set_Reserved (Name_Overriding, Tok_Overriding);
+ Set_Reserved (Name_Synchronized, Tok_Synchronized);
+
+ end Initialize_Ada_Keywords;
+
------------------------
-- Restore_Scan_State --
------------------------
- procedure Restore_Scan_State (Saved_State : in Saved_Scan_State) is
+ procedure Restore_Scan_State (Saved_State : Saved_Scan_State) is
begin
Scan_Ptr := Saved_State.Save_Scan_Ptr;
Token := Saved_State.Save_Token;