From 7536e3a858e3c94f0e2a2ece52208364fd4b92d6 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sat, 12 Jun 2021 21:27:38 +0200 Subject: issue #8588: References to multiply nested class is broken with INLINE_SIMPLE_STRUCTS=YES --- src/memberdef.cpp | 12 ++++++------ src/regex.h | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 7133641..c116b7c 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -3659,16 +3659,16 @@ static QCString simplifyTypeForTable(const QCString &s) { QCString ts=removeAnonymousScopes(s); if (ts.right(2)=="::") ts = ts.left(ts.length()-2); - static const reg::Ex re1(R"(\a\w*::(\a\w*))"); // non-template version - static const reg::Ex re2(R"(\a\w*<[^>]*>::(\a\w*))"); // template version + static const reg::Ex re1(R"(\a\w*::)"); // non-template version + static const reg::Ex re2(R"(\a\w*<[^>]*>::)"); // template version reg::Match match; std::string t = ts.str(); - if (reg::search(t,match,re1) || reg::search(t,match,re2)) + while (reg::search(t,match,re2) || reg::search(t,match,re1)) { - ts = match[1].str(); // take the identifier after the last :: + t = match.prefix().str() + match.suffix().str(); // remove the matched part } - //printf("simplifyTypeForTable(%s)->%s\n",qPrint(s),qPrint(ts)); - return ts; + //printf("simplifyTypeForTable(%s)->%s\n",qPrint(s),t.c_str()); + return t; } QCString MemberDefImpl::fieldType() const diff --git a/src/regex.h b/src/regex.h index bedc052..531092b 100644 --- a/src/regex.h +++ b/src/regex.h @@ -162,11 +162,11 @@ class Match /** Return a string representing the matching part. */ std::string str() const { return m_subMatches[0].str(); } - /** Return the part of the string after the match */ - SubMatch suffix() const { SubMatch m(m_str); m.setMatch(0,position()); return m; } - /** Return the part of the string before the match */ - SubMatch prefix() const + SubMatch prefix() const { SubMatch m(m_str); m.setMatch(0,position()); return m; } + + /** Return the part of the string after the match */ + SubMatch suffix() const { SubMatch m(m_str); if (m_str) -- cgit v0.12