aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/vhdl-parse.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/vhdl/vhdl-parse.adb')
-rw-r--r--src/vhdl/vhdl-parse.adb36
1 files changed, 30 insertions, 6 deletions
diff --git a/src/vhdl/vhdl-parse.adb b/src/vhdl/vhdl-parse.adb
index 6e574b0a5..60dfd103c 100644
--- a/src/vhdl/vhdl-parse.adb
+++ b/src/vhdl/vhdl-parse.adb
@@ -2145,16 +2145,23 @@ package body Vhdl.Parse is
Tm := Parse_Type_Mark (Check_Paren => True);
- if Current_Token = Tok_Of then
+ if Tm /= Null_Iir and then Current_Token = Tok_Of then
if Vhdl_Std < Vhdl_19 then
Error_Msg_Parse
("return identifier not allowed before vhdl 2019");
+ elsif Get_Kind (Tm) /= Iir_Kind_Simple_Name then
+ Error_Msg_Parse ("return identifier must be an identifier");
end if;
- pragma Assert (Get_Kind (Tm) = Iir_Kind_Simple_Name);
Ret := Create_Iir (Iir_Kind_Subtype_Declaration);
Location_Copy (Ret, Tm);
Set_Identifier (Ret, Get_Identifier (Tm));
- Set_Return_Identifier (Subprg, Ret);
+ if Get_Kind (Subprg) = Iir_Kind_Interface_Function_Declaration
+ then
+ Error_Msg_Parse
+ ("return identifier not allowed in interface function");
+ else
+ Set_Return_Identifier (Subprg, Ret);
+ end if;
Free_Iir (Tm);
-- Skip 'of'
@@ -6320,7 +6327,14 @@ package body Vhdl.Parse is
Scan;
-- Resize.
- Resize_Bit_String (Res, Nat32 (Int));
+ if Int > 2048 then
+ -- What is a reasonable limit ?
+ Error_Msg_Parse
+ (Get_Token_Location,
+ "bit string size is too large (> 2048)");
+ else
+ Resize_Bit_String (Res, Nat32 (Int));
+ end if;
else
Error_Msg_Parse
(Get_Token_Location,
@@ -7358,6 +7372,8 @@ package body Vhdl.Parse is
| Iir_Kind_Signature =>
Error_Msg_Parse
("invalid name for a procedure call or missing assignment");
+ when Iir_Kind_Error =>
+ null;
when others =>
Error_Kind ("parenthesis_name_to_procedure_call", Name);
end case;
@@ -10786,10 +10802,13 @@ package body Vhdl.Parse is
-- Parse configuration item list
declare
First, Last : Iir;
+ Item : Iir;
begin
Chain_Init (First, Last);
while Current_Token = Tok_For loop
- Chain_Append (First, Last, Parse_Configuration_Item);
+ Item := Parse_Configuration_Item;
+ exit when Item = Null_Iir;
+ Chain_Append (First, Last, Item);
end loop;
Set_Configuration_Item_Chain (Res, First);
end;
@@ -11234,6 +11253,7 @@ package body Vhdl.Parse is
-- Skip identifier.
Scan;
else
+ Id := Null_Identifier;
Expect (Tok_Identifier);
end if;
@@ -11524,7 +11544,11 @@ package body Vhdl.Parse is
is
End_Loc : Location_Type;
begin
- Set_Library_Unit (Unit, Decl);
+ if Get_Kind (Unit) = Iir_Kind_Context_Declaration then
+ Error_Msg_Parse ("nested context declaration not allowed");
+ else
+ Set_Library_Unit (Unit, Decl);
+ end if;
-- Skip 'is'
Scan;