diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2021-03-02 20:40:36 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2021-03-02 21:35:36 (GMT) |
commit | 3d4f0313d20cc8f71ade094faa006a2171ff29c2 (patch) | |
tree | 0d84aff63e7b1bbd7bc46891771a90bc64ee58dc /src/doctokenizer.l | |
parent | 30d347bf8046775d6eab9bd8f70dbf3c3204e7b7 (diff) | |
download | Doxygen-3d4f0313d20cc8f71ade094faa006a2171ff29c2.zip Doxygen-3d4f0313d20cc8f71ade094faa006a2171ff29c2.tar.gz Doxygen-3d4f0313d20cc8f71ade094faa006a2171ff29c2.tar.bz2 |
Refactoring: replaced std::regex with own much faster implementation
Diffstat (limited to 'src/doctokenizer.l')
-rw-r--r-- | src/doctokenizer.l | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/doctokenizer.l b/src/doctokenizer.l index f30dba7..9bafcab 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -26,7 +26,6 @@ #include <ctype.h> #include <stack> -#include <regex> #include <string> #include <qfile.h> @@ -42,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 @@ -515,9 +515,9 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio { lineCount(yytext,yyleng); std::string text=yytext; - static const std::regex re("[*+][^*+]*$", std::regex::optimize); // find last + or * - std::smatch match; - std::regex_search(text,match,re); + 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; @@ -533,9 +533,9 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio else { std::string text=yytext; - static const std::regex re("[1-9]+", std::regex::optimize); - std::smatch match; - std::regex_search(text,match,re); + 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()); @@ -560,9 +560,9 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio { lineCount(yytext,yyleng); std::string text=extractPartAfterNewLine(yytext).str(); - static const std::regex re("[*+][^*+]*$", std::regex::optimize); // find last + or * - std::smatch match; - std::regex_search(text,match,re); + 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; @@ -579,9 +579,9 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio { lineCount(yytext,yyleng); std::string text=extractPartAfterNewLine(yytext).str(); - static const std::regex re("[1-9]+", std::regex::optimize); - std::smatch match; - std::regex_search(text,match,re); + 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()); |