diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-04-01 13:25:27 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-05-18 21:05:12 +0200 |
commit | ac80dc4b27551159925709a675d0c2970d70ddaa (patch) | |
tree | b8c6884a4ac9a4a9397b5d021afa87fffbd92c1e /src/qdoc/cppcodemarker.cpp | |
parent | d9dc6dddb49439900695a5000e6ad19c935a535e (diff) | |
download | qttools-ac80dc4b27551159925709a675d0c2970d70ddaa.tar.gz |
Port qdoc to QRegularExpression
Change-Id: I2c9eb349a92503afcdd41bacf556e561d9f8c098
Reviewed-by: Liang Qi <liang.qi@qt.io>
Diffstat (limited to 'src/qdoc/cppcodemarker.cpp')
-rw-r--r-- | src/qdoc/cppcodemarker.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/qdoc/cppcodemarker.cpp b/src/qdoc/cppcodemarker.cpp index 1f8d11318..d2cf2018d 100644 --- a/src/qdoc/cppcodemarker.cpp +++ b/src/qdoc/cppcodemarker.cpp @@ -36,7 +36,7 @@ #include "tree.h" #include <QtCore/qdebug.h> -#include <QtCore/qregexp.h> +#include <QtCore/qregularexpression.h> QT_BEGIN_NAMESPACE @@ -392,7 +392,7 @@ QString CppCodeMarker::markedUpIncludes(const QStringList &includes) QString CppCodeMarker::functionBeginRegExp(const QString &funcName) { - return QLatin1Char('^') + QRegExp::escape(funcName) + QLatin1Char('$'); + return QLatin1Char('^') + QRegularExpression::escape(funcName) + QLatin1Char('$'); } QString CppCodeMarker::functionEndRegExp(const QString & /* funcName */) @@ -482,9 +482,9 @@ QString CppCodeMarker::addMarkUp(const QString &in, const Node * /* relative */, int start = 0; int finish = 0; QChar ch; - QRegExp classRegExp("Qt?(?:[A-Z3]+[a-z][A-Za-z]*|t)"); - QRegExp functionRegExp("q([A-Z][a-z]+)+"); - QRegExp findFunctionRegExp(QStringLiteral("^\\s*\\(")); + QRegularExpression classRegExp(QRegularExpression::anchoredPattern("Qt?(?:[A-Z3]+[a-z][A-Za-z]*|t)")); + QRegularExpression functionRegExp(QRegularExpression::anchoredPattern("q([A-Z][a-z]+)+")); + QRegularExpression findFunctionRegExp(QStringLiteral("^\\s*\\(")); readChar(); @@ -500,9 +500,9 @@ QString CppCodeMarker::addMarkUp(const QString &in, const Node * /* relative */, readChar(); } while (ch.isLetterOrNumber() || ch == '_'); - if (classRegExp.exactMatch(ident)) { + if (classRegExp.match(ident).hasMatch()) { tag = QStringLiteral("type"); - } else if (functionRegExp.exactMatch(ident)) { + } else if (functionRegExp.match(ident).hasMatch()) { tag = QStringLiteral("func"); target = true; } else if (types.contains(ident)) { |