prj-part.adb (Pre_Parse_Context_Clause): Call Set_Is_Not_Last_In_List when the project file in a with clause is not the...
2005-06-14 Vincent Celier <celier@adacore.com> * prj-part.adb (Pre_Parse_Context_Clause): Call Set_Is_Not_Last_In_List when the project file in a with clause is not the last one, that is the project file name is followed by a comma. * prj-pp.adb: (First_With_In_List): New Boolean global variable (Print): Issue list of project files separated by commas in with clauses according to the values returned by Is_Not_Last_In_List. * prj-tree.ads, prj-tree.adb: (Is_Not_Last_In_List): New function (Set_Is_Not_Last_In_List): New procedure From-SVN: r101054
This commit is contained in:
parent
88664966ce
commit
a493557f3a
@ -667,7 +667,10 @@ package body Prj.Part is
|
||||
Scan (In_Tree); -- scan past the semicolon.
|
||||
exit Comma_Loop;
|
||||
|
||||
elsif Token /= Tok_Comma then
|
||||
elsif Token = Tok_Comma then
|
||||
Set_Is_Not_Last_In_List (Current_With_Node, In_Tree);
|
||||
|
||||
else
|
||||
Error_Msg ("expected comma or semi colon", Token_Ptr);
|
||||
exit Comma_Loop;
|
||||
end if;
|
||||
@ -679,7 +682,6 @@ package body Prj.Part is
|
||||
end loop With_Loop;
|
||||
end Pre_Parse_Context_Clause;
|
||||
|
||||
|
||||
-------------------------------
|
||||
-- Post_Parse_Context_Clause --
|
||||
-------------------------------
|
||||
@ -1472,7 +1474,7 @@ package body Prj.Part is
|
||||
then
|
||||
-- Invalid name: report an error
|
||||
|
||||
Error_Msg ("Expected """ &
|
||||
Error_Msg ("expected """ &
|
||||
Get_Name_String (Name_Of (Project, In_Tree)) & """",
|
||||
Token_Ptr);
|
||||
end if;
|
||||
@ -1489,7 +1491,7 @@ package body Prj.Part is
|
||||
|
||||
if Token /= Tok_EOF then
|
||||
Error_Msg
|
||||
("Unexpected text following end of project", Token_Ptr);
|
||||
("unexpected text following end of project", Token_Ptr);
|
||||
end if;
|
||||
end if;
|
||||
|
||||
|
@ -44,6 +44,11 @@ package body Prj.PP is
|
||||
-- Column number of the last character in the line. Used to avoid
|
||||
-- outputing lines longer than Max_Line_Length.
|
||||
|
||||
First_With_In_List : Boolean := True;
|
||||
-- Indicate that the next with clause is first in a list such as
|
||||
-- with "A", "B";
|
||||
-- First_With_In_List will be True for "A", but not for "B".
|
||||
|
||||
procedure Indicate_Tested (Kind : Project_Node_Kind);
|
||||
-- Set the corresponding component of array Not_Tested to False.
|
||||
-- Only called by pragmas Debug.
|
||||
@ -318,6 +323,7 @@ package body Prj.PP is
|
||||
|
||||
-- with clause(s)
|
||||
|
||||
First_With_In_List := True;
|
||||
Print (First_With_Clause_Of (Node, In_Tree), Indent);
|
||||
Write_Empty_Line (Always => True);
|
||||
end if;
|
||||
@ -356,20 +362,31 @@ package body Prj.PP is
|
||||
pragma Debug (Indicate_Tested (N_With_Clause));
|
||||
|
||||
if Name_Of (Node, In_Tree) /= No_Name then
|
||||
Print (First_Comment_Before (Node, In_Tree), Indent);
|
||||
Start_Line (Indent);
|
||||
if First_With_In_List then
|
||||
Print (First_Comment_Before (Node, In_Tree), Indent);
|
||||
Start_Line (Indent);
|
||||
|
||||
if Non_Limited_Project_Node_Of (Node, In_Tree) =
|
||||
Empty_Node
|
||||
then
|
||||
Write_String ("limited ");
|
||||
if Non_Limited_Project_Node_Of (Node, In_Tree) =
|
||||
Empty_Node
|
||||
then
|
||||
Write_String ("limited ");
|
||||
end if;
|
||||
|
||||
Write_String ("with ");
|
||||
end if;
|
||||
|
||||
Write_String ("with ");
|
||||
Output_String (String_Value_Of (Node, In_Tree));
|
||||
Write_String (";");
|
||||
Write_End_Of_Line_Comment (Node);
|
||||
Print (First_Comment_After (Node, In_Tree), Indent);
|
||||
|
||||
if Is_Not_Last_In_List (Node, In_Tree) then
|
||||
Write_String (", ");
|
||||
First_With_In_List := False;
|
||||
|
||||
else
|
||||
Write_String (";");
|
||||
Write_End_Of_Line_Comment (Node);
|
||||
Print (First_Comment_After (Node, In_Tree), Indent);
|
||||
First_With_In_List := True;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
Print (Next_With_Clause_Of (Node, In_Tree), Indent);
|
||||
|
@ -1006,6 +1006,21 @@ package body Prj.Tree is
|
||||
return In_Tree.Project_Nodes.Table (Node).Flag2;
|
||||
end Is_Extending_All;
|
||||
|
||||
-------------------------
|
||||
-- Is_Not_Last_In_List --
|
||||
-------------------------
|
||||
|
||||
function Is_Not_Last_In_List
|
||||
(Node : Project_Node_Id;
|
||||
In_Tree : Project_Node_Tree_Ref) return Boolean is
|
||||
begin
|
||||
pragma Assert
|
||||
(Node /= Empty_Node
|
||||
and then
|
||||
In_Tree.Project_Nodes.Table (Node).Kind = N_With_Clause);
|
||||
return In_Tree.Project_Nodes.Table (Node).Flag1;
|
||||
end Is_Not_Last_In_List;
|
||||
|
||||
-------------------------------------
|
||||
-- Imported_Or_Extended_Project_Of --
|
||||
-------------------------------------
|
||||
@ -2104,6 +2119,22 @@ package body Prj.Tree is
|
||||
In_Tree.Project_Nodes.Table (Node).Flag2 := True;
|
||||
end Set_Is_Extending_All;
|
||||
|
||||
-----------------------------
|
||||
-- Set_Is_Not_Last_In_List --
|
||||
-----------------------------
|
||||
|
||||
procedure Set_Is_Not_Last_In_List
|
||||
(Node : Project_Node_Id;
|
||||
In_Tree : Project_Node_Tree_Ref)
|
||||
is
|
||||
begin
|
||||
pragma Assert
|
||||
(Node /= Empty_Node
|
||||
and then
|
||||
In_Tree.Project_Nodes.Table (Node).Kind = N_With_Clause);
|
||||
In_Tree.Project_Nodes.Table (Node).Flag1 := True;
|
||||
end Set_Is_Not_Last_In_List;
|
||||
|
||||
-----------------
|
||||
-- Set_Kind_Of --
|
||||
-----------------
|
||||
|
@ -281,6 +281,12 @@ package Prj.Tree is
|
||||
pragma Inline (Is_Extending_All);
|
||||
-- Only valid for N_Project and N_With_Clause
|
||||
|
||||
function Is_Not_Last_In_List
|
||||
(Node : Project_Node_Id;
|
||||
In_Tree : Project_Node_Tree_Ref) return Boolean;
|
||||
pragma Inline (Is_Not_Last_In_List);
|
||||
-- Only valid for N_With_Clause
|
||||
|
||||
function First_Variable_Of
|
||||
(Node : Project_Node_Id;
|
||||
In_Tree : Project_Node_Tree_Ref) return Variable_Node_Id;
|
||||
@ -632,6 +638,11 @@ package Prj.Tree is
|
||||
In_Tree : Project_Node_Tree_Ref);
|
||||
pragma Inline (Set_Is_Extending_All);
|
||||
|
||||
procedure Set_Is_Not_Last_In_List
|
||||
(Node : Project_Node_Id;
|
||||
In_Tree : Project_Node_Tree_Ref);
|
||||
pragma Inline (Set_Is_Not_Last_In_List);
|
||||
|
||||
procedure Set_First_Variable_Of
|
||||
(Node : Project_Node_Id;
|
||||
In_Tree : Project_Node_Tree_Ref;
|
||||
@ -949,6 +960,12 @@ package Prj.Tree is
|
||||
-- N_Project_Declaration
|
||||
-- - it indicates that there are unkept comments in the
|
||||
-- project.
|
||||
-- N_With_Clause
|
||||
-- - it indicates that this is not the last with in a
|
||||
-- with clause. It is set for "A", but not for "B" in
|
||||
-- with "B";
|
||||
-- and
|
||||
-- with "A", "B";
|
||||
|
||||
Flag2 : Boolean := False;
|
||||
-- This flag is significant only for:
|
||||
|
Loading…
x
Reference in New Issue
Block a user