aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-11-21 08:03:20 +0100
committerTristan Gingold <tgingold@free.fr>2022-11-21 08:03:20 +0100
commit0af513e7b59a01f456f6f76369cedf67d8ffc5cf (patch)
tree7a7fa841c07320f027f2b3e6e788cfeff4d5a4da /src/vhdl
parentc1dc505cbe93ebaade1547b2e4180074bdf42a25 (diff)
downloadghdl-0af513e7b59a01f456f6f76369cedf67d8ffc5cf.tar.gz
ghdl-0af513e7b59a01f456f6f76369cedf67d8ffc5cf.tar.bz2
ghdl-0af513e7b59a01f456f6f76369cedf67d8ffc5cf.zip
vhdl-parse: handle inside comments
Diffstat (limited to 'src/vhdl')
-rw-r--r--src/vhdl/vhdl-parse.adb31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/vhdl/vhdl-parse.adb b/src/vhdl/vhdl-parse.adb
index 7e47e05cb..dee22aaed 100644
--- a/src/vhdl/vhdl-parse.adb
+++ b/src/vhdl/vhdl-parse.adb
@@ -1714,6 +1714,7 @@ package body Vhdl.Parse is
Set_Start_Location (First, Get_Token_Location);
end if;
+ -- Comments for the interface.
if Flag_Gather_Comments then
Gather_Comments (First);
end if;
@@ -5696,6 +5697,12 @@ package body Vhdl.Parse is
-- Skip 'is'.
Expect_Scan (Tok_Is);
+ -- Comments after 'entity' but before the first generic or port are
+ -- attached to the entity.
+ if Flag_Gather_Comments then
+ Gather_Comments (Res);
+ end if;
+
Parse_Generic_Port_Clauses (Res);
Parse_Declarative_Part (Res, Res);
@@ -10541,6 +10548,12 @@ package body Vhdl.Parse is
-- Skip 'is'.
Expect_Scan (Tok_Is);
+ -- Comments after 'architecture' but before the first declaration are
+ -- attached to the architecture.
+ if Flag_Gather_Comments then
+ Gather_Comments (Res);
+ end if;
+
Parse_Declarative_Part (Res, Res);
-- Skip 'begin'.
@@ -11032,6 +11045,12 @@ package body Vhdl.Parse is
-- Skip 'is'.
Expect_Scan (Tok_Is);
+ -- Comments after 'context' but before the first clause are attached
+ -- to the context.
+ if Flag_Gather_Comments then
+ Gather_Comments (Res);
+ end if;
+
Parse_Configuration_Declarative_Part (Res);
Set_Block_Configuration (Res, Parse_Block_Configuration);
@@ -11132,6 +11151,12 @@ package body Vhdl.Parse is
Set_Identifier (Res, Id);
Set_Parent (Res, Parent);
+ -- Comments after 'package' but before the first declaration are
+ -- attached to the package.
+ if Flag_Gather_Comments then
+ Gather_Comments (Res);
+ end if;
+
if Current_Token = Tok_Generic then
Check_Vhdl_At_Least_2008 ("generic packages");
Set_Package_Header (Res, Parse_Package_Header);
@@ -11592,6 +11617,12 @@ package body Vhdl.Parse is
-- Skip 'is'
Scan;
+ -- Comments after 'context' but before the first clause are attached
+ -- to the context.
+ if Flag_Gather_Comments then
+ Gather_Comments (Decl);
+ end if;
+
Parse_Context_Clause (Decl);
Expect (Tok_End);