summaryrefslogtreecommitdiffstats
path: root/src/code.l
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2019-09-24 18:11:58 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2019-09-24 18:11:58 (GMT)
commitfe66145d44ad4cf79e2bb4928b190c415aaf5b90 (patch)
tree1d2df26849f5aa877292c95c1c2ab307a63aec04 /src/code.l
parent661a5377377a9f346a26c1cba38463f8d9c31d1a (diff)
downloadDoxygen-fe66145d44ad4cf79e2bb4928b190c415aaf5b90.zip
Doxygen-fe66145d44ad4cf79e2bb4928b190c415aaf5b90.tar.gz
Doxygen-fe66145d44ad4cf79e2bb4928b190c415aaf5b90.tar.bz2
Avoid code duplication and make the keyword matching more robust
Diffstat (limited to 'src/code.l')
-rw-r--r--src/code.l20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/code.l b/src/code.l
index f8a062f..9428432 100644
--- a/src/code.l
+++ b/src/code.l
@@ -1806,6 +1806,14 @@ static bool skipLanguageSpecificKeyword(const QCString &kw)
return g_insideCpp && (kw == "remove" || kw == "set" || kw == "get");
}
+static bool isCastKeyword(const QCString &s)
+{
+ int i=s.find('<');
+ if (i==-1) return FALSE;
+ QCString kw = s.left(i).stripWhiteSpace();
+ return kw=="const_cast" || kw=="static_cast" || kw=="dynamic_cast" || kw=="reinterpret_cast";
+}
+
/* -----------------------------------------------------------------
*/
#undef YY_INPUT
@@ -2619,9 +2627,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\"
g_name+=yytext+7;
}
<Body,TemplCast>{SCOPENAME}{B}*"<"[^\n\/\-\.\{\"\>\(]*">"("::"{ID})*/{B}* { // A<T> *pt;
- int i=QCString(yytext).find('<');
- QCString kw = QCString(yytext).left(i).stripWhiteSpace();
- if (kw.right(5)=="_cast" && YY_START==Body)
+ if (isCastKeyword(yytext) && YY_START==Body)
{
REJECT;
}
@@ -2651,9 +2657,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\"
}
<Body>{SCOPETNAME}{B}*"<"[^\n\/\-\.\{\"\>]*">"/{BN}*"(" |
<Body>{SCOPETNAME}/{BN}*"(" { // a() or c::a() or t<A,B>::a() or A\B\foo()
- int i=QCString(yytext).find('<');
- QCString kw = QCString(yytext).left(i).stripWhiteSpace();
- if (kw.right(5)=="_cast" && YY_START==Body)
+ if (isCastKeyword(yytext))
{
REJECT;
}
@@ -3068,9 +3072,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\"
endFontClass();
}
<MemberCall2,FuncCall>{ID}(({B}*"<"[^\n\[\](){}<>]*">")?({B}*"::"{B}*{ID})?)* {
- int i=QCString(yytext).find('<');
- QCString kw = QCString(yytext).left(i).stripWhiteSpace();
- if (kw.right(5)=="_cast")
+ if (isCastKeyword(yytext))
{
REJECT;
}