summaryrefslogtreecommitdiffstats
path: root/tools/qdoc3/cppcodemarker.cpp
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-10-16 07:22:36 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-10-16 07:22:36 (GMT)
commitc5bfbe27f5bbdb1f3e76af8ca5e0f4df27875a06 (patch)
treec448cb9da75ff4f58ddbdd9e007b525376236f8c /tools/qdoc3/cppcodemarker.cpp
parent1118181c5c675f9072d94b1713d69d672e810eb2 (diff)
downloadQt-c5bfbe27f5bbdb1f3e76af8ca5e0f4df27875a06.zip
Qt-c5bfbe27f5bbdb1f3e76af8ca5e0f4df27875a06.tar.gz
Qt-c5bfbe27f5bbdb1f3e76af8ca5e0f4df27875a06.tar.bz2
qdoc: Fix misinterpretation of // in strings as a single-line-comment.
Mainly fixes quoted URLs, but a few other cases too.
Diffstat (limited to 'tools/qdoc3/cppcodemarker.cpp')
-rw-r--r--tools/qdoc3/cppcodemarker.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp
index ed3d150..917faa2 100644
--- a/tools/qdoc3/cppcodemarker.cpp
+++ b/tools/qdoc3/cppcodemarker.cpp
@@ -875,6 +875,7 @@ QString CppCodeMarker::addMarkUp(const QString& protectedCode,
static QRegExp globalX("[\n{()=] *([a-zA-Z_][a-zA-Z_0-9]*)[ \n]*\\(");
static QRegExp multiLineComment("/(?:( )?\\*(?:[^*]+|\\*(?! /))*\\*\\1/)");
multiLineComment.setMinimal(true);
+ static QRegExp singleLineCommentLine("(?:^|\n)(?:[^&]|&(?!quot;)|&quot;(?:[^&\\\\]|&(?!quot;)|\\\\&quot;|\\\\(?!&quot;))*&quot;)*//(?!!)[^!\n]*");
static QRegExp singleLineComment("//(?!!)[^!\n]*");
static QRegExp preprocessor("(?:^|\n)(#[ \t]*(?:include|if|elif|endif|error|pragma|define"
"|warning)(?:(?:\\\\\n|\\n#)[^\n]*)*)");
@@ -1050,7 +1051,8 @@ QString CppCodeMarker::addMarkUp(const QString& protectedCode,
int mlpos;
int slpos;
int len;
- slpos = singleLineComment.indexIn(result, pos);
+ int sllpos = singleLineCommentLine.indexIn(result, pos);
+ slpos = sllpos == -1 ? -1 : singleLineComment.indexIn(result, sllpos);
mlpos = multiLineComment.indexIn(result, pos);
if (slpos == -1 && mlpos == -1)