aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/prj-strt.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/prj-strt.adb')
-rw-r--r--gcc/ada/prj-strt.adb100
1 files changed, 70 insertions, 30 deletions
diff --git a/gcc/ada/prj-strt.adb b/gcc/ada/prj-strt.adb
index 790c632..2a96cfd 100644
--- a/gcc/ada/prj-strt.adb
+++ b/gcc/ada/prj-strt.adb
@@ -6,9 +6,9 @@
-- --
-- B o d y --
-- --
--- $Revision: 1.12 $
+-- $Revision$
-- --
--- Copyright (C) 2001 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2002 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- --
@@ -27,6 +27,7 @@
------------------------------------------------------------------------------
with Errout; use Errout;
+with Namet; use Namet;
with Prj.Attr; use Prj.Attr;
with Prj.Tree; use Prj.Tree;
with Scans; use Scans;
@@ -37,8 +38,6 @@ with Types; use Types;
package body Prj.Strt is
- Initial_Size : constant := 8;
-
type Name_Location is record
Name : Name_Id := No_Name;
Location : Source_Ptr := No_Location;
@@ -73,11 +72,6 @@ package body Prj.Strt is
First_Choice_Node_Id : constant Choice_Node_Id :=
Choice_Node_Low_Bound;
- Empty_Choice : constant Choice_Node_Id :=
- Choice_Node_Low_Bound;
-
- First_Choice_Id : constant Choice_Node_Id := First_Choice_Node_Id + 1;
-
package Choices is
new Table.Table (Table_Component_Type => Choice_String,
Table_Index_Type => Choice_Node_Id,
@@ -151,7 +145,7 @@ package body Prj.Strt is
begin
Reference := Default_Project_Node (Of_Kind => N_Attribute_Reference);
Set_Location_Of (Reference, To => Token_Ptr);
- Scan; -- past apostrophe
+ Scan; -- past apostrophe
Expect (Tok_Identifier, "Identifier");
if Token = Tok_Identifier then
@@ -165,15 +159,8 @@ package body Prj.Strt is
end loop;
if Current_Attribute = Empty_Attribute then
- Error_Msg ("unknown attribute", Token_Ptr);
- Reference := Empty_Node;
-
- elsif
- Attributes.Table (Current_Attribute).Kind_2 = Associative_Array
- then
- Error_Msg
- ("associative array attribute cannot be referenced",
- Token_Ptr);
+ Error_Msg_Name_1 := Token_Name;
+ Error_Msg ("unknown attribute %", Token_Ptr);
Reference := Empty_Node;
else
@@ -181,7 +168,30 @@ package body Prj.Strt is
Set_Package_Node_Of (Reference, To => Current_Package);
Set_Expression_Kind_Of
(Reference, To => Attributes.Table (Current_Attribute).Kind_1);
+ Set_Case_Insensitive
+ (Reference, To => Attributes.Table (Current_Attribute).Kind_2 =
+ Case_Insensitive_Associative_Array);
Scan;
+
+ if Attributes.Table (Current_Attribute).Kind_2 /= Single then
+ Expect (Tok_Left_Paren, "(");
+
+ if Token = Tok_Left_Paren then
+ Scan;
+ Expect (Tok_String_Literal, "literal string");
+
+ if Token = Tok_String_Literal then
+ Set_Associative_Array_Index_Of
+ (Reference, To => Strval (Token_Node));
+ Scan;
+ Expect (Tok_Right_Paren, ")");
+
+ if Token = Tok_Right_Paren then
+ Scan;
+ end if;
+ end if;
+ end if;
+ end if;
end if;
end if;
end Attribute_Reference;
@@ -319,7 +329,9 @@ package body Prj.Strt is
Found := True;
if Choices.Table (Choice).Already_Used then
- Error_Msg ("duplicate case label", Token_Ptr);
+ String_To_Name_Buffer (Choice_String);
+ Error_Msg_Name_1 := Name_Find;
+ Error_Msg ("duplicate case label {", Token_Ptr);
else
Choices.Table (Choice).Already_Used := True;
end if;
@@ -329,7 +341,9 @@ package body Prj.Strt is
end loop;
if not Found then
- Error_Msg ("illegal case label", Token_Ptr);
+ String_To_Name_Buffer (Choice_String);
+ Error_Msg_Name_1 := Name_Find;
+ Error_Msg ("illegal case label {", Token_Ptr);
end if;
Scan;
@@ -398,7 +412,9 @@ package body Prj.Strt is
begin
while Current /= Last_String loop
if String_Equal (String_Value_Of (Current), String_Value) then
- Error_Msg ("duplicate value in type", Token_Ptr);
+ String_To_Name_Buffer (String_Value);
+ Error_Msg_Name_1 := Name_Find;
+ Error_Msg ("duplicate value { in type", Token_Ptr);
exit;
end if;
@@ -494,7 +510,8 @@ package body Prj.Strt is
end loop;
if The_Package = Empty_Node then
- Error_Msg ("package not yet defined",
+ Error_Msg_Name_1 := The_Names (1).Name;
+ Error_Msg ("package % not yet defined",
The_Names (1).Location);
end if;
@@ -514,7 +531,8 @@ package body Prj.Strt is
if The_Project_Name_And_Node =
Tree_Private_Part.No_Project_Name_And_Node
then
- Error_Msg ("unknown project",
+ Error_Msg_Name_1 := The_Names (1).Name;
+ Error_Msg ("unknown project %",
The_Names (1).Location);
else
The_Project := The_Project_Name_And_Node.Node;
@@ -535,7 +553,8 @@ package body Prj.Strt is
end loop;
if With_Clause = Empty_Node then
- Error_Msg ("unknown project",
+ Error_Msg_Name_1 := The_Names (1).Name;
+ Error_Msg ("unknown project %",
The_Names (1).Location);
The_Project := Empty_Node;
The_Package := Empty_Node;
@@ -551,7 +570,9 @@ package body Prj.Strt is
end loop;
if The_Package = Empty_Node then
- Error_Msg ("package not declared in project",
+ Error_Msg_Name_1 := The_Names (2).Name;
+ Error_Msg_Name_2 := The_Names (1).Name;
+ Error_Msg ("package % not declared in project %",
The_Names (2).Location);
First_Attribute := Attribute_First;
@@ -637,7 +658,8 @@ package body Prj.Strt is
end if;
if The_Project = Empty_Node then
- Error_Msg ("unknown package or project",
+ Error_Msg_Name_1 := The_Names (1).Name;
+ Error_Msg ("unknown package or project %",
The_Names (1).Location);
Look_For_Variable := False;
else
@@ -675,7 +697,8 @@ package body Prj.Strt is
end if;
if The_Project = Empty_Node then
- Error_Msg ("unknown package or project",
+ Error_Msg_Name_1 := The_Names (1).Name;
+ Error_Msg ("unknown package or project %",
The_Names (1).Location);
Look_For_Variable := False;
@@ -690,7 +713,8 @@ package body Prj.Strt is
end loop;
if The_Package = Empty_Node then
- Error_Msg ("unknown package",
+ Error_Msg_Name_1 := The_Names (2).Name;
+ Error_Msg ("unknown package %",
The_Names (2).Location);
Look_For_Variable := False;
@@ -732,7 +756,8 @@ package body Prj.Strt is
end if;
if Current_Variable = Empty_Node then
- Error_Msg ("unknown variable", The_Names (Last_Name).Location);
+ Error_Msg_Name_1 := Variable_Name;
+ Error_Msg ("unknown variable %", The_Names (Last_Name).Location);
end if;
end if;
@@ -745,6 +770,21 @@ package body Prj.Strt is
(Variable, To => String_Type_Of (Current_Variable));
end if;
end if;
+
+ if Token = Tok_Left_Paren then
+ Error_Msg ("\variables cannot be associative arrays", Token_Ptr);
+ Scan;
+ Expect (Tok_String_Literal, "literal string");
+
+ if Token = Tok_String_Literal then
+ Scan;
+ Expect (Tok_Right_Paren, ")");
+
+ if Token = Tok_Right_Paren then
+ Scan;
+ end if;
+ end if;
+ end if;
end Parse_Variable_Reference;
---------------------------------