forked from qt-creator/qt-creator
C++: Do not add double quotes when splitting raw string litterals
Task-number: QTCREATORBUG-17717 Change-Id: Iffb34a3d77ada624dc13b8ab050ac08731d25863 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -237,7 +237,7 @@ bool MatchingText::isInCommentHelper(const QTextCursor &cursor, Token *retToken)
|
||||
return tk.isComment();
|
||||
}
|
||||
|
||||
bool MatchingText::isInStringHelper(const QTextCursor &cursor)
|
||||
Kind MatchingText::stringKindAtCursor(const QTextCursor &cursor)
|
||||
{
|
||||
int prevState = 0;
|
||||
const Tokens tokens = getTokens(cursor, prevState);
|
||||
@@ -245,15 +245,15 @@ bool MatchingText::isInStringHelper(const QTextCursor &cursor)
|
||||
const unsigned pos = cursor.selectionEnd() - cursor.block().position();
|
||||
|
||||
if (tokens.isEmpty() || pos <= tokens.first().utf16charsBegin())
|
||||
return false;
|
||||
return T_EOF_SYMBOL;
|
||||
|
||||
if (pos >= tokens.last().utf16charsEnd()) {
|
||||
const Token tk = tokens.last();
|
||||
return tk.isStringLiteral() && prevState > 0;
|
||||
return tk.isStringLiteral() && prevState > 0 ? tk.kind() : T_EOF_SYMBOL;
|
||||
}
|
||||
|
||||
Token tk = tokenAtPosition(tokens, pos);
|
||||
return tk.isStringLiteral() && pos > tk.utf16charsBegin();
|
||||
return tk.isStringLiteral() && pos > tk.utf16charsBegin() ? tk.kind() : T_EOF_SYMBOL;
|
||||
}
|
||||
|
||||
QString MatchingText::insertMatchingBrace(const QTextCursor &cursor, const QString &textToProcess,
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#include <cplusplus/Token.h>
|
||||
#include <cplusplus/CPlusPlusForwardDeclarations.h>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QTextCursor)
|
||||
@@ -46,7 +48,7 @@ public:
|
||||
static bool shouldInsertMatchingText(QChar lookAhead);
|
||||
|
||||
static bool isInCommentHelper(const QTextCursor &currsor, Token *retToken = 0);
|
||||
static bool isInStringHelper(const QTextCursor &cursor);
|
||||
static CPlusPlus::Kind stringKindAtCursor(const QTextCursor &cursor);
|
||||
|
||||
static QString insertMatchingBrace(const QTextCursor &tc, const QString &text,
|
||||
QChar lookAhead, bool skipChars, int *skippedChars);
|
||||
|
||||
Reference in New Issue
Block a user