Fix parsing of unconventional Doxygen post comments for enum items.

Closes #1715
This commit is contained in:
William S Fulton 2022-12-03 01:10:28 +00:00
commit 24f75aa481
4 changed files with 76 additions and 2 deletions

View file

@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
Version 4.2.0 (in progress) Version 4.2.0 (in progress)
=========================== ===========================
2022-12-03: wsfulton
#1715 Fix syntax error parsing of unconventionally placed Doxygen post
comments for enum items.
2022-12-02: wsfulton 2022-12-02: wsfulton
#624 #1021 Improved template template parameters support. Previously, specifying more #624 #1021 Improved template template parameters support. Previously, specifying more
than one simple template template parameter resulted in a parse error. Now than one simple template template parameter resulted in a parse error. Now

View file

@ -95,13 +95,36 @@
class ClassWithNestedEnum { class ClassWithNestedEnum {
public: public:
/** /**
* Enum description. * ENested description.
*/ */
typedef enum {ONE, ///< desc of one typedef enum {ONE, ///< desc of one
TWO, ///< desc of two TWO, ///< desc of two
THREE ///< desc of three THREE ///< desc of three
} ENested; } ENested;
/**
* ENestedOdd description.
*/
typedef enum {ODD_ONE ///< desc of odd_one
,ODD_TWO ///< desc of odd_two
,ODD_THREE ///< desc of odd_three
} ENestedOdd;
/**
* ENestedOddPartial1 description.
*/
typedef enum {ODD_PARTIAL1_ONE
,ODD_PARTIAL1_TWO ///< desc of odd_partial1_two
,ODD_PARTIAL1_THREE ///< desc of odd_partial1_three
} ENestedOddPartial1;
/**
* ENestedOddPartial3 description.
*/
typedef enum {ODD_PARTIAL3_ONE ///< desc of odd_partial3_one
,ODD_PARTIAL3_TWO ///< desc of odd_partial3_two
,ODD_PARTIAL3_THREE
} ENestedOddPartial3;
}; };
/// @return This is a bad place for this tag, but it should be ignored. /// @return This is a bad place for this tag, but it should be ignored.

View file

@ -97,7 +97,7 @@ public class doxygen_misc_constructs_runme {
"\n"); "\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENested", wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENested",
" Enum description.\n" + " ENested description.\n" +
"\n"); "\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENested.ONE", wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENested.ONE",
@ -109,6 +109,42 @@ public class doxygen_misc_constructs_runme {
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENested.THREE", wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENested.THREE",
" desc of three\n"); " desc of three\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOdd",
" ENestedOdd description.\n" +
"\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOdd.ODD_ONE",
" desc of odd_one\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOdd.ODD_TWO",
" desc of odd_two\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOdd.ODD_THREE",
" desc of odd_three\n");
wantedComments.put("doxygen_misc_constructs.StructWithReturnComment",
" @return This is a bad place for this tag, but it should be ignored.");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOddPartial1",
" ENestedOddPartial1 description.\n" +
"\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOddPartial1.ODD_PARTIAL1_THREE",
" desc of odd_partial1_three\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOddPartial1.ODD_PARTIAL1_TWO",
" desc of odd_partial1_two\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOddPartial3",
" ENestedOddPartial3 description.\n" +
"\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOddPartial3.ODD_PARTIAL3_ONE",
" desc of odd_partial3_one\n");
wantedComments.put("doxygen_misc_constructs.ClassWithNestedEnum.ENestedOddPartial3.ODD_PARTIAL3_TWO",
" desc of odd_partial3_two\n");
wantedComments.put("doxygen_misc_constructs.StructWithReturnComment", wantedComments.put("doxygen_misc_constructs.StructWithReturnComment",
" @return This is a bad place for this tag, but it should be ignored."); " @return This is a bad place for this tag, but it should be ignored.");

View file

@ -6489,6 +6489,17 @@ enumlist : enumlist_item {
} }
$$ = $1; $$ = $1;
} }
| enumlist_item DOXYGENPOSTSTRING COMMA enumlist {
if ($4) {
set_nextSibling($1, $4);
Setattr($1,"_last",Getattr($4,"_last"));
Setattr($4,"_last",NULL);
} else {
Setattr($1,"_last",$1);
}
set_comment($1, $2);
$$ = $1;
}
| enumlist_item COMMA DOXYGENPOSTSTRING enumlist { | enumlist_item COMMA DOXYGENPOSTSTRING enumlist {
if ($4) { if ($4) {
set_nextSibling($1, $4); set_nextSibling($1, $4);