-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2004 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- --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
--- MA 02111-1307, USA. --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
with Atree; use Atree;
with Csets; use Csets;
+with Hostparm; use Hostparm;
with Namet; use Namet;
with Opt; use Opt;
with Restrict; use Restrict;
with Scans; use Scans;
with Sinfo; use Sinfo;
with Sinput; use Sinput;
+with Uintp; use Uintp;
package body Scn is
-- keyword as an identifier once for a given keyword).
procedure Check_End_Of_Line;
- -- Called when end of line encountered. Checks that line is not
- -- too long, and that other style checks for the end of line are met.
+ -- Called when end of line encountered. Checks that line is not too long,
+ -- and that other style checks for the end of line are met.
function Determine_License return License_Type;
-- Scan header of file and check that it has an appropriate GNAT-style
procedure Error_Long_Line;
-- Signal error of excessively long line
- ---------------
- -- Post_Scan --
- ---------------
-
- procedure Post_Scan is
- begin
- case Token is
- when Tok_Char_Literal =>
- Token_Node := New_Node (N_Character_Literal, Token_Ptr);
- Set_Char_Literal_Value (Token_Node, Character_Code);
- Set_Chars (Token_Node, Token_Name);
-
- when Tok_Identifier =>
- Token_Node := New_Node (N_Identifier, Token_Ptr);
- Set_Chars (Token_Node, Token_Name);
-
- when Tok_Real_Literal =>
- Token_Node := New_Node (N_Real_Literal, Token_Ptr);
- Set_Realval (Token_Node, Real_Literal_Value);
-
- when Tok_Integer_Literal =>
- Token_Node := New_Node (N_Integer_Literal, Token_Ptr);
- Set_Intval (Token_Node, Int_Literal_Value);
-
- when Tok_String_Literal =>
- Token_Node := New_Node (N_String_Literal, Token_Ptr);
- Set_Has_Wide_Character (Token_Node, Wide_Character_Found);
- Set_Strval (Token_Node, String_Literal_Id);
-
- when Tok_Operator_Symbol =>
- Token_Node := New_Node (N_Operator_Symbol, Token_Ptr);
- Set_Chars (Token_Node, Token_Name);
- Set_Strval (Token_Node, String_Literal_Id);
-
- when others =>
- null;
- end case;
- end Post_Scan;
-
-----------------------
-- Check_End_Of_Line --
-----------------------
begin
if Style_Check then
Style.Check_Line_Terminator (Len);
- elsif Len > Opt.Max_Line_Length then
+ elsif Len > Max_Line_Length then
Error_Long_Line;
end if;
end Check_End_Of_Line;
begin
Error_Msg
("this line is too long",
- Current_Line_Start + Source_Ptr (Opt.Max_Line_Length));
+ Current_Line_Start + Source_Ptr (Max_Line_Length));
end Error_Long_Line;
------------------------
GNAT_Hedr : constant Text_Buffer (1 .. 78) := (others => '-');
begin
- Scanner.Initialize_Scanner (Unit, Index);
+ Scanner.Initialize_Scanner (Index);
+
+ if Index /= Internal_Source_File then
+ Set_Unit (Index, Unit);
+ end if;
+
+ Current_Source_Unit := Unit;
-- Set default for Comes_From_Source (except if we are going to process
-- an artificial string internally created within the compiler and
Check_Restriction (No_Obsolescent_Features, New_Node (N_Empty, S));
end Obsolescent_Check;
+ ---------------
+ -- Post_Scan --
+ ---------------
+
+ procedure Post_Scan is
+ begin
+ case Token is
+ when Tok_Char_Literal =>
+ Token_Node := New_Node (N_Character_Literal, Token_Ptr);
+ Set_Char_Literal_Value (Token_Node, UI_From_CC (Character_Code));
+ Set_Chars (Token_Node, Token_Name);
+
+ when Tok_Identifier =>
+ Token_Node := New_Node (N_Identifier, Token_Ptr);
+ Set_Chars (Token_Node, Token_Name);
+
+ when Tok_Real_Literal =>
+ Token_Node := New_Node (N_Real_Literal, Token_Ptr);
+ Set_Realval (Token_Node, Real_Literal_Value);
+
+ when Tok_Integer_Literal =>
+ Token_Node := New_Node (N_Integer_Literal, Token_Ptr);
+ Set_Intval (Token_Node, Int_Literal_Value);
+
+ when Tok_String_Literal =>
+ Token_Node := New_Node (N_String_Literal, Token_Ptr);
+ Set_Has_Wide_Character (Token_Node, Wide_Character_Found);
+ Set_Strval (Token_Node, String_Literal_Id);
+
+ when Tok_Operator_Symbol =>
+ Token_Node := New_Node (N_Operator_Symbol, Token_Ptr);
+ Set_Chars (Token_Node, Token_Name);
+ Set_Strval (Token_Node, String_Literal_Id);
+
+ when others =>
+ null;
+ end case;
+ end Post_Scan;
+
------------------------------
-- Scan_Reserved_Identifier --
------------------------------