aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-11-22 06:19:55 +0100
committerTristan Gingold <tgingold@free.fr>2022-11-22 06:19:55 +0100
commit677381d0de3212399025117f5879030d13ccfdbf (patch)
tree1b4ac4b75113d842708284e09c3f4e21ab080c4f
parent2bd7374572542e36740085f3e9328e8169fc2c1e (diff)
downloadghdl-677381d0de3212399025117f5879030d13ccfdbf.tar.gz
ghdl-677381d0de3212399025117f5879030d13ccfdbf.tar.bz2
ghdl-677381d0de3212399025117f5879030d13ccfdbf.zip
vhdl-parse: gather more comments (type, objects)
-rw-r--r--src/vhdl/vhdl-parse.adb23
1 files changed, 22 insertions, 1 deletions
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);