summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2021-02-13 17:58:43 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2021-02-20 19:17:50 (GMT)
commitf640dced8976048f997026927a45a9c06672d02b (patch)
tree26ef39fdad74e0e13acc9b34482d0f2221ef723c /src
parent8c73f532713df7c6e7a4ffd438faee1f8666d5c8 (diff)
downloadDoxygen-f640dced8976048f997026927a45a9c06672d02b.zip
Doxygen-f640dced8976048f997026927a45a9c06672d02b.tar.gz
Doxygen-f640dced8976048f997026927a45a9c06672d02b.tar.bz2
Refactoring: replace QRegExp by std::regex in docparser.cpp
Diffstat (limited to 'src')
-rw-r--r--src/code.l1
-rw-r--r--src/commentcnv.l1
-rw-r--r--src/defargs.l1
-rw-r--r--src/docbookgen.cpp1
-rw-r--r--src/docparser.cpp24
5 files changed, 13 insertions, 15 deletions
diff --git a/src/code.l b/src/code.l
index f7e1775..5481fdc 100644
--- a/src/code.l
+++ b/src/code.l
@@ -38,7 +38,6 @@
#include <stdio.h>
#include <assert.h>
#include <ctype.h>
-#include <qregexp.h>
#include <qdir.h>
#include "code.h"
diff --git a/src/commentcnv.l b/src/commentcnv.l
index 817feb3..7a3cda5 100644
--- a/src/commentcnv.l
+++ b/src/commentcnv.l
@@ -29,7 +29,6 @@
#include <stdlib.h>
#include <stack>
-#include <qregexp.h>
#include <qtextstream.h>
#include <qglobal.h>
diff --git a/src/defargs.l b/src/defargs.l
index e25c1fe..6846544 100644
--- a/src/defargs.l
+++ b/src/defargs.l
@@ -56,7 +56,6 @@
//#include <iostream.h>
#include <assert.h>
#include <ctype.h>
-#include <qregexp.h>
#include <qcstringlist.h>
#include "defargs.h"
diff --git a/src/docbookgen.cpp b/src/docbookgen.cpp
index 372a462..984d685 100644
--- a/src/docbookgen.cpp
+++ b/src/docbookgen.cpp
@@ -20,7 +20,6 @@
#include <qdir.h>
#include <qfile.h>
#include <qtextstream.h>
-#include <qregexp.h>
#include "docbookgen.h"
#include "doxygen.h"
#include "message.h"
diff --git a/src/docparser.cpp b/src/docparser.cpp
index 83887c6..6c10bdb 100644
--- a/src/docparser.cpp
+++ b/src/docparser.cpp
@@ -16,6 +16,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <cassert>
+#include <regex>
#include <qfile.h>
#include <qfileinfo.h>
@@ -425,7 +426,7 @@ static QCString findAndCopyImage(const char *fileName,DocImage::Type type, bool
* member g_memberDef, then a warning is raised (unless warnings
* are disabled altogether).
*/
-static void checkArgumentName(const QCString &name)
+static void checkArgumentName(const std::string &name)
{
if (!Config_getBool(WARN_IF_DOC_ERROR)) return;
if (g_memberDef==0) return; // not a member
@@ -436,11 +437,13 @@ static void checkArgumentName(const QCString &name)
//printf("isDocsForDefinition()=%d\n",g_memberDef->isDocsForDefinition());
if (al.empty()) return; // no argument list
- static QRegExp re("$?[a-zA-Z0-9_\\x80-\\xFF]+\\.*");
- int p=0,i=0,l;
- while ((i=re.match(name,p,&l))!=-1) // to handle @param x,y
+ static std::regex re("(\\$[[:alnum:]_]|[[:alpha:]_])[[:alnum:]_]*\\.*");
+ std::sregex_iterator it(name.begin(),name.end(),re);
+ std::sregex_iterator end;
+ for (; it!=end ; ++it)
{
- QCString aName=name.mid(i,l);
+ const auto &match = *it;
+ QCString aName=match.str();
if (lang==SrcLangExt_Fortran) aName=aName.lower();
//printf("aName='%s'\n",aName.data());
bool found=FALSE;
@@ -482,7 +485,6 @@ static void checkArgumentName(const QCString &name)
qPrint(aName), qPrint(scope), qPrint(g_memberDef->name()),
qPrint(alStr), qPrint(inheritedFrom));
}
- p=i+l;
}
}
/*! Collects the return values found with \@retval command
@@ -872,9 +874,9 @@ static int handleStyleArgument(DocNode *parent,DocNodeList &children,
tok!=TK_ENDLIST
)
{
- static QRegExp specialChar("[.,|()\\[\\]:;\\?]");
+ static std::regex specialChar("[.,|()\\[\\]:;\\?]");
if (tok==TK_WORD && g_token->name.length()==1 &&
- g_token->name.find(specialChar)!=-1)
+ std::regex_match(g_token->name.str(),specialChar))
{
// special character that ends the markup command
return tok;
@@ -4533,13 +4535,13 @@ int DocParamList::parse(const QCString &cmdName)
handleParameterType(this,m_paramTypes,g_token->name.left(typeSeparator));
g_token->name = g_token->name.mid(typeSeparator+1);
g_hasParamCommand=TRUE;
- checkArgumentName(g_token->name);
+ checkArgumentName(g_token->name.str());
((DocParamSect*)parent())->m_hasTypeSpecifier=TRUE;
}
else
{
g_hasParamCommand=TRUE;
- checkArgumentName(g_token->name);
+ checkArgumentName(g_token->name.str());
}
}
else if (m_type==DocParamSect::RetVal)
@@ -4591,7 +4593,7 @@ int DocParamList::parseXml(const QCString &paramName)
if (m_type==DocParamSect::Param)
{
g_hasParamCommand=TRUE;
- checkArgumentName(g_token->name);
+ checkArgumentName(g_token->name.str());
}
else if (m_type==DocParamSect::RetVal)
{