summaryrefslogtreecommitdiffstats
path: root/tools/linguist/lupdate/cpp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/linguist/lupdate/cpp.cpp')
-rw-r--r--tools/linguist/lupdate/cpp.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp
index 970d44b..6ea7299 100644
--- a/tools/linguist/lupdate/cpp.cpp
+++ b/tools/linguist/lupdate/cpp.cpp
@@ -489,6 +489,7 @@ STRING(class);
STRING(findMessage);
STRING(friend);
STRING(namespace);
+STRING(operator);
STRING(qtTrId);
STRING(return);
STRING(struct);
@@ -753,6 +754,20 @@ uint CppParser::getToken()
if (yyWord == strnamespace)
return Tok_namespace;
break;
+ case 'o':
+ if (yyWord == stroperator) {
+ // Operator overload declaration/definition.
+ // We need to prevent those characters from confusing the followup
+ // parsing. Actually using them does not add value, so just eat them.
+ while (isspace(yyCh))
+ yyCh = getChar();
+ while (yyCh == '+' || yyCh == '-' || yyCh == '*' || yyCh == '/' || yyCh == '%'
+ || yyCh == '=' || yyCh == '<' || yyCh == '>' || yyCh == '!'
+ || yyCh == '&' || yyCh == '|' || yyCh == '~' || yyCh == '^'
+ || yyCh == '[' || yyCh == ']')
+ yyCh = getChar();
+ }
+ break;
case 'q':
if (yyWord == strqtTrId)
return Tok_trid;
@@ -1678,6 +1693,8 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
functionContextUnresolved.clear(); // Pointless
prospectiveContext.clear();
pendingContext.clear();
+
+ yyTok = getToken();
}
break;
case Tok_namespace:
@@ -1689,7 +1706,6 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
HashString ns = HashString(text);
yyTok = getToken();
if (yyTok == Tok_LeftBrace) {
- yyTok = getToken();
namespaceDepths.push(namespaces.count());
enterNamespace(&namespaces, ns);
@@ -1697,6 +1713,7 @@ void CppParser::parseInternal(ConversionData &cd, QSet<QString> &inclusions)
functionContextUnresolved.clear();
prospectiveContext.clear();
pendingContext.clear();
+ yyTok = getToken();
} else if (yyTok == Tok_Equals) {
// e.g. namespace Is = OuterSpace::InnerSpace;
QList<HashString> fullName;