summaryrefslogtreecommitdiffstats
path: root/src/doctokenizer.l
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2021-03-03 18:54:18 (GMT)
committerGitHub <noreply@github.com>2021-03-03 18:54:18 (GMT)
commit23a88bee679fb545a4d22ac10f10203cb575056b (patch)
treea6943dfa74967be46a5cd65d2c4361afe2d3f0a4 /src/doctokenizer.l
parent789625caed4097a075819b7d7299ab1a808fcf08 (diff)
parentcc78ebc6ad3d24d25ac779eeed9fb5fa3c89ee27 (diff)
downloadDoxygen-23a88bee679fb545a4d22ac10f10203cb575056b.zip
Doxygen-23a88bee679fb545a4d22ac10f10203cb575056b.tar.gz
Doxygen-23a88bee679fb545a4d22ac10f10203cb575056b.tar.bz2
Merge branch 'master' into feature/bug_lex
Diffstat (limited to 'src/doctokenizer.l')
-rw-r--r--src/doctokenizer.l51
1 files changed, 28 insertions, 23 deletions
diff --git a/src/doctokenizer.l b/src/doctokenizer.l
index d994340..a717d69 100644
--- a/src/doctokenizer.l
+++ b/src/doctokenizer.l
@@ -26,10 +26,10 @@
#include <ctype.h>
#include <stack>
+#include <string>
#include <qfile.h>
#include <qstring.h>
-#include <qregexp.h>
#include "doctokenizer.h"
#include "cmdmapper.h"
@@ -41,6 +41,7 @@
#include "doxygen.h"
#include "portable.h"
#include "cite.h"
+#include "regex.h"
#define YY_NO_INPUT 1
#define YY_NO_UNISTD_H 1
@@ -514,9 +515,11 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio
else
{
lineCount(yytext,yyleng);
- QCString text=yytext;
- static QRegExp re("[*+]");
- int listPos = text.findRev(re);
+ std::string text=yytext;
+ static const reg::Ex re(R"([*+][^*+]*$)"); // find last + or *
+ reg::Match match;
+ reg::search(text,match,re);
+ size_t listPos = match.position();
g_token->isEnumList = FALSE;
g_token->id = -1;
g_token->indent = computeIndent(yytext,listPos);
@@ -530,13 +533,13 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio
}
else
{
- QCString text=yytext;
- static QRegExp re("[1-9]");
- int digitPos = text.find(re);
- int dotPos = text.find('.',digitPos);
- g_token->isEnumList = TRUE;
- g_token->id = atoi(QCString(yytext).mid(digitPos,dotPos-digitPos));
- g_token->indent = computeIndent(yytext,digitPos);
+ std::string text=yytext;
+ static const reg::Ex re(R"(\d+)");
+ reg::Match match;
+ reg::search(text,match,re);
+ g_token->isEnumList = true;
+ g_token->id = std::stoul(match.str());
+ g_token->indent = computeIndent(yytext,match.position());
return TK_LISTITEM;
}
}
@@ -557,12 +560,14 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio
else
{
lineCount(yytext,yyleng);
- QCString text=extractPartAfterNewLine(yytext);
- static QRegExp re("[*+]");
- int markPos = text.findRev(re);
+ std::string text=extractPartAfterNewLine(yytext).str();
+ static const reg::Ex re(R"([*+][^*+]*$)"); // find last + or *
+ reg::Match match;
+ reg::search(text,match,re);
+ size_t markPos = match.position();
g_token->isEnumList = FALSE;
g_token->id = -1;
- g_token->indent = computeIndent(text,markPos);
+ g_token->indent = computeIndent(text.c_str(),markPos);
return TK_LISTITEM;
}
}
@@ -574,13 +579,13 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio
else
{
lineCount(yytext,yyleng);
- QCString text=extractPartAfterNewLine(yytext);
- static QRegExp re("[1-9]");
- int digitPos = text.find(re);
- int dotPos = text.find('.',digitPos);
- g_token->isEnumList = TRUE;
- g_token->id = atoi(QCString(text).mid(digitPos,dotPos-digitPos));
- g_token->indent = computeIndent(text,digitPos);
+ std::string text=extractPartAfterNewLine(yytext).str();
+ static const reg::Ex re(R"(\d+)");
+ reg::Match match;
+ reg::search(text,match,re);
+ g_token->isEnumList = true;
+ g_token->id = std::stoul(match.str());
+ g_token->indent = computeIndent(text.c_str(),match.position());
return TK_LISTITEM;
}
}
@@ -809,7 +814,7 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio
}
lineCount(yytext,yyleng);
}
-<St_Para>({BLANK}*(\n|"\\ilinebr"))+{BLANK}*(\n|"\\ilinebr"){BLANK}* {
+<St_Para,St_Param>({BLANK}*(\n|"\\ilinebr"))+{BLANK}*(\n|"\\ilinebr"){BLANK}* {
lineCount(yytext,yyleng);
if (g_insidePre)
{