or else A_Id = Aspect_Refined_Depends
then
Inside_Depends := True;
+ elsif A_Id = Aspect_Abstract_State then
+ Inside_Abstract_State := True;
end if;
-- Note that we have seen an Import aspect specification.
Set_Expression (Aspect, P_Expression);
end if;
- -- Unconditionally reset flag for Inside_Depends
+ -- Unconditionally reset flag for being inside aspects
- Inside_Depends := False;
+ Inside_Depends := False;
+ Inside_Abstract_State := False;
end if;
-- Add the aspect to the resulting list only when it was properly
or else Chars (Ident_Node) = Name_Refined_Depends
then
Inside_Depends := True;
+ elsif Chars (Ident_Node) = Name_Abstract_State then
+ Inside_Abstract_State := True;
end if;
-- Scan arguments. We assume that arguments are present if there is
Semicolon_Loc := Token_Ptr;
- -- Cancel indication of being within a pragma or in particular a Depends
- -- pragma.
+ -- Cancel indication of being within a pragma
- Inside_Depends := False;
- Inside_Pragma := False;
+ Inside_Depends := False;
+ Inside_Abstract_State := False;
+ Inside_Pragma := False;
-- Now we have two tasks left, we need to scan out the semicolon
-- following the pragma, and we have to call Par.Prag to process
exception
when Error_Resync =>
Resync_Past_Semicolon;
- Inside_Depends := False;
- Inside_Pragma := False;
+ Inside_Depends := False;
+ Inside_Abstract_State := False;
+ Inside_Pragma := False;
return Error;
end P_Pragma;
-- Improper use of WITH
elsif Token = Tok_With then
- Error_Msg_SC ("WITH must be preceded by single expression in " &
- "extension aggregate");
+ if Inside_Abstract_State then
+ Error_Msg_SC ("state name with options must be enclosed in " &
+ "parentheses");
+ else
+ Error_Msg_SC ("WITH must be preceded by single expression in " &
+ "extension aggregate");
+ end if;
raise Error_Resync;
-- Range attribute can only appear as part of a discrete choice list
-- True within a delta aggregate (but only after the "delta" token has
-- been scanned). Used to distinguish syntax errors from syntactically
-- correct "deep" delta aggregates (enabled via -gnatX0).
+
+ Inside_Abstract_State : Boolean := False;
+ -- True within an Abstract_State contract. Used to distinguish syntax error
+ -- about extended aggregates and about a malformed contract.
+
Save_Style_Checks : Style_Check_Options;
Save_Style_Check : Boolean;
-- Variables for storing the original state of whether style checks should