Code formatting fixes in doxygen code

This commit is contained in:
William S Fulton 2018-05-19 20:52:39 +01:00
commit 73c585b994
4 changed files with 109 additions and 111 deletions

View file

@ -53,50 +53,52 @@ static int rename_active = 0;
/* Doxygen comments scanning */
int scan_doxygen_comments = 0;
int isStructuralDoxygen(String *s){
static const char* const structuralTags[] = {
"addtogroup",
"callgraph",
"callergraph",
"category",
"def",
"defgroup",
"dir",
"example",
"file",
"headerfile",
"internal",
"mainpage",
"name",
"nosubgrouping",
"overload",
"package",
"page",
"protocol",
"relates",
"relatesalso",
"showinitializer",
"weakgroup",
};
int isStructuralDoxygen(String *s) {
static const char* const structuralTags[] = {
"addtogroup",
"callgraph",
"callergraph",
"category",
"def",
"defgroup",
"dir",
"example",
"file",
"headerfile",
"internal",
"mainpage",
"name",
"nosubgrouping",
"overload",
"package",
"page",
"protocol",
"relates",
"relatesalso",
"showinitializer",
"weakgroup",
};
unsigned n;
char *slashPointer = Strchr(s, '\\');
char *atPointer = Strchr(s,'@');
if (slashPointer == NULL && atPointer == NULL) return 0;
else if( slashPointer == NULL) slashPointer = atPointer;
unsigned n;
char *slashPointer = Strchr(s, '\\');
char *atPointer = Strchr(s,'@');
if (slashPointer == NULL && atPointer == NULL)
return 0;
else if(slashPointer == NULL)
slashPointer = atPointer;
slashPointer++; /* skip backslash or at sign */
slashPointer++; /* skip backslash or at sign */
for (n = 0; n < sizeof(structuralTags)/sizeof(structuralTags[0]); n++) {
const size_t len = strlen(structuralTags[n]);
if (strncmp(slashPointer, structuralTags[n], len) == 0) {
/* Take care to avoid false positives with prefixes of other tags. */
if (slashPointer[len] == '\0' || isspace(slashPointer[len]))
return 1;
}
}
for (n = 0; n < sizeof(structuralTags)/sizeof(structuralTags[0]); n++) {
const size_t len = strlen(structuralTags[n]);
if (strncmp(slashPointer, structuralTags[n], len) == 0) {
/* Take care to avoid false positives with prefixes of other tags. */
if (slashPointer[len] == '\0' || isspace(slashPointer[len]))
return 1;
}
}
return 0;
return 0;
}
/* -----------------------------------------------------------------------------
@ -427,7 +429,7 @@ static int yylook(void) {
do {
String *cmt = Scanner_text(scan);
char *loc = Char(cmt);
if ((strncmp(loc,"/*@SWIG",7) == 0) && (loc[Len(cmt)-3] == '@')) {
if ((strncmp(loc, "/*@SWIG", 7) == 0) && (loc[Len(cmt)-3] == '@')) {
Scanner_locator(scan, cmt);
}
if (scan_doxygen_comments) { /* else just skip this node, to avoid crashes in parser module*/
@ -437,9 +439,7 @@ static int yylook(void) {
if (Len(cmt) > 3 && loc[0] == '/' &&
((loc[1] == '/' && ((loc[2] == '/' && loc[3] != '/') || loc[2] == '!')) ||
(loc[1] == '*' && ((loc[2] == '*' && loc[3] != '*') || loc[2] == '!')))) {
comment_kind_t this_comment = loc[3] == '<' ? DOX_COMMENT_POST
: DOX_COMMENT_PRE;
comment_kind_t this_comment = loc[3] == '<' ? DOX_COMMENT_POST : DOX_COMMENT_PRE;
if (existing_comment != DOX_COMMENT_NONE && this_comment != existing_comment) {
/* We can't concatenate together Doxygen pre- and post-comments. */
break;

View file

@ -1723,8 +1723,8 @@ program : interface {
interface : interface declaration {
/* add declaration to end of linked list (the declaration isn't always a single declaration, sometimes it is a linked list itself) */
if (currentDeclComment != NULL) {
set_comment($2, currentDeclComment);
currentDeclComment = NULL;
set_comment($2, currentDeclComment);
currentDeclComment = NULL;
}
appendChild($1,$2);
$$ = $1;
@ -1736,7 +1736,7 @@ interface : interface declaration {
| interface DOXYGENPOSTSTRING {
Node *node = lastChild($1);
if (node) {
set_comment(node, $2);
set_comment(node, $2);
}
$$ = $1;
}
@ -5048,7 +5048,11 @@ rawparms : parm ptail {
set_nextSibling($1,$2);
$$ = $1;
}
| empty { $$ = 0; previousNode = currentNode; currentNode=0; }
| empty {
$$ = 0;
previousNode = currentNode;
currentNode=0;
}
;
ptail : COMMA parm ptail {
@ -5057,7 +5061,7 @@ ptail : COMMA parm ptail {
}
| COMMA DOXYGENPOSTSTRING parm ptail {
set_comment(previousNode, $2);
set_nextSibling($3,$4);
set_nextSibling($3, $4);
$$ = $3;
}
| empty { $$ = 0; }