summaryrefslogtreecommitdiffstats
path: root/src/pyscanner.l
diff options
context:
space:
mode:
authoralbert-github <albert.tests@gmail.com>2020-08-04 11:23:41 (GMT)
committeralbert-github <albert.tests@gmail.com>2020-08-04 11:23:41 (GMT)
commit8f7394212564e1c466636d737fcb7abec5fdbfe6 (patch)
treebaad6d962355b9a660d92df82314b37c7f7d3618 /src/pyscanner.l
parentaa89f8773a50887ad20fbf683ff3c9af38c8fc5e (diff)
downloadDoxygen-8f7394212564e1c466636d737fcb7abec5fdbfe6.zip
Doxygen-8f7394212564e1c466636d737fcb7abec5fdbfe6.tar.gz
Doxygen-8f7394212564e1c466636d737fcb7abec5fdbfe6.tar.bz2
Empty python comment gives problems
In case we have an empty python comment like: `"""""""` (i.e. 6 double quotes) doxygen will crash in the pyscanner.l version of `stripIndentation`. ``` class Translator(nodes.NodeVisitor): """""" ## the var words_and_spaces = re.compile(r'\S+| +|\n') ``` In case of an empty comment we should not call `stripIndentation` and not place `\verbatim` / `\endverbatim` around the empty comment (the later would give an non-understandable empty comment block). An empty comment should be handled as no comment. Found by Fossies whilst generating documentation for Mercural 5.5).
Diffstat (limited to 'src/pyscanner.l')
-rw-r--r--src/pyscanner.l18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/pyscanner.l b/src/pyscanner.l
index 773391b..701381b 100644
--- a/src/pyscanner.l
+++ b/src/pyscanner.l
@@ -1253,9 +1253,12 @@ STARTDOCSYMS "##"
QCString actualDoc=yyextra->docBlock;
if (!yyextra->docBlockSpecial) // legacy unformatted docstring
{
- stripIndentation(actualDoc,yyextra->commentIndent);
- actualDoc.prepend("\\verbatim\n");
- actualDoc.append("\\endverbatim ");
+ if (!actualDoc.isEmpty())
+ {
+ stripIndentation(actualDoc,yyextra->commentIndent);
+ actualDoc.prepend("\\verbatim\n");
+ actualDoc.append("\\endverbatim ");
+ }
}
//printf("-------> yyextra->current=%p yyextra->bodyEntry=%p\n",yyextra->current,yyextra->bodyEntry);
handleCommentBlock(yyscanner, actualDoc, FALSE);
@@ -1265,9 +1268,12 @@ STARTDOCSYMS "##"
QCString actualDoc=yyextra->docBlock;
if (!yyextra->docBlockSpecial) // legacy unformatted docstring
{
- stripIndentation(actualDoc,yyextra->commentIndent);
- actualDoc.prepend("\\verbatim\n");
- actualDoc.append("\\endverbatim ");
+ if (!actualDoc.isEmpty())
+ {
+ stripIndentation(actualDoc,yyextra->commentIndent);
+ actualDoc.prepend("\\verbatim\n");
+ actualDoc.append("\\endverbatim ");
+ }
}
actualDoc.prepend("\\namespace "+yyextra->moduleScope+" ");
handleCommentBlock(yyscanner, actualDoc, FALSE);