summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2010-09-09 16:34:18 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2010-09-10 14:31:24 (GMT)
commitc2d6eb9dca7546bbe8d9c6c62db683615e4b23a7 (patch)
treec3620e8161ef6afd38c0f9eb01271587c667fe8f /tools
parent94584dcdd02e2c08e05ca75f6f8b460c0c320947 (diff)
downloadQt-c2d6eb9dca7546bbe8d9c6c62db683615e4b23a7.zip
Qt-c2d6eb9dca7546bbe8d9c6c62db683615e4b23a7.tar.gz
Qt-c2d6eb9dca7546bbe8d9c6c62db683615e4b23a7.tar.bz2
don't let operator overloads confuse us
Task-number: QTBUG-11426
Diffstat (limited to 'tools')
-rw-r--r--tools/linguist/lupdate/cpp.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp
index 970d44b..009d5a7 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;