Commit 5c524081 authored by hjk's avatar hjk Committed by Nikolai Kosjar
Browse files

CPlusPlus: Fix parsing of ??< ??> ??( ??) trigraphs



Almost most useful feature ever.

Task-number: QTCREATORBUG-2474
Change-Id: If1ad661fab58ffb4a0b9ddb8ba771f2fde3b54ec
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
parent d179a596
......@@ -297,7 +297,24 @@ void Lexer::scan_helper(Token *tok)
break;
case '?':
if (_yychar == '?') {
yyinp();
if (_yychar == '(') {
yyinp();
tok->f.kind = T_LBRACKET;
} else if (_yychar == ')') {
yyinp();
tok->f.kind = T_RBRACKET;
} else if (_yychar == '<') {
yyinp();
tok->f.kind = T_LBRACE;
} else if (_yychar == '>') {
yyinp();
tok->f.kind = T_RBRACE;
}
} else {
tok->f.kind = T_QUESTION;
}
break;
case '+':
......
......@@ -165,6 +165,13 @@ void tst_SimpleLexer::doxygen_comments_data()
<< T_INT << T_IDENTIFIER << T_SEMICOLON << T_CPP_DOXY_COMMENT
<< T_INT << T_IDENTIFIER << T_SEMICOLON << T_CPP_DOXY_COMMENT << T_CPP_DOXY_COMMENT;
QTest::newRow(source) << source << expectedTokenKindList;
source = "?""?(?""?)?""?<?""?>a?b:c";
expectedTokenKindList = QList<unsigned>()
<< T_LBRACKET << T_RBRACKET << T_LBRACE << T_RBRACE
<< T_IDENTIFIER << T_QUESTION << T_IDENTIFIER << T_COLON << T_IDENTIFIER;
QTest::newRow(source) << source << expectedTokenKindList;
}
QTEST_APPLESS_MAIN(tst_SimpleLexer)
......
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