From cc505073525dd5ffe1bd05004a2fb79917680d68 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 22 Nov 2022 07:44:25 +0100 Subject: vhdl-parse: gather comments for enumerations and their literals --- src/vhdl/vhdl-parse.adb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/vhdl') diff --git a/src/vhdl/vhdl-parse.adb b/src/vhdl/vhdl-parse.adb index 476e5ead4..10f4da4c1 100644 --- a/src/vhdl/vhdl-parse.adb +++ b/src/vhdl/vhdl-parse.adb @@ -2582,6 +2582,11 @@ package body Vhdl.Parse is Set_Location (Enum_Lit); Set_Enum_Pos (Enum_Lit, Pos); + -- Comments for the enumeration literal. + if Flag_Gather_Comments then + Gather_Comments (Enum_Lit); + end if; + -- LRM93 3.1.1 -- the position number for each additional enumeration literal -- is one more than that if its predecessor in the list. @@ -3146,8 +3151,17 @@ package body Vhdl.Parse is case Current_Token is when Tok_Left_Paren => -- This is an enumeration. + -- Create the type declaration now so that comments can be + -- attached to it (and later comments to the literals). + Decl := Create_Iir (Iir_Kind_Type_Declaration); + + -- Comments attached to the type. + if Flag_Gather_Comments then + Gather_Comments (Decl); + end if; + Def := Parse_Enumeration_Type_Definition (Parent); - Decl := Null_Iir; + Set_Type_Definition (Decl, Def); when Tok_Range => -- This is a range definition. -- cgit v1.2.3