diff options
author | David Boddie <david.boddie@nokia.com> | 2011-02-04 20:21:37 (GMT) |
---|---|---|
committer | David Boddie <david.boddie@nokia.com> | 2011-02-04 20:21:37 (GMT) |
commit | e664bcceeeac38d19cbd6e8e1fc8883442f85e1b (patch) | |
tree | 4c094d47becf0f99fc5b6c3fc2c599f9c1d1ca0a | |
parent | f3350644b74a37d7619d2de57f345e8d6dcb30f3 (diff) | |
download | Qt-e664bcceeeac38d19cbd6e8e1fc8883442f85e1b.zip Qt-e664bcceeeac38d19cbd6e8e1fc8883442f85e1b.tar.gz Qt-e664bcceeeac38d19cbd6e8e1fc8883442f85e1b.tar.bz2 |
Fixed C++ and plain markup found in \c commands.
-rw-r--r-- | tools/qdoc3/cppcodemarker.cpp | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index 1b1e8f2..29f1c52 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -911,7 +911,7 @@ static QString untabified(const QString &in) QString CppCodeMarker::addMarkUp(const QString &in, const Node * /* relative */, - const Location & /* location */) + const Location /* &location */) { #define readChar() \ ch = (i < (int)code.length()) ? code[i++].cell() : EOF @@ -935,6 +935,7 @@ QString CppCodeMarker::addMarkUp(const QString &in, int braceDepth = 0; int parenDepth = 0; int i = 0; + int start = 0; char ch; QRegExp classRegExp("Qt?(?:[A-Z3]+[a-z][A-Za-z]*|t)"); QRegExp functionRegExp("q([A-Z][a-z]+)+"); @@ -942,7 +943,7 @@ QString CppCodeMarker::addMarkUp(const QString &in, readChar(); while (ch != EOF) { - int second = i; + int finish = i; QString tag; bool target = false; @@ -950,6 +951,7 @@ QString CppCodeMarker::addMarkUp(const QString &in, QString ident; do { ident += ch; + finish = i; readChar(); } while (isalnum(ch) || ch == '_'); @@ -970,6 +972,7 @@ QString CppCodeMarker::addMarkUp(const QString &in, } } else if (isdigit(ch)) { do { + finish = i; readChar(); } while (isalnum(ch) || ch == '.'); tag = QLatin1String("number"); @@ -992,10 +995,12 @@ QString CppCodeMarker::addMarkUp(const QString &in, case ']': case '|': case '~': + finish = i; readChar(); tag = QLatin1String("op"); break; case '"': + finish = i; readChar(); while (ch != EOF && ch != '"') { @@ -1003,19 +1008,23 @@ QString CppCodeMarker::addMarkUp(const QString &in, readChar(); readChar(); } + finish = i; readChar(); tag = QLatin1String("string"); break; case '#': + finish = i; readChar(); while (ch != EOF && ch != '\n') { if (ch == '\\') readChar(); + finish = i; readChar(); } tag = QLatin1String("preprocessor"); break; case '\'': + finish = i; readChar(); while (ch != EOF && ch != '\'') { @@ -1023,28 +1032,35 @@ QString CppCodeMarker::addMarkUp(const QString &in, readChar(); readChar(); } + finish = i; readChar(); tag = QLatin1String("char"); break; case '(': + finish = i; readChar(); parenDepth++; break; case ')': + finish = i; readChar(); parenDepth--; break; case ':': + finish = i; readChar(); if (ch == ':') { + finish = i; readChar(); tag = QLatin1String("op"); } break; case '/': + finish = i; readChar(); if (ch == '/') { do { + finish = i; readChar(); } while (ch != EOF && ch != '\n'); tag = QLatin1String("comment"); @@ -1052,6 +1068,7 @@ QString CppCodeMarker::addMarkUp(const QString &in, bool metAster = false; bool metAsterSlash = false; + finish = i; readChar(); while (!metAsterSlash) { @@ -1064,6 +1081,7 @@ QString CppCodeMarker::addMarkUp(const QString &in, metAsterSlash = true; else metAster = false; + finish = i; readChar(); } tag = QLatin1String("comment"); @@ -1072,23 +1090,24 @@ QString CppCodeMarker::addMarkUp(const QString &in, } break; case '{': + finish = i; readChar(); braceDepth++; break; case '}': + finish = i; readChar(); braceDepth--; break; default: + finish = i; readChar(); } } QString text; - if ((tag.isEmpty() || second == 1) && i == code.length()) - text = code.mid(second - 1, i - second + 1); - else - text = code.mid(second - 1, i - second); + text = code.mid(start, finish - start); + start = finish; if (!tag.isEmpty()) { out += QLatin1String("<@") + tag; |