From c5bfbe27f5bbdb1f3e76af8ca5e0f4df27875a06 Mon Sep 17 00:00:00 2001 From: Warwick Allison <warwick.allison@nokia.com> Date: Fri, 16 Oct 2009 17:22:36 +1000 Subject: qdoc: Fix misinterpretation of // in strings as a single-line-comment. Mainly fixes quoted URLs, but a few other cases too. --- tools/qdoc3/cppcodemarker.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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;)|\\\\"|\\\\(?!"))*")*//(?!!)[^!\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) -- cgit v0.12