summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Kangas <marko.kangas@qt.io>2016-06-27 15:25:16 +0300
committerMarko Kangas <marko.kangas@qt.io>2016-06-29 12:41:43 +0000
commit0eb10e4193e1cfcc887359f194d48b52d5840bbe (patch)
treee50d31f8b4b8b019621ce8c1980b213c5d0910b2
parent0731b64ee6d3439e6ddfa3ee58a7e909b170ebb0 (diff)
downloadqttools-0eb10e4193e1cfcc887359f194d48b52d5840bbe.tar.gz
Linguist: Fix lupdate includes without spaces
Fixed lupdate to support includes without spaces before filename. Task-number: QTBUG-34092 Change-Id: If6b8d2b6941c9ea0084900ba14c81e261c0600cb Reviewed-by: Jan Kundrát <jkt@kde.org> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
-rw-r--r--src/linguist/lupdate/cpp.cpp5
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp8
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result10
3 files changed, 20 insertions, 3 deletions
diff --git a/src/linguist/lupdate/cpp.cpp b/src/linguist/lupdate/cpp.cpp
index e53994c76..b58ca3b84 100644
--- a/src/linguist/lupdate/cpp.cpp
+++ b/src/linguist/lupdate/cpp.cpp
@@ -566,10 +566,9 @@ CppParser::TokenType CppParser::getToken()
// include
do {
yyCh = getChar();
- } while (yyCh != EOF && !isspace(yyCh));
- do {
+ } while (yyCh != EOF && !isspace(yyCh) && yyCh != '"' && yyCh != '<' );
+ while (isspace(yyCh))
yyCh = getChar();
- } while (isspace(yyCh));
int tChar;
if (yyCh == '"')
tChar = '"';
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
index e6b966418..16b224b48 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp
@@ -644,3 +644,11 @@ class TranslatedAfterPrivate
tr("Must be in context TranslatedAfterPrivate");
}
};
+
+#include<QObject>
+
+QObject::tr("message after system include without space");
+
+#include"qobject.h"
+
+QObject::tr("message after local include without space");
diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
index e0a30c3be..8a535e9a8 100644
--- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
+++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result
@@ -387,6 +387,16 @@ backslashed \ stuff.</source>
<translation type="unfinished"></translation>
</message>
<message>
+ <location filename="main.cpp" line="650"/>
+ <source>message after system include without space</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="main.cpp" line="654"/>
+ <source>message after local include without space</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
<location filename="included.cpp" line="34"/>
<source>message from #included .cpp file</source>
<translation type="unfinished"></translation>