OSDN Git Service

2004-05-17 Steve Kargl <kargls@comcast.net>
[pf3gnuchains/gcc-fork.git] / gcc / ada / par-ch12.adb
index 139243e..2880fe4 100644 (file)
@@ -6,9 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---                            $Revision: 1.46 $
---                                                                          --
---          Copyright (C) 1992-2001 Free Software Foundation, Inc.          --
+--          Copyright (C) 1992-2003 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- --
@@ -22,7 +20,7 @@
 -- MA 02111-1307, USA.                                                      --
 --                                                                          --
 -- GNAT was originally developed  by the GNAT team at  New York University. --
--- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
 --                                                                          --
 ------------------------------------------------------------------------------
 
@@ -369,12 +367,12 @@ package body Ch12 is
       --  bother to check for it being exceeded.
 
    begin
-      Idents (1) := P_Defining_Identifier;
+      Idents (1) := P_Defining_Identifier (C_Comma_Colon);
       Num_Idents := 1;
 
       while Comma_Present loop
          Num_Idents := Num_Idents + 1;
-         Idents (Num_Idents) := P_Defining_Identifier;
+         Idents (Num_Idents) := P_Defining_Identifier (C_Comma_Colon);
       end loop;
 
       T_Colon;
@@ -431,6 +429,7 @@ package body Ch12 is
 
    function P_Formal_Type_Declaration return Node_Id is
       Decl_Node  : Node_Id;
+      Def_Node   : Node_Id;
 
    begin
       Decl_Node := New_Node (N_Formal_Type_Declaration, Token_Ptr);
@@ -446,8 +445,22 @@ package body Ch12 is
 
       T_Is;
 
-      Set_Formal_Type_Definition (Decl_Node, P_Formal_Type_Definition);
-      TF_Semicolon;
+      Def_Node := P_Formal_Type_Definition;
+
+      if Def_Node /= Error then
+         Set_Formal_Type_Definition (Decl_Node, Def_Node);
+         TF_Semicolon;
+
+      else
+         Decl_Node := Error;
+
+         --  If we have semicolon, skip it to avoid cascaded errors
+
+         if Token = Tok_Semicolon then
+            Scan;
+         end if;
+      end if;
+
       return Decl_Node;
    end P_Formal_Type_Declaration;
 
@@ -621,6 +634,17 @@ package body Ch12 is
          Scan; -- past WITH
          Set_Private_Present (Def_Node, True);
          T_Private;
+
+      elsif Token = Tok_Tagged then
+         Scan;
+
+         if Token = Tok_Private then
+            Error_Msg_SC ("TAGGED should be WITH");
+            Set_Private_Present (Def_Node, True);
+            T_Private;
+         else
+            Ignore (Tok_Tagged);
+         end if;
       end if;
 
       return Def_Node;
@@ -849,7 +873,7 @@ package body Ch12 is
    begin
       Def_Node := New_Node (N_Formal_Package_Declaration, Prev_Token_Ptr);
       Scan; -- past PACKAGE
-      Set_Defining_Identifier (Def_Node, P_Defining_Identifier);
+      Set_Defining_Identifier (Def_Node, P_Defining_Identifier (C_Is));
       T_Is;
       T_New;
       Set_Name (Def_Node, P_Qualified_Simple_Name);