From 677381d0de3212399025117f5879030d13ccfdbf Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 22 Nov 2022 06:19:55 +0100 Subject: vhdl-parse: gather more comments (type, objects) --- src/vhdl/vhdl-parse.adb | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/vhdl/vhdl-parse.adb b/src/vhdl/vhdl-parse.adb index dee22aaed..476e5ead4 100644 --- a/src/vhdl/vhdl-parse.adb +++ b/src/vhdl/vhdl-parse.adb @@ -2714,7 +2714,7 @@ package body Vhdl.Parse is end Parse_Array_Indexes; -- precond : ARRAY - -- postcond: ?? + -- postcond: ';' -- -- [ LRM93 3.2.1 ] -- array_type_definition ::= unconstrained_array_definition @@ -2919,6 +2919,11 @@ package body Vhdl.Parse is Scan; end loop; + -- Comments attached to the first element. + if Flag_Gather_Comments then + Gather_Comments (First); + end if; + -- Scan ':'. Expect_Scan (Tok_Colon); @@ -3183,6 +3188,12 @@ package body Vhdl.Parse is Decl := Create_Iir (Iir_Kind_Type_Declaration); Set_Identifier (Decl, Ident); Set_Location (Decl, Loc); + + -- Comments attached to the record. + if Flag_Gather_Comments then + Gather_Comments (Decl); + end if; + Def := Parse_Record_Type_Definition; Set_Type_Definition (Decl, Def); Set_Type_Declarator (Def, Decl); @@ -3238,6 +3249,11 @@ package body Vhdl.Parse is Error_Kind ("parse_type_declaration", Def); end case; Set_Type_Definition (Decl, Def); + + -- Comments attached to the type. + if Flag_Gather_Comments then + Gather_Comments (Decl); + end if; end if; Set_Identifier (Decl, Ident); Set_Location (Decl, Loc); @@ -4276,6 +4292,11 @@ package body Vhdl.Parse is Set_Shared_Flag (Object, Shared); end if; + -- Comments attached to the object. + if Flag_Gather_Comments then + Gather_Comments (Object); + end if; + Scan_Identifier (Object); Set_Parent (Object, Parent); -- cgit v1.2.3