summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2022-12-03 09:32:26 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2022-12-03 10:09:37 +0000
commitf7b41273106056e966730a68b5be5f52371d8986 (patch)
tree24a732648f381900a5eea8233f5e9f50f51e08eb
parent24f75aa481aa98aa0ed52e71493c9ca4e63122ea (diff)
downloadswig-f7b41273106056e966730a68b5be5f52371d8986.tar.gz
Fix syntax error parsing of Doxygen comments after last enum item
It is unconventional to have a doxygen comment after an enum item. It is attached to the previous, that is, the enum item to match Doxygen behaviour. Closes #1609
-rw-r--r--CHANGES.current3
-rw-r--r--Examples/test-suite/doxygen_misc_constructs.i11
-rw-r--r--Examples/test-suite/java/doxygen_misc_constructs_runme.java13
-rw-r--r--Source/CParse/parser.y5
4 files changed, 32 insertions, 0 deletions
diff --git a/CHANGES.current b/CHANGES.current
index 5fc73eb15..93c8a99be 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -8,6 +8,9 @@ Version 4.2.0 (in progress)
===========================
2022-12-03: wsfulton
+ #1609 Fix syntax error parsing of Doxygen comments after last enum item.
+
+2022-12-03: wsfulton
#1715 Fix syntax error parsing of unconventionally placed Doxygen post
comments for enum items.
diff --git a/Examples/test-suite/doxygen_misc_constructs.i b/Examples/test-suite/doxygen_misc_constructs.i
index e77edc7fb..56e4fbdac 100644
--- a/Examples/test-suite/doxygen_misc_constructs.i
+++ b/Examples/test-suite/doxygen_misc_constructs.i
@@ -125,6 +125,17 @@
,ODD_PARTIAL3_TWO ///< desc of odd_partial3_two
,ODD_PARTIAL3_THREE
} ENestedOddPartial3;
+
+ /** Description for TESTENUM. */
+ enum TESTENUM
+ {
+ /** something for none */
+ TEST_NONE = 0,
+ /** something for one */
+ TEST_ONE,
+ /** something for two */
+ TEST_TWO /** something more for two */
+ };
};
/// @return This is a bad place for this tag, but it should be ignored.
diff --git a/Examples/test-suite/java/doxygen_misc_constructs_runme.java b/Examples/test-suite/java/doxygen_misc_constructs_runme.java
index 9d629579f..18cc5d901 100644
--- a/Examples/test-suite/java/doxygen_misc_constructs_runme.java
+++ b/Examples/test-suite/java/doxygen_misc_constructs_runme.java
@@ -145,6 +145,19 @@ public class doxygen_misc_constructs_runme {
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOddPartial3.ODD_PARTIAL3_TWO",
" desc of odd_partial3_two\n");
+ wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.TESTENUM",
+ " Description for TESTENUM.\n" +
+ "\n");
+
+ wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.TESTENUM.TEST_NONE",
+ " something for none\n");
+
+ wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.TESTENUM.TEST_ONE",
+ " something for one\n");
+
+ wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.TESTENUM.TEST_TWO",
+ " something for two something more for two\n");
+
wantedComments.put("doxygen_misc_constructs.StructWithReturnComment",
" @return This is a bad place for this tag, but it should be ignored.");
diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y
index 178c8893d..41d805c28 100644
--- a/Source/CParse/parser.y
+++ b/Source/CParse/parser.y
@@ -6479,6 +6479,11 @@ enumlist : enumlist_item {
set_comment($1, $2);
$$ = $1;
}
+ | enumlist_item DOXYGENSTRING {
+ Setattr($1, "_last", $1);
+ set_comment($1, $2);
+ $$ = $1;
+ }
| enumlist_item COMMA enumlist {
if ($3) {
set_nextSibling($1, $3);