forked from qt-creator/qt-creator
Lexer: Support Microsoft suffix (u)i64
MSVC2010 supports all combinations of upper- and lowercase U/I. Task-number: QTCREATORBUG-15554 Change-Id: I0106e6b5038a62aebe5a6c1eb0467d693befb4b0 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
committed by
André Hartmann
parent
f539ff1fcf
commit
369b1f7f38
11
src/libs/3rdparty/cplusplus/Lexer.cpp
vendored
11
src/libs/3rdparty/cplusplus/Lexer.cpp
vendored
@@ -853,6 +853,17 @@ bool Lexer::scanOptionalIntegerSuffix(bool allowU)
|
||||
scanOptionalIntegerSuffix(false);
|
||||
}
|
||||
return true;
|
||||
case 'i':
|
||||
case 'I':
|
||||
yyinp();
|
||||
if (_yychar == '6') {
|
||||
yyinp();
|
||||
if (_yychar == '4') {
|
||||
yyinp();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
case 'l':
|
||||
yyinp();
|
||||
if (_yychar == 'l')
|
||||
|
@@ -336,6 +336,30 @@ void tst_SimpleLexer::literals_data()
|
||||
;
|
||||
QTest::newRow("integer-literals") << source << expectedTokenKindList;
|
||||
|
||||
source =
|
||||
"42ui64\n"
|
||||
"43UI64\n"
|
||||
"44Ui64\n"
|
||||
"45uI64\n"
|
||||
"46i64\n"
|
||||
"47I64\n"
|
||||
"0xffffui64\n"
|
||||
"0xfffeUi64\n"
|
||||
"0xfffdi64\n"
|
||||
"56ui\n" // incomplete
|
||||
"56ui6\n"
|
||||
"57ui67\n" // wrong
|
||||
"58i67\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_NUMERIC_LITERAL << T_NUMERIC_LITERAL
|
||||
<< T_NUMERIC_LITERAL << T_NUMERIC_LITERAL
|
||||
<< T_ERROR << T_ERROR
|
||||
;
|
||||
QTest::newRow("microsoft-suffix") << source << expectedTokenKindList;
|
||||
|
||||
source =
|
||||
"R\"(raw text)\"\n"
|
||||
"R\"delimiter(raw text)delimiter\"\n"
|
||||
|
Reference in New Issue
Block a user