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;
end loop With_Loop;
end Pre_Parse_Context_Clause;
-
-------------------------------
-- Post_Parse_Context_Clause --
-------------------------------
then
-- Invalid name: report an error
- Error_Msg ("Expected """ &
+ Error_Msg ("expected """ &
Get_Name_String (Name_Of (Project, In_Tree)) & """",
Token_Ptr);
end if;
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;
-- 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.
-- with clause(s)
+ First_With_In_List := True;
Print (First_With_Clause_Of (Node, In_Tree), Indent);
Write_Empty_Line (Always => True);
end if;
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);
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 --
-------------------------------------
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 --
-----------------
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;
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;
-- 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: