aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-11-22 07:44:25 +0100
committerTristan Gingold <tgingold@free.fr>2022-11-22 07:44:53 +0100
commitcc505073525dd5ffe1bd05004a2fb79917680d68 (patch)
tree6aa10df32cc7e2ee30c210aabe563f61aace089f
parentcd408fb00f8fef76ca31a4c97f956ee662c9aa5b (diff)
downloadghdl-cc505073525dd5ffe1bd05004a2fb79917680d68.tar.gz
ghdl-cc505073525dd5ffe1bd05004a2fb79917680d68.tar.bz2
ghdl-cc505073525dd5ffe1bd05004a2fb79917680d68.zip
vhdl-parse: gather comments for enumerations and their literals
-rw-r--r--src/vhdl/vhdl-parse.adb16
1 files changed, 15 insertions, 1 deletions
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.