Lparen_Sloc : Source_Ptr;
Scan_State : Saved_Scan_State;
+ procedure Box_Error;
+ -- Called if <> is encountered as positional aggregate element. Issues
+ -- error message and sets Expr_Node to Error.
+
+ ---------------
+ -- Box_Error --
+ ---------------
+
+ procedure Box_Error is
+ begin
+ if Ada_Version < Ada_2005 then
+ Error_Msg_SC ("box in aggregate is an Ada 2005 extension");
+ end if;
+
+ -- Ada 2005 (AI-287): The box notation is allowed only with named
+ -- notation because positional notation might be error prone. For
+ -- example, in "(X, <>, Y, <>)", there is no type associated with
+ -- the boxes, so you might not be leaving out the components you
+ -- thought you were leaving out.
+
+ Error_Msg_SC ("(Ada 2005) box only allowed with named notation");
+ Scan; -- past box
+ Expr_Node := Error;
+ end Box_Error;
+
+ -- Start of processsing for P_Aggregate_Or_Paren_Expr
+
begin
Lparen_Sloc := Token_Ptr;
T_Left_Paren;
end if;
end if;
- -- Ada 2005 (AI-287): The box notation is allowed only with named
- -- notation because positional notation might be error prone. For
- -- example, in "(X, <>, Y, <>)", there is no type associated with
- -- the boxes, so you might not be leaving out the components you
- -- thought you were leaving out.
+ -- Scan expression, handling box appearing as positional argument
- if Ada_Version >= Ada_05 and then Token = Tok_Box then
- Error_Msg_SC ("(Ada 2005) box notation only allowed with "
- & "named notation");
- Scan; -- past BOX
- Aggregate_Node := New_Node (N_Aggregate, Lparen_Sloc);
- return Aggregate_Node;
+ if Token = Tok_Box then
+ Box_Error;
+ else
+ Expr_Node := P_Expression_Or_Range_Attribute_If_OK;
end if;
- Expr_Node := P_Expression_Or_Range_Attribute_If_OK;
-
-- Extension aggregate case
if Token = Tok_With then
-
if Nkind (Expr_Node) = N_Attribute_Reference
and then Attribute_Name (Expr_Node) = Name_Range
then
"extension aggregate");
raise Error_Resync;
- -- A range attribute can only appear as part of a discrete choice
- -- list.
+ -- Range attribute can only appear as part of a discrete choice list
elsif Nkind (Expr_Node) = N_Attribute_Reference
and then Attribute_Name (Expr_Node) = Name_Range
exit;
end if;
+ -- Deal with misused box
+
+ if Token = Tok_Box then
+ Box_Error;
+
-- Otherwise initiate for reentry to top of loop by scanning an
-- initial expression, unless the first token is OTHERS.
- if Token = Tok_Others then
+ elsif Token = Tok_Others then
Expr_Node := Empty;
+
else
Save_Scan_State (Scan_State); -- at start of expression
Expr_Node := P_Expression_Or_Range_Attribute_If_OK;
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2010, 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- --
-- For the object path, we make a distinction depending on
-- Including_Libraries.
- if Objects_Path and Including_Libraries then
+ if Objects_Path and then Including_Libraries then
if Project.Objects_Path_File_With_Libs = No_Path then
Object_Path_Table.Init (Object_Paths);
Process_Object_Dirs := True;
-- If there is something to do, set Seen to False for all projects,
-- then call the recursive procedure Add for Project.
- if Process_Source_Dirs or Process_Object_Dirs then
+ if Process_Source_Dirs or else Process_Object_Dirs then
For_All_Projects (Project, Dummy);
end if;