Commit 369b1f7f authored by Andre Hartmann's avatar Andre Hartmann Committed by André Hartmann

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: default avatarNikolai Kosjar <nikolai.kosjar@theqtcompany.com>
parent f539ff1f
...@@ -853,6 +853,17 @@ bool Lexer::scanOptionalIntegerSuffix(bool allowU) ...@@ -853,6 +853,17 @@ bool Lexer::scanOptionalIntegerSuffix(bool allowU)
scanOptionalIntegerSuffix(false); scanOptionalIntegerSuffix(false);
} }
return true; return true;
case 'i':
case 'I':
yyinp();
if (_yychar == '6') {
yyinp();
if (_yychar == '4') {
yyinp();
return true;
}
}
return false;
case 'l': case 'l':
yyinp(); yyinp();
if (_yychar == 'l') if (_yychar == 'l')
......
...@@ -336,6 +336,30 @@ void tst_SimpleLexer::literals_data() ...@@ -336,6 +336,30 @@ void tst_SimpleLexer::literals_data()
; ;
QTest::newRow("integer-literals") << source << expectedTokenKindList; 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 = source =
"R\"(raw text)\"\n" "R\"(raw text)\"\n"
"R\"delimiter(raw text)delimiter\"\n" "R\"delimiter(raw text)delimiter\"\n"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment