summaryrefslogtreecommitdiff
path: root/gcc/ada/scng.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-15 09:32:12 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-15 09:32:12 +0000
commitec677a6c3a40284ccffa6de052697c0f56bc92d3 (patch)
treed3b7db1cb334e3cd4b6396c5d647f032daea89f5 /gcc/ada/scng.adb
parent5910b3704b24a6d29d5f01e71284b0ae7eba8f54 (diff)
downloadgcc-ec677a6c3a40284ccffa6de052697c0f56bc92d3.tar.gz
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) git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111032 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/scng.adb')
-rw-r--r--gcc/ada/scng.adb110
1 files changed, 4 insertions, 106 deletions
diff --git a/gcc/ada/scng.adb b/gcc/ada/scng.adb
index 1f1fe156266..ad7f3b38712 100644
--- a/gcc/ada/scng.adb
+++ b/gcc/ada/scng.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2005 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- --
@@ -141,113 +141,16 @@ package body Scng is
-- Initialize_Scanner --
------------------------
- procedure Initialize_Scanner
- (Unit : Unit_Number_Type;
- Index : Source_File_Index)
- is
- procedure Set_Reserved (N : Name_Id; T : Token_Type);
- pragma Inline (Set_Reserved);
- -- Set given name as a reserved keyword (T is the corresponding token)
-
- -------------
- -- Set_NTB --
- -------------
-
- procedure Set_Reserved (N : Name_Id; T : Token_Type) is
- begin
- -- Set up Token_Type values in Names Table entries for reserved
- -- keywords We use the Pos value of the Token_Type value. Note we
- -- rely 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_Scanner
-
+ procedure Initialize_Scanner (Index : Source_File_Index) is
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);
+ Scans.Initialize_Ada_Keywords;
-- Initialize scan control variables
Current_Source_File := Index;
Source := Source_Text (Current_Source_File);
- Current_Source_Unit := Unit;
Scan_Ptr := Source_First (Current_Source_File);
Token := No_Token;
Token_Ptr := Scan_Ptr;
@@ -2330,12 +2233,7 @@ package body Scng is
-- Here is where we check if it was a keyword
- if Get_Name_Table_Byte (Token_Name) /= 0
- and then (Ada_Version >= Ada_95
- or else Token_Name not in Ada_95_Reserved_Words)
- and then (Ada_Version >= Ada_05
- or else Token_Name not in Ada_2005_Reserved_Words)
- then
+ if Is_Keyword_Name (Token_Name) then
Token := Token_Type'Val (Get_Name_Table_Byte (Token_Name));
-- Deal with possible style check for non-lower case keyword, but