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
This commit is contained in:
William S Fulton 2022-12-03 09:32:26 +00:00
commit f7b4127310
4 changed files with 32 additions and 0 deletions

View file

@ -7,6 +7,9 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
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.

View file

@ -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.

View file

@ -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.");

View file

@ -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);