-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005 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- --
with Atree; use Atree;
with Csets; use Csets;
-with Hostparm;
with Namet; use Namet;
with Opt; use Opt;
+with Restrict; use Restrict;
+with Rident; use Rident;
with Scans; use Scans;
with Sinfo; use Sinfo;
with Sinput; use Sinput;
+with Uintp; use Uintp;
package body Scn is
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_Char_Literal_Value (Token_Node, UI_From_CC (Character_Code));
Set_Chars (Token_Node, Token_Name);
when Tok_Identifier =>
procedure Check_End_Of_Line is
Len : constant Int := Int (Scan_Ptr) - Int (Current_Line_Start);
-
begin
- if Len > Hostparm.Max_Line_Length then
- Error_Long_Line;
-
- elsif Style_Check then
+ if Style_Check then
Style.Check_Line_Terminator (Len);
+ elsif Len > Opt.Max_Line_Length then
+ Error_Long_Line;
end if;
end Check_End_Of_Line;
function Determine_License return License_Type is
GPL_Found : Boolean := False;
+ Result : License_Type;
function Contains (S : String) return Boolean;
-- See if current comment contains successive non-blank characters
SS : Source_Ptr;
begin
+ -- Loop to check characters. This loop is terminated by end of
+ -- line, and also we need to check for the EOF case, to take
+ -- care of files containing only comments.
+
SP := Scan_Ptr;
- while Source (SP) /= CR and then Source (SP) /= LF loop
+ while Source (SP) /= CR and then
+ Source (SP) /= LF and then
+ Source (SP) /= EOF
+ loop
if Source (SP) = S (S'First) then
SS := SP;
CP := S'First;
or else Source (Scan_Ptr + 1) /= '-'
then
if GPL_Found then
- return GPL;
+ Result := GPL;
+ exit;
else
- return Unknown;
+ Result := Unknown;
+ exit;
end if;
elsif Contains ("Asaspecialexception") then
if GPL_Found then
- return Modified_GPL;
+ Result := Modified_GPL;
+ exit;
end if;
elsif Contains ("GNUGeneralPublicLicense") then
Contains
("ThisspecificationisderivedfromtheAdaReferenceManual")
then
- return Unrestricted;
+ Result := Unrestricted;
+ exit;
end if;
Skip_EOL;
end;
end if;
end loop;
+
+ return Result;
end Determine_License;
----------------------------
begin
Error_Msg
("this line is too long",
- Current_Line_Start + Hostparm.Max_Line_Length);
+ Current_Line_Start + Source_Ptr (Opt.Max_Line_Length));
end Error_Long_Line;
------------------------
end loop;
end Initialize_Scanner;
+ -----------------------
+ -- Obsolescent_Check --
+ -----------------------
+
+ procedure Obsolescent_Check (S : Source_Ptr) is
+ begin
+ -- This is a pain in the neck case, since we normally need a node to
+ -- call Check_Restrictions, and all we have is a source pointer. The
+ -- easiest thing is to construct a dummy node. A bit kludgy, but this
+ -- is a marginal case. It's not worth trying to do things more cleanly.
+
+ Check_Restriction (No_Obsolescent_Features, New_Node (N_Empty, S));
+ end Obsolescent_Check;
+
------------------------------
-- Scan_Reserved_Identifier --
------------------------------