From e9b528294b94f62d07384859680f1f45ae5e9d6c Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 14 Nov 2018 18:36:22 +0100 Subject: parse: strenghten. --- src/vhdl/parse.adb | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'src/vhdl') diff --git a/src/vhdl/parse.adb b/src/vhdl/parse.adb index 5048719de..4ac5e0f2a 100644 --- a/src/vhdl/parse.adb +++ b/src/vhdl/parse.adb @@ -6180,13 +6180,14 @@ package body Parse is when Iir_Kind_Simple_Name | Iir_Kind_Selected_Name => Set_Prefix (Call, Name); - when Iir_Kind_Attribute_Name => - Error_Msg_Parse ("attribute cannot be used as procedure call"); when Iir_Kind_String_Literal8 => Error_Msg_Parse ("string or operator cannot be used as procedure call"); - when Iir_Kind_Selected_By_All_Name => - Error_Msg_Parse ("invalid procedure name or missing assignment"); + when Iir_Kind_Selected_By_All_Name + | Iir_Kind_Qualified_Expression + | Iir_Kind_Attribute_Name => + Error_Msg_Parse + ("invalid name for a procedure call or missing assignment"); when others => Error_Kind ("parenthesis_name_to_procedure_call", Name); end case; @@ -7327,10 +7328,20 @@ package body Parse is Set_Entity_Name (Res, Parse_Name (False)); if Current_Token = Tok_Left_Paren then - Scan_Expect (Tok_Identifier); - Set_Architecture (Res, Current_Text); - Scan_Expect (Tok_Right_Paren); + -- Skip '('. Scan; + + if Current_Token = Tok_Identifier then + Set_Architecture (Res, Current_Text); + + -- Skip identifier. + Scan; + else + Expect (Tok_Identifier, "identifier for architecture"); + end if; + + -- Skip ')'. + Expect_Scan (Tok_Right_Paren); end if; return Res; -- cgit v1.2.3