forked from qt-creator/qt-creator
C++: Support single quote digit separator in integer literals
C++14 supports the use of single quotes inserted between integer digits as a separator. Updates the built-in C++ code model to recognize such quotes. This fixes highlighting and indentation issues. Change-Id: Ic35ce93060b96700a11d108dce1f3cf6c4543632 Fixes: QTCREATORBUG-14939 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
committed by
Nikolai Kosjar
parent
8a9c5a093d
commit
8c437362bc
@@ -277,7 +277,10 @@ void tst_SimpleLexer::literals()
|
||||
QFETCH(QByteArray, source);
|
||||
QFETCH(TokenKindList, expectedTokenKindList);
|
||||
|
||||
run(source, toTokens(expectedTokenKindList), false, CompareKind);
|
||||
LanguageFeatures features;
|
||||
features.cxx14Enabled = true;
|
||||
run(source, toTokens(expectedTokenKindList), false, CompareKind, false,
|
||||
features);
|
||||
}
|
||||
|
||||
void tst_SimpleLexer::literals_data()
|
||||
@@ -320,14 +323,18 @@ void tst_SimpleLexer::literals_data()
|
||||
source = // these are all the same
|
||||
"42\n"
|
||||
"0b101010u\n"
|
||||
"0b101'010u\n"
|
||||
"052ll\n"
|
||||
"0'5'2ll\n"
|
||||
"0x2aL\n"
|
||||
"0x2'aL\n"
|
||||
"123FOO\n"
|
||||
"0xfOo\n"
|
||||
"33_\n"
|
||||
;
|
||||
expectedTokenKindList =
|
||||
TokenKindList() << T_NUMERIC_LITERAL << T_NUMERIC_LITERAL << T_NUMERIC_LITERAL
|
||||
<< T_NUMERIC_LITERAL << T_NUMERIC_LITERAL << T_NUMERIC_LITERAL
|
||||
<< T_NUMERIC_LITERAL << T_ERROR << T_ERROR << T_ERROR
|
||||
;
|
||||
QTest::newRow("integer-literals") << source << expectedTokenKindList;
|
||||
|
||||
Reference in New Issue
Block a user