summaryrefslogtreecommitdiffstats
path: root/tools/linguist/shared/cpp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/linguist/shared/cpp.cpp')
-rw-r--r--tools/linguist/shared/cpp.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/tools/linguist/shared/cpp.cpp b/tools/linguist/shared/cpp.cpp
index 28616cc..2e137cf 100644
--- a/tools/linguist/shared/cpp.cpp
+++ b/tools/linguist/shared/cpp.cpp
@@ -130,12 +130,19 @@ static int yyInPos;
static uint getChar()
{
- if (yyInPos >= yyInStr.size())
- return EOF;
- QChar c = yyInStr[yyInPos++];
- if (c.unicode() == '\n')
- ++yyCurLineNo;
- return c.unicode();
+ forever {
+ if (yyInPos >= yyInStr.size())
+ return EOF;
+ uint c = yyInStr[yyInPos++].unicode();
+ if (c == '\\' && yyInPos < yyInStr.size() && yyInStr[yyInPos].unicode() == '\n') {
+ ++yyCurLineNo;
+ ++yyInPos;
+ continue;
+ }
+ if (c == '\n')
+ ++yyCurLineNo;
+ return c;
+ }
}
static uint getToken()
@@ -784,7 +791,7 @@ static void parse(Translator *tor, const QString &initialContext, const QString
if (yyTok == Tok_ColonColon)
fullName.append(QString());
while (yyTok == Tok_ColonColon || yyTok == Tok_Ident) {
- if (yyTok == Tok_Ident)
+ if (yyTok == Tok_Ident)
fullName.append(yyIdent);
yyTok = getToken();
}