From 8f66fbcc06f13e871d60aa175e18183db9b4fb0a Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 19 Jan 2016 06:00:47 +0100 Subject: Parse: detect ill-formed formal names. Fix bug24324. --- src/vhdl/parse.adb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/vhdl') diff --git a/src/vhdl/parse.adb b/src/vhdl/parse.adb index 2991e07..d456131 100644 --- a/src/vhdl/parse.adb +++ b/src/vhdl/parse.adb @@ -6140,6 +6140,26 @@ package body Parse is return Res; end Parse_Process_Statement; + procedure Check_Formal_Form (Formal : Iir) is + begin + if Formal = Null_Iir then + return; + end if; + + case Get_Kind (Formal) is + when Iir_Kind_Simple_Name + | Iir_Kind_Slice_Name + | Iir_Kind_Selected_Name => + null; + when Iir_Kind_Parenthesis_Name => + -- Could be an indexed name, so nothing to check within the + -- parenthesis. + null; + when others => + Error_Msg_Parse ("incorrect formal name", Formal); + end case; + end Check_Formal_Form; + -- precond : NEXT_TOKEN -- postcond: NEXT_TOKEN -- @@ -6216,6 +6236,9 @@ package body Parse is when Tok_Double_Arrow => Formal := Actual; + -- Check that FORMAL is a name and not an expression. + Check_Formal_Form (Formal); + -- Skip '=>' Scan; Loc := Get_Token_Location; -- cgit