summaryrefslogtreecommitdiffstats
path: root/src/markdown.cpp
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2019-12-30 18:34:15 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2019-12-30 18:34:15 (GMT)
commite55c2248b46d5580e5b184d2ff9c773f333308b2 (patch)
tree78e375caf67e26d4d2857a94d25a508a67bf64b8 /src/markdown.cpp
parentabf1e46f7bc2c31972d36231b4672580704fcc10 (diff)
downloadDoxygen-e55c2248b46d5580e5b184d2ff9c773f333308b2.zip
Doxygen-e55c2248b46d5580e5b184d2ff9c773f333308b2.tar.gz
Doxygen-e55c2248b46d5580e5b184d2ff9c773f333308b2.tar.bz2
Make commentscan.l reentrant
Diffstat (limited to 'src/markdown.cpp')
-rw-r--r--src/markdown.cpp47
1 files changed, 45 insertions, 2 deletions
diff --git a/src/markdown.cpp b/src/markdown.cpp
index 8594a15..aa64aa2 100644
--- a/src/markdown.cpp
+++ b/src/markdown.cpp
@@ -2588,6 +2588,49 @@ QCString markdownFileNameToId(const QCString &fileName)
return "md_"+baseName;
}
+//---------------------------------------------------------------------------
+
+QCString processMarkdownForCommentBlock(const QCString &comment,
+ const QCString &fileName,
+ int lineNr)
+{
+ if (!comment.isEmpty() && Doxygen::markdownSupport)
+ {
+ QCString result = processMarkdown(fileName,lineNr,0,comment);
+ const char *p = result.data();
+ if (p)
+ {
+ while (*p==' ') p++; // skip over spaces
+ while (*p=='\n') p++; // skip over newlines
+ if (qstrncmp(p,"<br>",4)==0) p+=4; // skip over <br>
+ }
+ if (p>result.data())
+ {
+ // strip part of the input
+ result = result.mid(p-result.data());
+ }
+ return result;
+ }
+ else
+ {
+ return comment;
+ }
+}
+
+//---------------------------------------------------------------------------
+
+struct MarkdownOutlineParser::Private
+{
+ CommentScanner commentScanner;
+};
+
+MarkdownOutlineParser::MarkdownOutlineParser() : p(std::make_unique<Private>())
+{
+}
+
+MarkdownOutlineParser::~MarkdownOutlineParser()
+{
+}
void MarkdownOutlineParser::parseInput(const char *fileName,
const char *fileBuf,
@@ -2640,8 +2683,8 @@ void MarkdownOutlineParser::parseInput(const char *fileName,
Protection prot=Public;
bool needsEntry = FALSE;
int position=0;
- QCString processedDocs = preprocessCommentBlock(docs,fileName,lineNr);
- while (parseCommentBlock(
+ QCString processedDocs = processMarkdownForCommentBlock(docs,fileName,lineNr);
+ while (p->commentScanner.parseCommentBlock(
this,
current.get(),
processedDocs,